Skip to content

Commit 1a4bd52

Browse files
committed
Add more reliable way to detect Python dep
1 parent 5d0fe87 commit 1a4bd52

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

easybuild/easyblocks/generic/pythonbundle.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,9 @@ def make_module_extra(self, *args, **kwargs):
134134
# update $EBPYTHONPREFIXES rather than $PYTHONPATH
135135
# if this Python package was installed for multiple Python versions
136136
# or if we prefer it
137-
use_ebpythonprefixes = get_software_root('Python') and build_option('prefer_ebpythonprefixes') and \
138-
self.cfg['prefer_ebpythonprefixes']
137+
runtime_deps = [dep['name'] for dep in self.cfg.dependencies(runtime_only=True)]
138+
use_ebpythonprefixes = 'Python' in runtime_deps and \
139+
build_option('prefer_ebpythonprefixes') and self.cfg['prefer_ebpythonprefixes']
139140
if self.multi_python or use_ebpythonprefixes:
140141
if EBPYTHONPREFIXES not in self.module_generator.added_paths_per_key:
141142
txt += self.module_generator.prepend_paths(EBPYTHONPREFIXES, '')

easybuild/easyblocks/generic/pythonpackage.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,9 +1129,9 @@ def make_module_extra(self, *args, **kwargs):
11291129
# update $EBPYTHONPREFIXES rather than $PYTHONPATH
11301130
# if this Python package was installed for multiple Python versions
11311131
# or if we prefer it
1132-
1133-
use_ebpythonprefixes = get_software_root('Python') and build_option('prefer_ebpythonprefixes') and \
1134-
self.cfg['prefer_ebpythonprefixes']
1132+
runtime_deps = [dep['name'] for dep in self.cfg.dependencies(runtime_only=True)]
1133+
use_ebpythonprefixes = 'Python' in runtime_deps and \
1134+
build_option('prefer_ebpythonprefixes') and self.cfg['prefer_ebpythonprefixes']
11351135
if self.multi_python or use_ebpythonprefixes:
11361136
txt += self.module_generator.prepend_paths(EBPYTHONPREFIXES, '')
11371137
elif self.require_python:

0 commit comments

Comments
 (0)