Skip to content
Permalink
Browse files

Merge remote-tracking branch 'toonbox/issue_442'

  • Loading branch information...
ajohns
ajohns committed Dec 13, 2017
2 parents 143cf66 + 8a89487 commit 8ca303dbdd7c929e7f2b1cda9cf8c738f2430feb
Showing with 21 additions and 3 deletions.
  1. +9 −1 src/rez/cli/depends.py
  2. +12 −2 src/rez/package_search.py
@@ -10,6 +10,12 @@ def setup_parser(parser, completions=False):
parser.add_argument(
"--paths", type=str, default=None,
help="set package search path")
parser.add_argument(
"-b", "--build-requires", action="store_true", default=False,
help="Include build_requires")
parser.add_argument(
"-p", "--private-build-requires", action="store_true", default=False,
help="Include private_build_requires")
parser.add_argument(
"-g", "--graph", action="store_true",
help="display the dependency tree as an image")
@@ -51,7 +57,9 @@ def command(opts, parser, extra_arg_groups=None):
pkgs_list, g = get_reverse_dependency_tree(
package_name=opts.PKG,
depth=opts.depth,
paths=pkg_paths)
paths=pkg_paths,
build_requires=opts.build_requires,
private_build_requires=opts.private_build_requires)

if opts.graph or opts.print_graph or opts.write_graph:
gstr = write_dot(g)
@@ -15,7 +15,9 @@
from rez.utils.formatting import PackageRequest


def get_reverse_dependency_tree(package_name, depth=None, paths=None):
def get_reverse_dependency_tree(package_name, depth=None, paths=None,
build_requires=False,
private_build_requires=False):
"""Find packages that depend on the given package.
This is a reverse dependency lookup. A tree is constructed, showing what
@@ -60,7 +62,15 @@ def get_reverse_dependency_tree(package_name, depth=None, paths=None):
continue

pkg = max(packages, key=lambda x: x.version)
requires = set(pkg.requires or [])
requires = []
if not build_requires and not private_build_requires:
requires = pkg.requires or []
else:
for variant in pkg.iter_variants():
requires += variant.get_requires(build_requires, private_build_requires)

requires = set(requires)

for req_list in (pkg.variants or []):
requires.update(req_list)

0 comments on commit 8ca303d

Please sign in to comment.
You can’t perform that action at this time.