Esempio n. 1
0
def test_for_smoke():
    """Do not validate the output of the functions, just make sure that calling
    them does not make depfinder blow up
    """
    deps = list(main.iterate_over_library('.'))
    assert deps is not None
    assert str(deps) is not None
    assert repr(deps) is not None
    # hit the simple api
    assert main.simple_import_search('.') is not None
Esempio n. 2
0
def audit_feedstock(fctx: FeedstockContext, ctx: MigratorSessionContext):
    """Uses Depfinder to audit the requirements for a python package
    """
    # get feedstock
    feedstock_dir = os.path.join(ctx.rever_dir,
                                 fctx.package_name + "-feedstock")
    origin = feedstock_url(fctx=fctx, protocol="https")
    fetch_repo(feedstock_dir=feedstock_dir,
               origin=origin,
               upstream=origin,
               branch="master")
    recipe_dir = os.path.join(feedstock_dir, "recipe")

    # get source code
    cb_work_dir = _get_source_code(recipe_dir)
    with indir(cb_work_dir):
        # run depfinder on source code
        deps = simple_import_search(cb_work_dir, remap=True)
        for k in list(deps):
            deps[k] = set(deps[k])
    return deps
Esempio n. 3
0
def extract_deps_from_source(recipe_dir):
    cb_work_dir = _get_source_code(recipe_dir)
    with indir(cb_work_dir):
        # run depfinder on source code
        imports = simple_import_search(cb_work_dir, ignore=DEPFINDER_IGNORE)
    return {k: set(v) for k, v in imports.items()}