Skip to content

Commit ba28b96

Browse files
committed
Use relative paths when looking for python paths
Not only simplifies the code but is also the obviously correct way which i should have used from the start.
1 parent dc488f5 commit ba28b96

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

easybuild/framework/easyblock.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,10 +1439,9 @@ def make_module_extra(self, altroot=None, altversion=None):
14391439
lines.append(self.module_generator.append_paths(key, value, allow_abs=self.cfg['allow_append_abs_path']))
14401440

14411441
# Add automatic PYTHONPATH or EBPYTHONPREFIXES if they aren't already present and python paths exist
1442-
if not os.path.isfile(f'{self.installdir}/bin/python'): # only needed when not a base python installation
1443-
python_paths = [os.path.relpath(path, self.installdir)
1444-
for path in glob.glob(f'{self.installdir}/lib/python*/site-packages')
1445-
if re.match(self.installdir + r'/lib/python\d+\.\d+/site-packages', path)]
1442+
if not os.path.isfile(os.path.join(self.installdir, 'bin/python')): # only needed when not a python install
1443+
python_paths = [path for path in glob.glob('lib/python*/site-packages', root_dir=self.installdir)
1444+
if re.match(r'lib/python\d+\.\d+/site-packages', path]
14461445

14471446
runtime_deps = [dep['name'] for dep in self.cfg.dependencies(runtime_only=True)]
14481447
use_ebpythonprefixes = 'Python' in runtime_deps and \

0 commit comments

Comments
 (0)