Skip to content

Commit afb99b1

Browse files
committed
Move setting of PYTHON variables to correct method in Python easyblock
1 parent 917cea3 commit afb99b1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

easybuild/easyblocks/p/python.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,6 @@ def prepare_for_extensions(self):
459459
self.cfg['exts_defaultclass'] = "PythonPackage"
460460
self.cfg['exts_filter'] = EXTS_FILTER_PYTHON_PACKAGES
461461

462-
set_py_env_vars(self.log)
463-
464462
# don't pass down any build/install options that may have been specified
465463
# 'make' options do not make sense for when building/installing Python libraries (usually via 'python setup.py')
466464
msg = "Unsetting '%s' easyconfig parameter before building/installing extensions: %s"
@@ -726,6 +724,16 @@ def _sanity_check_ebpythonprefixes(self):
726724
raise EasyBuildError("EasyBuilds sitecustomize.py did not add %s before %s to sys.path (%s)",
727725
temp_site_packages_path, base_site_packages_path, paths)
728726

727+
def load_module(self, *args, **kwargs):
728+
"""(Re)set environment variables after loading module file.
729+
730+
Required here to ensure the variables are also defined for stand-alone installations,
731+
because the environment is reset to the initial environment right before loading the module.
732+
"""
733+
734+
super().load_module(*args, **kwargs)
735+
set_py_env_vars(self.log)
736+
729737
def sanity_check_step(self):
730738
"""Custom sanity check for Python."""
731739

0 commit comments

Comments
 (0)