diff --git a/easybuild/easyblocks/generic/pythonpackage.py b/easybuild/easyblocks/generic/pythonpackage.py index 4b76d7e14bb..5663008c215 100644 --- a/easybuild/easyblocks/generic/pythonpackage.py +++ b/easybuild/easyblocks/generic/pythonpackage.py @@ -50,7 +50,7 @@ from easybuild.tools.build_log import EasyBuildError, print_msg from easybuild.tools.config import build_option, PYTHONPATH, EBPYTHONPREFIXES from easybuild.tools.filetools import change_dir, mkdir, remove_dir, symlink, which -from easybuild.tools.modules import get_software_root +from easybuild.tools.modules import ModEnvVarType, get_software_root from easybuild.tools.run import run_shell_cmd, subprocess_popen_text from easybuild.tools.utilities import nub from easybuild.tools.hooks import CONFIGURE_STEP, BUILD_STEP, TEST_STEP, INSTALL_STEP @@ -513,6 +513,11 @@ def __init__(self, *args, **kwargs): # Don't let pip connect to PYPI to check for a new version env.setvar('PIP_DISABLE_PIP_VERSION_CHECK', 'true') + # avoid that lib subdirs are appended to $*LIBRARY_PATH if they don't provide libraries + # typically, only lib/pythonX.Y/site-packages should be added to $PYTHONPATH (see make_module_extra) + self.module_load_environment.LD_LIBRARY_PATH.type = ModEnvVarType.PATH_WITH_TOP_FILES + self.module_load_environment.LIBRARY_PATH.type = ModEnvVarType.PATH_WITH_TOP_FILES + def determine_install_command(self): """ Determine install command to use. @@ -1151,28 +1156,6 @@ def sanity_check_step(self, *args, **kwargs): return (parent_success and success, parent_fail_msg + fail_msg) - def make_module_req_guess(self): - """ - Define list of subdirectories to consider for updating path-like environment variables ($PATH, etc.). - """ - guesses = super(PythonPackage, self).make_module_req_guess() - - # avoid that lib subdirs are appended to $*LIBRARY_PATH if they don't provide libraries - # typically, only lib/pythonX.Y/site-packages should be added to $PYTHONPATH (see make_module_extra) - for envvar in ['LD_LIBRARY_PATH', 'LIBRARY_PATH']: - newlist = [] - for subdir in guesses[envvar]: - # only subdirectories that contain one or more files/libraries should be retained - fullpath = os.path.join(self.installdir, subdir) - if os.path.exists(fullpath): - if any([os.path.isfile(os.path.join(fullpath, x)) for x in os.listdir(fullpath)]): - newlist.append(subdir) - self.log.debug("Only retaining %s subdirs from %s for $%s (others don't provide any libraries)", - newlist, guesses[envvar], envvar) - guesses[envvar] = newlist - - return guesses - def make_module_extra(self, *args, **kwargs): """Add install path to PYTHONPATH""" txt = ''