Exemplo n.º 1
0
def execute(args):
    parser, args = parse_args(args)

    if not args.subcommand:
        parser.print_help()
        exit()

    elif args.subcommand == 'channels':
        if not args.test_installable:
            parser.error(
                "At least one option (--test-installable) is required.")
        else:
            print(api.test_installable(args.channel))
    elif args.subcommand == 'linkages':
        print(
            api.inspect_linkages(args.packages,
                                 prefix=get_prefix(args),
                                 untracked=args.untracked,
                                 all_packages=args.all,
                                 show_files=args.show_files,
                                 groupby=args.groupby))
    elif args.subcommand == 'objects':
        print(
            api.inspect_objects(args.packages,
                                prefix=get_prefix(args),
                                groupby=args.groupby))
    elif args.subcommand == 'prefix-lengths':
        if not api.inspect_prefix_length(
                args.packages, min_prefix_length=args.min_prefix_length):
            sys.exit(1)
    elif args.subcommand == 'hash-inputs':
        pprint(api.inspect_hash_inputs(args.packages))
    else:
        raise ValueError("Unrecognized subcommand: {0}.".format(
            args.subcommand))
Exemplo n.º 2
0
def execute(args):
    parser, args = parse_args(args)

    if not args.subcommand:
        parser.print_help()
        exit()

    elif args.subcommand == 'channels':
        if not args.test_installable:
            parser.error("At least one option (--test-installable) is required.")
        else:
            print(api.test_installable(args.channel))
    elif args.subcommand == 'linkages':
        print(api.inspect_linkages(args.packages, prefix=get_prefix(args),
                                   untracked=args.untracked, all_packages=args.all,
                                   show_files=args.show_files, groupby=args.groupby))
    elif args.subcommand == 'objects':
        print(api.inspect_objects(args.packages, prefix=get_prefix(args), groupby=args.groupby))
    elif args.subcommand == 'prefix-lengths':
        if not api.inspect_prefix_length(args.packages, min_prefix_length=args.min_prefix_length):
            sys.exit(1)
    elif args.subcommand == 'hash-inputs':
        pprint(api.inspect_hash_inputs(args.packages))
    else:
        raise ValueError("Unrecognized subcommand: {0}.".format(args.subcommand))
Exemplo n.º 3
0
def test_env_creation_with_prefix_fallback_disabled(testing_config):
    tempdir = '/tmp' if platform.system() == 'Darwin' else tempfile.gettempdir(
    )
    testing_config.croot = os.path.join(tempdir, 'cb')
    testing_config.anaconda_upload = False
    testing_config.anaconda_upload = False
    testing_config.prefix_length_fallback = False
    testing_config.prefix_length = 80

    recipe_path = os.path.join(metadata_dir, "has_prefix_files")
    metadata = api.render(recipe_path, config=testing_config)[0][0]
    fn = api.get_output_file_paths(metadata)[0]
    if os.path.isfile(fn):
        os.remove(fn)

    with pytest.raises((SystemExit, PaddingError, LinkError, CondaError)):
        output = api.build(metadata)[0]
        assert not api.inspect_prefix_length(output, 255)
        testing_config.prefix_length = 255
        environ.create_env(testing_config.build_prefix,
                           specs_or_actions=["python",
                                             metadata.name()],
                           env='build',
                           config=testing_config,
                           subdir=subdir)
Exemplo n.º 4
0
def test_env_creation_with_short_prefix_does_not_deadlock(testing_workdir, caplog):
    config = api.Config(croot=testing_workdir, anaconda_upload=False, verbose=True,
                        set_build_id=False, _prefix_length=80)
    recipe_path = os.path.join(metadata_dir, "has_prefix_files")
    metadata = api.render(recipe_path, config=config)[0][0]
    output = api.build(metadata)[0]
    assert not api.inspect_prefix_length(output, 255)
    config.prefix_length = 255
    environ.create_env(config.build_prefix, specs_or_actions=["python", metadata.name()],
                        config=config, subdir=subdir)
    assert 'One or more of your package dependencies needs to be rebuilt' in caplog.text
