예제 #1
0
def get_failed_branch(dep_table: pd.DataFrame, build_breaker: str):
    """Traverse dependency table in DFS manner and output installed packages."""
    g = dep_table.convert.to_dependency_graph()
    root = get_root(g)

    failed_branch = []

    if build_breaker:
        failed_branch = nx.shortest_path(g, root, build_breaker)[:-1]

    return failed_branch
예제 #2
0
def get_succesfully_installed_packages(dep_table: pd.DataFrame, build_breaker: str = None):
    """Traverse dependency table in DFS manner and output installed packages."""
    g = dep_table.convert.to_dependency_graph()
    root = get_root(g)

    failed_branch = get_failed_branch(dep_table, build_breaker)

    successfully_installed = set()
    for node in nx.dfs_preorder_nodes(g, root):
        if re.match(re.escape(node), build_breaker or "", re.IGNORECASE):
            break
        successfully_installed.add(node)

    successfully_installed = successfully_installed.difference(set(failed_branch))

    return successfully_installed