Skip to content

Commit 7315b9f

Browse files
committed
improve findPythonDeps to recognize non-canonical package names
For e.g. `ruamel.yaml` the canonical name is `ruamel-yaml` but the package name as recorded is still `ruamel.yaml`. So if the search using the canonical name didn't find anything try again with the original name before failing. Tested on `maggma==0.60.2`
1 parent 769d5e2 commit 7315b9f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

easybuild/scripts/findPythonDeps.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,13 @@ def get_dep_tree(package_spec, verbose):
9696
def find_deps(pkgs, dep_tree):
9797
"""Recursively resolve dependencies of the given package(s) and return them"""
9898
res = []
99-
for pkg in pkgs:
100-
pkg = canonicalize_name(pkg)
99+
for orig_pkg in pkgs:
100+
pkg = canonicalize_name(orig_pkg)
101101
matching_entries = [entry for entry in dep_tree
102102
if pkg in (entry['package']['package_name'], entry['package']['key'])]
103+
if not matching_entries:
104+
matching_entries = [entry for entry in dep_tree
105+
if orig_pkg in (entry['package']['package_name'], entry['package']['key'])]
103106
if not matching_entries:
104107
raise RuntimeError("Found no installed package for '%s' in %s" % (pkg, dep_tree))
105108
if len(matching_entries) > 1:

0 commit comments

Comments
 (0)