Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions easybuild/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
from easybuild.tools.build_details import get_build_stats
from easybuild.tools.build_log import EasyBuildError, EasyBuildExit, dry_run_msg, dry_run_warning, dry_run_set_dirs
from easybuild.tools.build_log import print_error, print_msg, print_warning
from easybuild.tools.config import CHECKSUM_PRIORITY_JSON, DEFAULT_ENVVAR_USERS_MODULES, DEFAULT_MOD_SEARCH_PATH_HEADERS
from easybuild.tools.config import CHECKSUM_PRIORITY_JSON, DEFAULT_ENVVAR_USERS_MODULES
from easybuild.tools.config import EASYBUILD_SOURCES_URL, EBPYTHONPREFIXES # noqa
from easybuild.tools.config import FORCE_DOWNLOAD_ALL, FORCE_DOWNLOAD_PATCHES, FORCE_DOWNLOAD_SOURCES
from easybuild.tools.config import MOD_SEARCH_PATH_HEADERS, PYTHONPATH, SEARCH_PATH_BIN_DIRS, SEARCH_PATH_LIB_DIRS
Expand All @@ -100,7 +100,7 @@
from easybuild.tools.module_generator import ModuleGeneratorLua, ModuleGeneratorTcl, module_generator, dependencies_for
from easybuild.tools.module_naming_scheme.utilities import det_full_ec_version
from easybuild.tools.modules import ROOT_ENV_VAR_NAME_PREFIX, VERSION_ENV_VAR_NAME_PREFIX, DEVEL_ENV_VAR_NAME_PREFIX
from easybuild.tools.modules import Lmod, ModEnvVarType, ModuleLoadEnvironment
from easybuild.tools.modules import Lmod, ModEnvVarType, ModuleLoadEnvironment, MODULE_LOAD_ENV_HEADERS
from easybuild.tools.modules import curr_module_paths, invalidate_module_caches_for, get_software_root
from easybuild.tools.modules import get_software_root_env_var_name, get_software_version_env_var_name
from easybuild.tools.output import PROGRESS_BAR_DOWNLOAD_ALL, PROGRESS_BAR_EASYCONFIG, PROGRESS_BAR_EXTENSIONS
Expand Down Expand Up @@ -223,14 +223,10 @@ def __init__(self, ec, logfile=None):
# environment variables on module load
mod_load_aliases = {}
# apply --module-search-path-headers: easyconfig parameter has precedence
mod_load_cpp_headers = self.cfg['module_search_path_headers']
if mod_load_cpp_headers is False:
mod_load_cpp_headers = build_option('module_search_path_headers')
if mod_load_cpp_headers is False or mod_load_cpp_headers is None:
mod_load_cpp_headers = DEFAULT_MOD_SEARCH_PATH_HEADERS
mod_load_cpp_headers = self.cfg['module_search_path_headers'] or build_option('module_search_path_headers')