Exemplo n.º 5
0
def test_env_creation_with_short_prefix_does_not_deadlock(testing_workdir, caplog):
    tempdir = '/tmp' if platform.system() == 'Darwin' else tempfile.gettempdir()
    config = api.Config(croot=os.path.join(tempdir, 'cb'), anaconda_upload=False, verbose=True,
                        set_build_id=False, _prefix_length=80)
    recipe_path = os.path.join(metadata_dir, "has_prefix_files")
    metadata = api.render(recipe_path, config=config)[0][0]
    output = api.build(metadata)[0]
    assert not api.inspect_prefix_length(output, 255)
    config.prefix_length = 255
    environ.create_env(config.build_prefix, specs_or_actions=["python", metadata.name()],
                       env='build', config=config, subdir=subdir)
    assert 'One or more of your package dependencies needs to be rebuilt' in caplog.text
Exemplo n.º 6
0
def test_env_creation_with_prefix_fallback_disabled():
    test_base = os.path.expanduser("~/cbtmp")
    config = api.Config(croot=test_base, anaconda_upload=False, verbose=True,
                        prefix_length_fallback=False, _prefix_length=80)
    recipe_path = os.path.join(metadata_dir, "has_prefix_files")
    metadata = api.render(recipe_path, config=config)[0][0]
    fn = api.get_output_file_path(metadata)[0]
    if os.path.isfile(fn):
        os.remove(fn)

    with pytest.raises((SystemExit, PaddingError, LinkError, CondaError)):
        output = api.build(metadata)[0]
        assert not api.inspect_prefix_length(output, 255)
        config.prefix_length = 255
        environ.create_env(config.build_prefix, specs_or_actions=["python", metadata.name()],
                           config=config, subdir=subdir)
Exemplo n.º 7
0
def test_env_creation_with_prefix_fallback_disabled():
    test_base = os.path.expanduser("~/cbtmp")
    config = api.Config(croot=test_base, anaconda_upload=False, verbose=True,
                        prefix_length_fallback=False)
    recipe_path = os.path.join(metadata_dir, "has_prefix_files")
    metadata, _, _ = api.render(recipe_path, config=config)
    metadata.meta['package']['name'] = 'test_env_creation_with_short_prefix'
    fn = api.get_output_file_path(metadata)
    if os.path.isfile(fn):
        os.remove(fn)
    config.prefix_length = 80

    with pytest.raises((SystemExit, PaddingError, LinkError)):
        api.build(metadata)
        pkg_name = os.path.basename(fn).replace("-1.0-0.tar.bz2", "")
        assert not api.inspect_prefix_length(fn, 255)
        config.prefix_length = 255
        build.create_env(config.build_prefix, specs=["python", pkg_name], config=config)
Exemplo n.º 8
0
def test_env_creation_with_short_prefix_does_not_deadlock(
        testing_workdir, caplog):
    config = api.Config(croot=testing_workdir,
                        anaconda_upload=False,
                        verbose=True,
                        set_build_id=False,
                        _prefix_length=80)
    recipe_path = os.path.join(metadata_dir, "has_prefix_files")
    metadata = api.render(recipe_path, config=config)[0][0]
    try:
        output = api.build(metadata)[0]
        assert not api.inspect_prefix_length(output, 255)
        config.prefix_length = 255
        environ.create_env(config.build_prefix,
                           specs=["python", metadata.name()],
                           config=config,
                           subdir=subdir)
    except:
        raise
    assert 'One or more of your package dependencies needs to be rebuilt' in caplog.text
Exemplo n.º 9
0
def test_env_creation_with_short_prefix_does_not_deadlock(caplog):
    test_base = os.path.expanduser("~/cbtmp")
    config = api.Config(croot=test_base, anaconda_upload=False, verbose=True)
    recipe_path = os.path.join(metadata_dir, "has_prefix_files")
    metadata, _, _ = api.render(recipe_path, config=config)
    metadata.meta['package']['name'] = 'test_env_creation_with_short_prefix'
    fn = api.get_output_file_path(metadata)
    if os.path.isfile(fn):
        os.remove(fn)
    config.prefix_length = 80
    try:
        api.build(metadata)
        pkg_name = os.path.basename(fn).replace("-1.0-0.tar.bz2", "")
        assert not api.inspect_prefix_length(fn, 255)
        config.prefix_length = 255
        build.create_env(config.build_prefix, specs=["python", pkg_name], config=config)
    except:
        raise
    finally:
        rm_rf(test_base)
    assert 'One or more of your package dependencies needs to be rebuilt' in caplog.text()
