Пример #1
0
def printRootNodes(config_path, recipe_folder, sinceNDays, missing, rootNodes):
    config = utils.load_config(config_path)
    blacklist = utils.get_blacklist(config, recipe_folder)
    recipes = utils.get_recipes(recipe_folder)

    if sinceNDays:
        timeStamp = datetime.timestamp(datetime.now() - timedelta(sinceNDays))
        linux, noarch, osx = getRepoData(timeStamp)
        arch = linux.intersection(osx)
        ready = noarch.union(arch)
        print(
            "{} built in noarch and both archs combined: {} noarch, {} linux-64, {} osx-64"
            .format(len(ready), len(noarch), len(linux), len(osx)))

    dag, name2recipes = graph.build(recipes,
                                    config=config_path,
                                    blacklist=blacklist)
    if not rootNodes:
        root_nodes = sorted([
            (len(nx.algorithms.descendants(dag, k)), k)
            for k, v in dag.in_degree().items()
            if (k.startswith('bioconductor') or k.startswith('r-'))
        ])
    else:
        root_nodes = sorted([
            (len(nx.algorithms.descendants(dag, k)), k)
            for k, v in dag.in_degree().items()
            if v == 0 and (k.startswith('bioconductor') or k.startswith('r-'))
        ])

    print("Package\tNumber of dependant packages")
    for n in root_nodes:
        # blacklisted packages also show up as root nodes with out degree 0
        if n[1] in blacklist:
            continue

        if sinceNDays:
            if n[1] in ready:
                if not missing:
                    print("recipes/{}\t{}".format(n[1], n[0]))
            elif missing:
                print("recipes/{}\t{}".format(n[1], n[0]))
        else:
            print("recipes/{}\t{}".format(n[1], n[0]))
Пример #2
0
def printMissingCRAN(config_path, recipe_folder):
    config = utils.load_config(config_path)
    recipes = utils.get_recipes(recipe_folder)

    repo = getRepoData()

    # Construct a set of all dependencies (ignoring versions)
    dependencies = set()
    for r in recipes:
        if "bioconductor" not in r:
            continue
        d = utils.load_meta_fast(r)[
            0]  # a dictionary with keys requirements, build, etc.
        for dep in d['requirements']['run']:
            if dep.startswith('r-'):
                dependencies.add(dep.split(' ')[0])

    missing = dependencies - repo
    print("Missing {} packages!".format(len(missing)))
    for m in missing:
        print(m)
Пример #3
0
def test_nested_recipes(config_fixture):
    """
    Test get_recipes ability to identify different nesting depths of recipes
    """
    r = Recipes(

        """
        shallow:
            meta.yaml: |
                package:
                    name: shallow
                    version: "0.1"
            build.sh: |
                #!/bin/bash
                echo "Shallow Created"
                pwd
        normal/normal:
            meta.yaml: |
                package:
                    name: normal
                    version: "0.1"
                build:
                    skip: true
                requirements:
                    build:
                        - python 3.6
            build.sh: |
                #!/bin/bash
                echo "Testing build.sh through python"
                python -h
        deep/deep/deep:
            meta.yaml: |
                package:
                    name: deep
                    version: "0.1"
                requirements:
                    build:
                        - python
                    run:
                        - python
            build.sh: |
                #!/bin/bash
                ## Empty script
        F/I/V/E/deep:
            meta.yaml: |
                package:
                    name: fivedeep
                    version: "0.1"
                requirements:
                    build:
                        - python 3.6
                    run:
                        - python 3.6
        """, from_string=True)
    r.write_recipes()

    build_results = build.build_recipes(
        r.basedir,
        config=config_fixture,
        packages="*",
        testonly=False,
        force=False,
        mulled_test=False,
    )
    assert build_results

    assert len(list(utils.get_recipes(r.basedir))) == 4

    for k, v in r.recipe_dirs.items():
        for i in utils.built_package_paths(v):
            assert os.path.exists(i)
            ensure_missing(i)
