Update lib/spack/spack/environment/environment.py

Co-authored-by: Greg Becker <becker33@llnl.gov>

Add back path canonicalization
This commit is contained in:
psakievich 2022-09-27 11:02:32 -06:00 committed by psakiev
parent 490b5eef7c
commit 76fde639e8
3 changed files with 11 additions and 12 deletions

View File

@ -77,13 +77,12 @@
#: Name of the directory where environments store repos, logs, views #: Name of the directory where environments store repos, logs, views
env_subdir_name = ".spack-env" env_subdir_name = ".spack-env"
def env_root_path(): def env_root_path():
"""Override default root path if the user specified it""" """Override default root path if the user specified it"""
config_path = spack.config.get("config:environments_root", default = None) return spack.util.path.canonicalize_path(
if config_path: spack.config.get("config:environments_root", default=env_path), allow_env=False
return config_path )
else:
return env_path
def default_manifest_yaml(): def default_manifest_yaml():

View File

@ -1444,9 +1444,9 @@ def test_environment_created_in_users_location(mutable_config, tmpdir):
assert tmpdir.strpath in env_dir assert tmpdir.strpath in env_dir
assert not os.path.isdir(env_dir) assert not os.path.isdir(env_dir)
os.makedirs(env_dir) os.makedirs(env_dir)
env('create', 'test') env("create", "test")
out = env('list') out = env("list")
assert 'test' in out assert "test" in out
assert env_dir in ev.root('test') assert env_dir in ev.root("test")
assert os.path.isdir(os.path.join(env_dir, 'test')) assert os.path.isdir(os.path.join(env_dir, "test"))