Exemplo n.º 10
0
def test_env_creation_with_prefix_fallback_disabled():
    test_base = os.path.expanduser("~/cbtmp")
    config = api.Config(croot=test_base,
                        anaconda_upload=False,
                        verbose=True,
                        prefix_length_fallback=False,
                        _prefix_length=80)
    recipe_path = os.path.join(metadata_dir, "has_prefix_files")
    metadata = api.render(recipe_path, config=config)[0][0]
    fn = api.get_output_file_path(metadata)[0]
    if os.path.isfile(fn):
        os.remove(fn)

    with pytest.raises((SystemExit, PaddingError, LinkError, CondaError)):
        output = api.build(metadata)[0]
        assert not api.inspect_prefix_length(output, 255)
        config.prefix_length = 255
        environ.create_env(config.build_prefix,
                           specs=["python", metadata.name()],
                           config=config,
                           subdir=subdir)
Exemplo n.º 11
0
def test_env_creation_with_prefix_fallback_disabled(testing_config):
    tempdir = '/tmp' if platform.system() == 'Darwin' else tempfile.gettempdir()
    testing_config.croot = os.path.join(tempdir, 'cb')
    testing_config.anaconda_upload = False
    testing_config.anaconda_upload = False
    testing_config.prefix_length_fallback = False
    testing_config.prefix_length = 80

    recipe_path = os.path.join(metadata_dir, "has_prefix_files")
    metadata = api.render(recipe_path, config=testing_config)[0][0]
    fn = api.get_output_file_paths(metadata)[0]
    if os.path.isfile(fn):
        os.remove(fn)

    with pytest.raises((SystemExit, PaddingError, LinkError, CondaError)):
        output = api.build(metadata)[0]
        assert not api.inspect_prefix_length(output, 255)
        testing_config.prefix_length = 255
        environ.create_env(testing_config.build_prefix,
                           specs_or_actions=["python", metadata.name()],
                           env='build', config=testing_config, subdir=subdir)
Exemplo n.º 12
0
def test_env_creation_with_prefix_fallback_disabled():
    test_base = os.path.expanduser("~/cbtmp")
    config = api.Config(croot=test_base,
                        anaconda_upload=False,
                        verbose=True,
                        prefix_length_fallback=False)
    recipe_path = os.path.join(metadata_dir, "has_prefix_files")
    metadata, _, _ = api.render(recipe_path, config=config)
    metadata.meta['package']['name'] = 'test_env_creation_with_short_prefix'
    fn = api.get_output_file_path(metadata)
    if os.path.isfile(fn):
        os.remove(fn)
    config.prefix_length = 80

    with pytest.raises((SystemExit, PaddingError, LinkError)):
        api.build(metadata)
        pkg_name = os.path.basename(fn).replace("-1.0-0.tar.bz2", "")
        assert not api.inspect_prefix_length(fn, 255)
        config.prefix_length = 255
        build.create_env(config.build_prefix,
                         specs=["python", pkg_name],
                         config=config)
Exemplo n.º 13
0
def test_env_creation_with_short_prefix_does_not_deadlock(caplog):
    test_base = os.path.expanduser("~/cbtmp")
    config = api.Config(croot=test_base, anaconda_upload=False, verbose=True)
    recipe_path = os.path.join(metadata_dir, "has_prefix_files")
    metadata, _, _ = api.render(recipe_path, config=config)
    metadata.meta['package']['name'] = 'test_env_creation_with_short_prefix'
    fn = api.get_output_file_path(metadata)
    if os.path.isfile(fn):
        os.remove(fn)
    config.prefix_length = 80
    try:
        api.build(metadata)
        pkg_name = os.path.basename(fn).replace("-1.0-0.tar.bz2", "")
        assert not api.inspect_prefix_length(fn, 255)
        config.prefix_length = 255
        build.create_env(config.build_prefix,
                         specs=["python", pkg_name],
                         config=config)
    except:
        raise
    finally:
        rm_rf(test_base)
    assert 'One or more of your package dependencies needs to be rebuilt' in caplog.text