Update lib/spack/spack/environment/environment.py
Co-authored-by: Greg Becker <becker33@llnl.gov> Add back path canonicalization
This commit is contained in:
parent
490b5eef7c
commit
76fde639e8
@ -77,13 +77,12 @@
|
||||
#: Name of the directory where environments store repos, logs, views
|
||||
env_subdir_name = ".spack-env"
|
||||
|
||||
|
||||
def env_root_path():
|
||||
"""Override default root path if the user specified it"""
|
||||
config_path = spack.config.get("config:environments_root", default = None)
|
||||
if config_path:
|
||||
return config_path
|
||||
else:
|
||||
return env_path
|
||||
return spack.util.path.canonicalize_path(
|
||||
spack.config.get("config:environments_root", default=env_path), allow_env=False
|
||||
)
|
||||
|
||||
|
||||
def default_manifest_yaml():
|
||||
|
@ -1444,9 +1444,9 @@ def test_environment_created_in_users_location(mutable_config, tmpdir):
|
||||
assert tmpdir.strpath in env_dir
|
||||
assert not os.path.isdir(env_dir)
|
||||
os.makedirs(env_dir)
|
||||
env('create', 'test')
|
||||
out = env('list')
|
||||
assert 'test' in out
|
||||
env("create", "test")
|
||||
out = env("list")
|
||||
assert "test" in out
|
||||
|
||||
assert env_dir in ev.root('test')
|
||||
assert os.path.isdir(os.path.join(env_dir, 'test'))
|
||||
assert env_dir in ev.root("test")
|
||||
assert os.path.isdir(os.path.join(env_dir, "test"))
|
||||
|
@ -262,7 +262,7 @@ def repl(match):
|
||||
return re.sub(r"(\$\w+\b|\$\{\w+\})", repl, path)
|
||||
|
||||
|
||||
def substitute_path_variables(path, allow_env = True):
|
||||
def substitute_path_variables(path, allow_env=True):
|
||||
"""Substitute config vars, expand environment vars, expand user home."""
|
||||
path = substitute_config_variables(path, allow_env)
|
||||
path = os.path.expandvars(path)
|
||||
@ -306,7 +306,7 @@ def add_padding(path, length):
|
||||
return os.path.join(path, padding)
|
||||
|
||||
|
||||
def canonicalize_path(path, allow_env = True):
|
||||
def canonicalize_path(path, allow_env=True):
|
||||
"""Same as substitute_path_variables, but also take absolute path.
|
||||
|
||||
Arguments:
|
||||
|
Loading…
Reference in New Issue
Block a user