Fix bug that caused packages installed upstream to install module files to user directory
This commit is contained in:
@@ -217,8 +217,19 @@ def root_path(name):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# Root folders where the various module files should be written
|
# Root folders where the various module files should be written
|
||||||
roots = spack.config.get('config:module_roots', {})
|
active_upstream = spack.config.get('config:active_upstream')
|
||||||
path = roots.get(name, os.path.join(spack.paths.share_path, name))
|
if active_upstream is 'global':
|
||||||
|
# Installs module files to global upstream share directory
|
||||||
|
path = os.path.join(spack.paths.share_path, name)
|
||||||
|
elif active_upstream is not None:
|
||||||
|
# Installs module files to upstream share directory.
|
||||||
|
# Extra logic is needed for determining this location.
|
||||||
|
roots = spack.config.get('upstreams')[active_upstream][modules]
|
||||||
|
path = roots.get(name, os.path.join(spack.paths.user_share_path, name))
|
||||||
|
else:
|
||||||
|
# If no upstream is active, install module files to user share directory.
|
||||||
|
roots = spack.config.get('config:module_roots', {})
|
||||||
|
path = roots.get(name, os.path.join(spack.paths.user_share_path, name))
|
||||||
return spack.util.path.canonicalize_path(path)
|
return spack.util.path.canonicalize_path(path)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
stage_path = os.path.join(user_var_path, "stage")
|
stage_path = os.path.join(user_var_path, "stage")
|
||||||
repos_path = os.path.join(var_path, "repos")
|
repos_path = os.path.join(var_path, "repos")
|
||||||
share_path = os.path.join(prefix, "share", "spack")
|
share_path = os.path.join(prefix, "share", "spack")
|
||||||
|
user_share_path = os.path.join(user_config_path, "share", "spack")
|
||||||
|
|
||||||
# Paths to built-in Spack repositories.
|
# Paths to built-in Spack repositories.
|
||||||
packages_path = os.path.join(repos_path, "builtin")
|
packages_path = os.path.join(repos_path, "builtin")
|
||||||
|
|||||||
Reference in New Issue
Block a user