Skip to content

Commit

Permalink
Only set PYTHONPATH when ebpythonprefixes is set
Browse files Browse the repository at this point in the history
Also set the path in prepare_step
  • Loading branch information
Flamefire committed Jul 7, 2021
1 parent 485a7db commit 78eadaa
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions easybuild/easyblocks/p/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,6 @@ def __init__(self, *args, **kwargs):

self.pyshortver = '.'.join(self.version.split('.')[:2])

self.pythonpath = None
if self.cfg['ebpythonprefixes']:
easybuild_subdir = log_path()
self.pythonpath = os.path.join(easybuild_subdir, 'python')

ext_defaults = {
# Use PYPI_SOURCE as the default for source_urls of extensions.
'source_urls': [url for name, url, _ in TEMPLATE_CONSTANTS if name == 'PYPI_SOURCE'],
Expand Down Expand Up @@ -182,6 +177,15 @@ def _get_pip_ext_version(self):
return ext[1]
return None

def prepare_step(self, *args, **kwargs):
super(EB_Python, self).prepare_step(*args, **kwargs)

if self.cfg['ebpythonprefixes']:
easybuild_subdir = log_path()
self.pythonpath = os.path.join(easybuild_subdir, 'python')
else:
self.pythonpath = None

def patch_step(self, *args, **kwargs):
"""
Custom patch step for Python:
Expand Down Expand Up @@ -583,7 +587,7 @@ def make_module_extra(self, *args, **kwargs):
"""Add path to sitecustomize.py to $PYTHONPATH"""
txt = super(EB_Python, self).make_module_extra()

if self.pythonpath:
if self.cfg['ebpythonprefixes']:
txt += self.module_generator.prepend_paths('PYTHONPATH', self.pythonpath)

return txt

0 comments on commit 78eadaa

Please sign in to comment.