Beispiel #1
0
def pypi():
    module_name, dry_run, _ = config.common_arguments()

    tmp_dir = make_virtualenv()
    install_cmd = '%s/bin/pip install %s' % (tmp_dir, module_name)

    package_index = 'pypi'
    pypi = config.arguments['--pypi']
    if pypi:
        install_cmd += '-i %s' % pypi
        package_index = pypi

    try:
        result = shell.execute(install_cmd, dry_run=dry_run)
        if result:
            log.info('Successfully installed %s from %s',
                     module_name, package_index)
        else:
            log.error('Failed to install %s from %s',
                      module_name, package_index)

        verification.run_test_command()
    except:
        log.exception(
            'error installing %s from %s', module_name, package_index
        )
        raise Exception(
            'Error installing %s from %s', module_name, package_index
        )

    path(tmp_dir).rmtree(path(tmp_dir))
Beispiel #2
0
def pypi():
    module_name, dry_run, _ = config.common_arguments()

    tmp_dir = make_virtualenv()
    install_cmd = '%s/bin/pip install %s' % (tmp_dir, module_name)

    package_index = 'pypi'
    pypi = config.arguments['--pypi']
    if pypi:
        install_cmd += '-i %s' % pypi
        package_index = pypi

    try:
        result = shell.execute(install_cmd, dry_run=dry_run)
        if result:
            log.info('Successfully installed %s from %s', module_name,
                     package_index)
        else:
            log.error('Failed to install %s from %s', module_name,
                      package_index)

        verification.run_test_command()
    except:
        log.exception('error installing %s from %s', module_name,
                      package_index)
        raise Exception('Error installing %s from %s', module_name,
                        package_index)

    path(tmp_dir).rmtree(path(tmp_dir))
Beispiel #3
0
def install_package(context):
    """Attempts to install the sdist and wheel."""

    if not context.dry_run and build_package(context):
        with util.mktmpdir() as tmp_dir:
            venv.create_venv(tmp_dir=tmp_dir)
            for distribution in path('dist').files():
                try:
                    venv.install(distribution, tmp_dir)
                    log.info('Successfully installed %s', distribution)
                    if context.test_command and verification.run_test_command(context.test_command):
                        log.info('Successfully ran test command: %s',
                                 test_command)
                except Exception as e:
                    raise Exception('Error installing distribution %s' % distribution, e)
    else:
        log.info('Dry run, skipping installation')
Beispiel #4
0
def install_package(context):
    """Attempts to install the sdist and wheel."""

    if not context.dry_run and build_distributions(context):
        with util.mktmpdir() as tmp_dir:
            venv.create_venv(tmp_dir=tmp_dir)
            for distribution in Path('dist').files():
                try:
                    venv.install(distribution, tmp_dir)
                    log.info('Successfully installed %s', distribution)
                    if context.test_command and verification.run_test_command(
                            context):
                        log.info('Successfully ran test command: %s',
                                 context.test_command)
                except Exception as e:
                    raise Exception(
                        'Error installing distribution %s' % distribution, e)
    else:
        log.info('Dry run, skipping installation')
Beispiel #5
0
def install():
    module_name, dry_run, new_version = config.common_arguments()
    commands = ['setup.py', 'clean', 'sdist']
    if probe.has_requirement('wheel'):
        commands.append('bdist_wheel')
    result = shell.handle_dry_run(sh.python, tuple(commands))
    if result:
        tmp_dir = make_virtualenv()
        package_name = config.arguments.get('--package-name') or module_name
        try:
            virtualenv.install_sdist(
                config.arguments['<module_name>'],
                'dist/%s-%s.tar.gz' % (package_name, new_version),
                '%s/bin/python' % tmp_dir)
            log.info('Successfully installed %s sdist', module_name)
            if verification.run_test_command():
                log.info('Successfully ran test command: %s',
                         config.arguments['--test-command'])
        except:
            raise Exception('Error installing %s sdist', module_name)

        path(tmp_dir).rmtree(path(tmp_dir))
Beispiel #6
0
def install():
    module_name, dry_run, new_version = config.common_arguments()
    commands = ['setup.py', 'clean', 'sdist']
    if probe.has_requirement('wheel'):
        commands.append('bdist_wheel')
    result = shell.handle_dry_run(sh.python, tuple(commands))
    if result:
        tmp_dir = make_virtualenv()
        package_name = config.arguments.get('--package-name') or module_name
        try:
            virtualenv.install_sdist(
                config.arguments['<module_name>'],
                'dist/%s-%s.tar.gz' % (package_name, new_version),
                '%s/bin/python' % tmp_dir
            )
            log.info('Successfully installed %s sdist', module_name)
            if verification.run_test_command():
                log.info('Successfully ran test command: %s',
                         config.arguments['--test-command'])
        except:
            raise Exception('Error installing %s sdist', module_name)

        path(tmp_dir).rmtree(path(tmp_dir))