def disable_spack_config_scopes(self,spack_dir):
# disables all config scopes except "defaults", which we will
# force our settings into
spack_lib_config = pjoin(spack_dir,"lib","spack","spack","config.py")
print("[disabling config scope (except defaults) in: {0}]".format(spack_lib_config))
cfg_script = open(spack_lib_config).read()
for cfg_scope_stmt in ["('system', os.path.join(spack.paths.system_etc_path, 'spack')),",
"('site', os.path.join(spack.paths.etc_path, 'spack')),",
"('user', spack.paths.user_config_path)"]:
cfg_script = cfg_script.replace(cfg_scope_stmt,
"#DISABLED BY UBERENV: " + cfg_scope_stmt)
open(spack_lib_config,"w").write(cfg_script)
Don't have a good long term solution right now that preserves the original intentions, but I do have a workaround.
diff --git a/uberenv.py b/uberenv.py
index 2570c8a..162d1a9 100755
--- a/uberenv.py
+++ b/uberenv.py
@@ -719,9 +719,9 @@ class SpackEnv(UberEnv):
spack_lib_config = pjoin(spack_dir,"lib","spack","spack","config.py")
print("[disabling config scope (except defaults) in: {0}]".format(spack_lib_config))
cfg_script = open(spack_lib_config).read()
- for cfg_scope_stmt in ["('system', os.path.join(spack.paths.system_etc_path, 'spack')),",
- "('site', os.path.join(spack.paths.etc_path, 'spack')),",
- "('user', spack.paths.user_config_path)"]:
+ for cfg_scope_stmt in [" configuration_paths.append(\n ('site', os.path.join(spack.paths.etc_path, 'spack')),\n )", " if not disable_local_config:\n configuration_paths.append(\n ('user', spack.paths.user_config_path)\n )"]:
+ cfg_script = cfg_script.replace(cfg_scope_stmt, "#DISABLED BY UBERENV: ")
+ for cfg_scope_stmt in ["('system', os.path.join(spack.paths.system_etc_path, 'spack')),"]:
cfg_script = cfg_script.replace(cfg_scope_stmt,
"#DISABLED BY UBERENV: " + cfg_scope_stmt)
open(spack_lib_config,"w").write(cfg_script)