Ejemplo 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))
Ejemplo 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))
Ejemplo n.º 3
0
def test_intradependencies(testing_workdir, testing_config):
    # Only necessary because for conda<4.3, the `r` channel was not in `defaults`
    testing_config.channel_urls = ('r')
    testing_config.activate = True
    recipe = os.path.join(subpackage_dir, '_intradependencies')
    outputs1 = api.get_output_file_paths(recipe, config=testing_config)
    outputs1_set = set([os.path.basename(p) for p in outputs1])
    # 2 * (2 * pythons, 1 * lib, 1 * R)
    assert len(outputs1) == 8
    outputs2 = api.build(recipe, config=testing_config)
    assert len(outputs2) == 8
    outputs2_set = set([os.path.basename(p) for p in outputs2])
    assert outputs1_set == outputs2_set, 'pkgs differ :: get_output_file_paths()=%s but build()=%s' % (outputs1_set,
                                                                                                       outputs2_set)
    pkg_hashes = api.inspect_hash_inputs(outputs2)
    py_regex = re.compile('^python.*')
    r_regex = re.compile('^r-base.*')
    for pkg, hashes in pkg_hashes.items():
        try:
            reqs = hashes['recipe']['requirements']['build']
        except:
            reqs = []
        # Assert that:
        # 1. r-base does and python does not appear in the hash inspection for the R packages
        if re.match('^r[0-9]-', pkg):
            assert not len([m.group(0) for r in reqs for m in [py_regex.search(r)] if m])
            assert len([m.group(0) for r in reqs for m in [r_regex.search(r)] if m])
        # 2. python does and r-base does not appear in the hash inspection for the Python packages
        elif re.match('^py[0-9]-', pkg):
            assert not len([m.group(0) for r in reqs for m in [r_regex.search(r)] if m])
            assert len([m.group(0) for r in reqs for m in [py_regex.search(r)] if m])
        # 3. neither python nor r-base appear in the hash inspection for the lib packages
        elif re.match('^lib[0-9]-', pkg):
            assert not len([m.group(0) for r in reqs for m in [r_regex.search(r)] if m])
            assert not len([m.group(0) for r in reqs for m in [py_regex.search(r)] if m])
Ejemplo n.º 4
0
def test_intradependencies(testing_workdir, testing_config):
    # Only necessary because for conda<4.3, the `r` channel was not in `defaults`
    testing_config.channel_urls = ('r')
    testing_config.activate = True
    recipe = os.path.join(subpackage_dir, '_intradependencies')
    outputs1 = api.get_output_file_paths(recipe, config=testing_config)
    outputs1_set = set([os.path.basename(p) for p in outputs1])
    # 2 * (2 * pythons, 1 * lib, 1 * R)
    assert len(outputs1) == 8
    outputs2 = api.build(recipe, config=testing_config)
    assert len(outputs2) == 8
    outputs2_set = set([os.path.basename(p) for p in outputs2])
    assert outputs1_set == outputs2_set, 'pkgs differ :: get_output_file_paths()=%s but build()=%s' % (outputs1_set,
                                                                                                       outputs2_set)
    pkg_hashes = api.inspect_hash_inputs(outputs2)
    py_regex = re.compile('^python.*')
    r_regex = re.compile('^r-base.*')
    for pkg, hashes in pkg_hashes.items():
        try:
            reqs = hashes['recipe']['requirements']['build']
        except:
            reqs = []
        # Assert that:
        # 1. r-base does and python does not appear in the hash inspection for the R packages
        if re.match('^r[0-9]-', pkg):
            assert not len([m.group(0) for r in reqs for m in [py_regex.search(r)] if m])
            assert len([m.group(0) for r in reqs for m in [r_regex.search(r)] if m])
        # 2. python does and r-base does not appear in the hash inspection for the Python packages
        elif re.match('^py[0-9]-', pkg):
            assert not len([m.group(0) for r in reqs for m in [r_regex.search(r)] if m])
            assert len([m.group(0) for r in reqs for m in [py_regex.search(r)] if m])
        # 3. neither python nor r-base appear in the hash inspection for the lib packages
        elif re.match('^lib[0-9]-', pkg):
            assert not len([m.group(0) for r in reqs for m in [r_regex.search(r)] if m])
            assert not len([m.group(0) for r in reqs for m in [py_regex.search(r)] if m])