try:
mod_load_aliases['HEADERS'] = MOD_SEARCH_PATH_HEADERS[mod_load_cpp_headers]
mod_load_aliases[MODULE_LOAD_ENV_HEADERS] = MOD_SEARCH_PATH_HEADERS[mod_load_cpp_headers]
except KeyError as err:
raise EasyBuildError(
f"Unknown value selected for option module-search-path-headers: {mod_load_cpp_headers}. "
Expand Down
4 changes: 2 additions & 2 deletions easybuild/framework/easyconfig/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@
'moduleloadnoconflict': [False, "Don't check for conflicts, unload other versions instead ", MODULES],
'module_depends_on': [None, 'Use depends_on (Lmod 7.6.1+) for dependencies in generated module '
'(implies recursive unloading of modules) [DEPRECATED]', MODULES],
'module_search_path_headers': [False, "Environment variable set by modules on load with search paths "
"to header files", MODULES],
'module_search_path_headers': [None, "Environment variable set by modules on load "
"with search paths to header files (if None, use $CPATH)", MODULES],
'recursive_module_unload': [None, "Recursive unload of all dependencies when unloading module "
"(True/False to hard enable/disable; None implies honoring the "
"--recursive-module-unload EasyBuild configuration setting", MODULES],
Expand Down
13 changes: 8 additions & 5 deletions easybuild/tools/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,13 @@
PYTHON_SEARCH_PATH_TYPES = [PYTHONPATH, EBPYTHONPREFIXES]

# options to handle header search paths in environment of modules
MOD_SEARCH_PATH_HEADERS_CPATH = 'cpath'
MOD_SEARCH_PATH_HEADERS_INCLUDE_PATHS = 'include_paths'
MOD_SEARCH_PATH_HEADERS = {
"none": [],
"cpath": ["CPATH"],
"include_paths": ["C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH", "OBJC_INCLUDE_PATH"],
MOD_SEARCH_PATH_HEADERS_CPATH: ['CPATH'],
MOD_SEARCH_PATH_HEADERS_INCLUDE_PATHS: ['C_INCLUDE_PATH', 'CPLUS_INCLUDE_PATH', 'OBJC_INCLUDE_PATH'],
}
DEFAULT_MOD_SEARCH_PATH_HEADERS = "cpath"
DEFAULT_MOD_SEARCH_PATH_HEADERS = MOD_SEARCH_PATH_HEADERS_CPATH


class Singleton(ABCMeta):
Expand Down Expand Up @@ -315,7 +316,6 @@ def mk_full_default_path(name, prefix=DEFAULT_PREFIX):
'logtostdout',
'minimal_toolchains',
'module_only',
'module_search_path_headers',
'package',
'parallel_extensions_install',
'read_only_installdir',
Expand Down Expand Up @@ -398,6 +398,9 @@ def mk_full_default_path(name, prefix=DEFAULT_PREFIX):
DEFAULT_MINIMAL_BUILD_ENV: [
'minimal_build_env',
],
DEFAULT_MOD_SEARCH_PATH_HEADERS: [
'module_search_path_headers',
],
DEFAULT_PKG_RELEASE: [
'package_release',
],
Expand Down
7 changes: 4 additions & 3 deletions easybuild/tools/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
from easybuild.tools.utilities import get_subclasses, nub


MODULE_LOAD_ENV_HEADERS = 'HEADERS'

# software root/version environment variable name prefixes
ROOT_ENV_VAR_NAME_PREFIX = "EBROOT"
VERSION_ENV_VAR_NAME_PREFIX = "EBVERSION"
Expand Down Expand Up @@ -283,9 +285,8 @@ def __init__(self, aliases=None):

# environment variables with known aliases
# e.g. search paths to C/C++ headers
if 'HEADERS' in self._aliases:
for envar_name in self._aliases['HEADERS']:
setattr(self, envar_name, SEARCH_PATH_HEADER_DIRS)
for envar_name in self._aliases.get(MODULE_LOAD_ENV_HEADERS, []):
setattr(self, envar_name, SEARCH_PATH_HEADER_DIRS)

def __setattr__(self, name, value):
"""
Expand Down
2 changes: 1 addition & 1 deletion easybuild/tools/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ def config_options(self):
'module-naming-scheme': ("Module naming scheme to use", None, 'store', DEFAULT_MNS),
'module-search-path-headers': ("Environment variable set by modules on load with search paths "
"to header files", 'choice', 'store', DEFAULT_MOD_SEARCH_PATH_HEADERS,
[*MOD_SEARCH_PATH_HEADERS]),
sorted(MOD_SEARCH_PATH_HEADERS.keys())),
'module-syntax': ("Syntax to be used for module files", 'choice', 'store', DEFAULT_MODULE_SYNTAX,
sorted(avail_module_generators().keys())),
'moduleclasses': (("Extend supported module classes "
Expand Down
5 changes: 2 additions & 3 deletions test/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,6 @@ def test_make_module_req(self):
def test_module_search_path_headers(self):
"""Test functionality of module-search-path-headers option"""
sp_headers_mode = {
"none": [],
"cpath": ["CPATH"],
"include_paths": ["C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH", "OBJC_INCLUDE_PATH"],
}
Expand All @@ -687,7 +686,7 @@ def test_module_search_path_headers(self):
self.writeEC()

for build_opt, sp_headers in sp_headers_mode.items():
init_config(build_options={"module_search_path_headers": build_opt, "silent": True})
update_build_option('module_search_path_headers', build_opt)
eb = EasyBlock(EasyConfig(self.eb_file))
eb.installdir = config.install_path()
try:
Expand Down Expand Up @@ -729,7 +728,7 @@ def test_module_search_path_headers(self):
pass

for build_opt in sp_headers_mode:
init_config(build_options={"module_search_path_headers": build_opt, "silent": True})
update_build_option('module_search_path_headers', build_opt)
with eb.module_generator.start_module_creation():
guess = eb.make_module_req()
if not sp_headers:
Expand Down
Loading