diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py index c67b63cba0002af9e3929040c8b0f4efd5bd2d2b..53cbc44ca53231c97c81332d3ee3f6cf01c40de5 100644 --- a/lib/spack/spack/architecture.py +++ b/lib/spack/spack/architecture.py @@ -493,3 +493,15 @@ def sys_type(): """ arch = Arch(platform(), 'default_os', 'default_target') return str(arch) + + +@memoized +def compatible_sys_types(): + """Returns a list of all the systypes compatible with the current host.""" + compatible_archs = [] + current_host = cpu.host() + compatible_targets = [current_host] + current_host.ancestors + for target in compatible_targets: + arch = Arch(platform(), 'default_os', target) + compatible_archs.append(str(arch)) + return compatible_archs diff --git a/lib/spack/spack/main.py b/lib/spack/spack/main.py index a2220a9ba811fc1138794868f4e5a1849b10c8ce..c3746b6b26a89996ca96a2f3074a43dd22a9aeba 100644 --- a/lib/spack/spack/main.py +++ b/lib/spack/spack/main.py @@ -585,7 +585,8 @@ def shell_set(var, value): # print sys type shell_set('_sp_sys_type', spack.architecture.sys_type()) - + shell_set('_sp_compatible_sys_types', + ':'.join(spack.architecture.compatible_sys_types())) # print roots for all module systems module_roots = spack.config.get('config:module_roots') module_to_roots = { diff --git a/share/spack/setup-env.csh b/share/spack/setup-env.csh index f2b5b00006feb2935f2292bbe345bafbe786963a..ac5479196d463b1f2ed3ea3bfbcc5a4aaae7bfe3 100755 --- a/share/spack/setup-env.csh +++ b/share/spack/setup-env.csh @@ -26,8 +26,11 @@ if ($?SPACK_ROOT) then # Set up modules and dotkit search paths in the user environment set tcl_roots = `echo $_sp_tcl_roots:q | sed 's/:/ /g'` + set compatible_sys_types = `echo $_sp_compatible_sys_types:q | sed 's/:/ /g'` foreach tcl_root ($tcl_roots:q) - _spack_pathadd MODULEPATH "$tcl_root/$_sp_sys_type" + foreach systype ($compatible_sys_types:q) + _spack_pathadd MODULEPATH "$tcl_root/$systype" + end end set dotkit_roots = `echo $_sp_dotkit_roots:q | sed 's/:/ /g'` diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh index ae6d00a47b749c7ad11da7195862909877836ae0..0fd5eb30f726b96759324016bb7d629674bfe014 100755 --- a/share/spack/setup-env.sh +++ b/share/spack/setup-env.sh @@ -350,7 +350,9 @@ _sp_multi_pathadd() { setopt sh_word_split fi for pth in $2; do - _spack_pathadd "$1" "${pth}/${_sp_sys_type}" + for systype in ${_sp_compatible_sys_types}; do + _spack_pathadd "$1" "${pth}/${systype}" + done done } _sp_multi_pathadd MODULEPATH "$_sp_tcl_roots"