Пример #1
0
def install_package(path_to_package, package_name, dist_dir):
    print_heading('Installing {}'.format(path_to_package))
    cmd = 'python -m pip install {} --find-links file://{}'.format(package_name, dist_dir)
    cmd_success = exec_command(cmd)
    if not cmd_success:
        print_heading('Error installing {}!'.format(path_to_package), f=sys.stderr)
        sys.exit(1)
    print_heading('Installed {}'.format(path_to_package))
Пример #2
0
def build_package(path_to_package, dist_dir):
    print_heading('Building {}'.format(path_to_package))
    path_to_setup = os.path.join(path_to_package, 'setup.py')
    set_version(path_to_setup)
    cmd_success = exec_command('python setup.py sdist -d {0} bdist_wheel -d {0}'.format(dist_dir), cwd=path_to_package)
    if not cmd_success:
        print_heading('Error building {}!'.format(path_to_package), f=sys.stderr)
        sys.exit(1)
    print_heading('Built {}'.format(path_to_package))
Пример #3
0
def install_package(path_to_package, package_name, dist_dir):
    print_heading('Installing {}'.format(path_to_package))
    cmd = 'python -m pip install {} --find-links file://{}'.format(
        package_name, dist_dir)
    cmd_success = exec_command(cmd)
    if not cmd_success:
        print_heading('Error installing {}!'.format(path_to_package),
                      f=sys.stderr)
        sys.exit(1)
    print_heading('Installed {}'.format(path_to_package))
Пример #4
0
def build_package(path_to_package, dist_dir):
    print_heading('Building {}'.format(path_to_package))
    path_to_setup = os.path.join(path_to_package, 'setup.py')
    set_version(path_to_setup)
    cmd_success = exec_command('python setup.py sdist -d {}'.format(dist_dir),
                               cwd=path_to_package)
    if not cmd_success:
        print_heading('Error building {}!'.format(path_to_package),
                      f=sys.stderr)
        sys.exit(1)
    print_heading('Built {}'.format(path_to_package))
Пример #5
0
failed_module_names = []
skipped_modules = []
for name, fullpath in all_command_modules:
    path_to_module = os.path.join(fullpath, 'azure', 'cli', 'command_modules',
                                  name.replace(COMMAND_MODULE_PREFIX, ''),
                                  'tests')
    if not os.path.isdir(path_to_module):
        skipped_modules.append(name)
        continue
    command = "python -m unittest discover -s " + path_to_module
    # append --buffer when running on CI to ensure any unrecorded tests fail instead of hang
    if os.environ.get('CONTINUOUS_INTEGRATION') and os.environ.get('TRAVIS'):
        command += " --buffer"
    success = exec_command(command,
                           env={
                               'AZURE_CLI_ENABLE_LOG_FILE': '1',
                               'AZURE_CLI_LOG_DIR': LOG_DIR
                           })
    if not success:
        failed_module_names.append(name)

print_summary(failed_module_names)

print("Full debug log available at '{}'.".format(LOG_DIR))

if failed_module_names:
    sys.exit(1)

if skipped_modules:
    print("Modules skipped as no test dir found:",
          ', '.join(skipped_modules),
Пример #6
0
    print('=' * len(heading), file=file)
    print(heading + '\n', file=file)

def set_version(path_to_setup):
    for i, line in enumerate(fileinput.input(path_to_setup, inplace=1)):
        sys.stdout.write(line.replace('version=VERSION', "version='1000.0.0'"));

all_command_modules = get_all_command_modules()

# STEP 1:: Build the packages

print_heading('Building CLI package...')
PATH_TO_CLI_PACKAGE = os.path.abspath(os.path.join(os.path.abspath(__file__), '..', '..', '..'))
path_to_setup = os.path.join(PATH_TO_CLI_PACKAGE, 'setup.py')
set_version(path_to_setup)
success = exec_command('python setup.py sdist', cwd=PATH_TO_CLI_PACKAGE)
if not success:
    print_heading('Error building CLI!', file=sys.stderr)
    sys.exit(1)
print_heading('Built CLI package.')

print_heading('Building command package(s)...')
failed_module_names = []
for name, fullpath in all_command_modules:
    path_to_setup = os.path.join(fullpath, 'setup.py')
    # give package a high version no. so when we install, we install this one
    # and not a version from PyPI
    set_version(path_to_setup)
    success = exec_command('python setup.py sdist', cwd=fullpath)
    if not success:
        failed_module_names.append(name)
Пример #7
0
#---------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#---------------------------------------------------------------------------------------------

## Install the command modules using pip ##
from __future__ import print_function
import os
import sys

from _common import get_all_command_modules, exec_command, print_summary

all_command_modules = get_all_command_modules()
print("Installing command modules.")

failed_module_names = []
for name, fullpath in all_command_modules:
    success = exec_command("python -m pip install -e "+fullpath)
    if not success:
        failed_module_names.append(name)

print_summary(failed_module_names)

if failed_module_names:
    sys.exit(1)
Пример #8
0
LOG_DIR = os.path.expanduser(os.path.join('~', '.azure', 'logs'))

all_command_modules = get_all_command_modules()
print("Running tests on command modules.")

failed_module_names = []
skipped_modules = []
for name, fullpath in all_command_modules:
    path_to_module = os.path.join(fullpath, 'azure', 'cli', 'command_modules', name.replace(COMMAND_MODULE_PREFIX, ''), 'tests')
    if not os.path.isdir(path_to_module):
        skipped_modules.append(name)
        continue
    command = "python -m unittest discover -s " + path_to_module
    # append --buffer when running on CI to ensure any unrecorded tests fail instead of hang
    if os.environ.get('CONTINUOUS_INTEGRATION') and os.environ.get('TRAVIS'):
        command += " --buffer"
    success = exec_command(command, env={'AZURE_CLI_ENABLE_LOG_FILE': '1', 'AZURE_CLI_LOG_DIR': LOG_DIR})
    if not success:
        failed_module_names.append(name)

print_summary(failed_module_names)

print("Full debug log available at '{}'.".format(LOG_DIR))

if failed_module_names:
    sys.exit(1)

if skipped_modules:
    print("Modules skipped as no test dir found:", ', '.join(skipped_modules), file=sys.stderr)
Пример #9
0
#---------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#---------------------------------------------------------------------------------------------

## Runs pylint on the command modules ##
from __future__ import print_function
import os
import sys

from _common import get_all_command_modules, exec_command, print_summary

all_command_modules = get_all_command_modules()
print("Running pylint on command modules.")

failed_module_names = []
for name, fullpath in all_command_modules:
    path_to_module = os.path.join(fullpath, 'azure')
    success = exec_command("python -m pylint -d I0013 -r n "+path_to_module)
    if not success:
        failed_module_names.append(name)

print_summary(failed_module_names)

if failed_module_names:
    sys.exit(1)