def bioc_name(recipe):
    """
    Returns the Bioconductor name (rather than the sanitized lowercase bioconda
    name) that can be provided to bioconda-scraper.py
    """
    return MetaData(recipe).meta['source']['fn'].split('_')[0]


if __name__ == "__main__":
    import argparse
    ap = argparse.ArgumentParser()
    ap.add_argument('--repository', default='recipes', help='Recipes directory')
    args = ap.parse_args()

    recipes = list(utils.get_recipes(args.repository, 'bioconductor-*'))
    deps = itertools.chain(
        itertools.chain(*(utils.get_deps(i, build=True) for i in recipes)),
        itertools.chain(*(utils.get_deps(i, build=False) for i in recipes))
    )

    deps = list(filter(lambda x: x.startswith(('r-', 'bioconductor-')), deps))

    bioconda_deps = list(
        filter(
            lambda x: os.path.isdir(x),
            itertools.chain(*(utils.get_recipes(args.repository, i) for i in deps))
        )
    )

    dag, name2recipe = utils.get_dag(bioconda_deps)
def bioc_name(recipe):
    """
    Returns the Bioconductor name (rather than the sanitized lowercase bioconda
    name) that can be provided to bioconda-scraper.py
    """
    return MetaData(recipe).meta['source']['fn'].split('_')[0]


if __name__ == "__main__":
    import argparse
    ap = argparse.ArgumentParser()
    ap.add_argument('--recipes', default='recipes', help='Recipes directory')
    ap.add_argument('--config', default='recipes', help='Config YAML')
    args = ap.parse_args()

    recipes = list(utils.get_recipes(args.recipes, 'bioconductor-*'))
    deps = itertools.chain(
        itertools.chain(*(utils.get_deps(i, build=True, config=args.config)
                          for i in recipes)),
        itertools.chain(*(utils.get_deps(i, build=False, config=args.config)
                          for i in recipes)))

    deps = list(filter(lambda x: x.startswith(('r-', 'bioconductor-')), deps))

    bioconda_deps = list(
        filter(
            lambda x: os.path.isdir(x),
            itertools.chain(*(utils.get_recipes(args.recipes, i)
                              for i in deps))))

    dag, name2recipe = utils.get_dag(bioconda_deps, config=args.config)
Пример #6
0
def test_nested_recipes(config_fixture):
    """
    Test get_recipes ability to identify different nesting depths of recipes
    """
    r = Recipes(

        """
        shallow:
            meta.yaml: |
                package:
                    name: shallow
                    version: "0.1"
            build.sh: |
                #!/bin/bash
                echo "Shallow Created"
                pwd
        normal/normal:
            meta.yaml: |
                package:
                    name: normal
                    version: "0.1"
                build:
                    skip: true
                requirements:
                    build:
                        - python 3.6
            build.sh: |
                #!/bin/bash
                echo "Testing build.sh through python"
                python -h
        deep/deep/deep:
            meta.yaml: |
                package:
                    name: deep
                    version: "0.1"
                requirements:
                    build:
                        - python
                    run:
                        - python
            build.sh: |
                #!/bin/bash
                ## Empty script
        F/I/V/E/deep:
            meta.yaml: |
                package:
                    name: fivedeep
                    version: "0.1"
                requirements:
                    build:
                        - python 3.6
                    run:
                        - python 3.6
        """, from_string=True)
    r.write_recipes()

    build_results = build.build_recipes(
        r.basedir,
        config=config_fixture,
        packages="*",
        testonly=False,
        force=False,
        mulled_test=False,
    )
    assert build_results

    assert len(list(utils.get_recipes(r.basedir))) == 4

    for k, v in r.recipe_dirs.items():
        for i in utils.built_package_paths(v):
            assert os.path.exists(i)
            ensure_missing(i)