Example #1
0
def depfinder_audit_feedstock(fctx: FeedstockContext, ctx: MigratorSessionContext):
    """Uses Depfinder to audit the imports for a python package"""
    # get feedstock
    feedstock_dir = os.path.join(ctx.rever_dir, fctx.feedstock_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")

    return extract_deps_from_source(recipe_dir)
Example #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