Only create default path when used
This commit is contained in:
parent
2f7c850a20
commit
730d005a56
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/scratch/psakiev/spack/share/spack/qa/bashcov
|
||||||
#
|
#
|
||||||
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
|
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
|
||||||
# sbang project developers. See the top-level COPYRIGHT file for details.
|
# sbang project developers. See the top-level COPYRIGHT file for details.
|
||||||
@ -15,7 +15,7 @@
|
|||||||
# To use, put the long shebang on the second line of your script, and
|
# To use, put the long shebang on the second line of your script, and
|
||||||
# make sbang the interpreter, like this:
|
# make sbang the interpreter, like this:
|
||||||
#
|
#
|
||||||
# #!/bin/sh /path/to/sbang
|
# #!/scratch/psakiev/spack/share/spack/qa/bashcov /path/to/sbang
|
||||||
# #!/long/path/to/real/interpreter with arguments
|
# #!/long/path/to/real/interpreter with arguments
|
||||||
#
|
#
|
||||||
# `sbang` will run the real interpreter with the script as its argument.
|
# `sbang` will run the real interpreter with the script as its argument.
|
||||||
|
@ -65,11 +65,6 @@
|
|||||||
#: default path where environments are stored in the spack tree
|
#: default path where environments are stored in the spack tree
|
||||||
default_env_path = os.path.join(spack.paths.var_path, "environments")
|
default_env_path = os.path.join(spack.paths.var_path, "environments")
|
||||||
|
|
||||||
# ensure that this base directory exists since we require the root directory to be created
|
|
||||||
# in our checks
|
|
||||||
if not os.path.isdir(default_env_path):
|
|
||||||
os.mkdir(default_env_path)
|
|
||||||
|
|
||||||
|
|
||||||
#: Name of the input yaml file for an environment
|
#: Name of the input yaml file for an environment
|
||||||
manifest_name = "spack.yaml"
|
manifest_name = "spack.yaml"
|
||||||
@ -85,9 +80,15 @@
|
|||||||
|
|
||||||
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"""
|
||||||
return spack.util.path.canonicalize_path(
|
env_path = spack.config.get("config:environments_root", default=default_env_path)
|
||||||
spack.config.get("config:environments_root", default=default_env_path), allow_env=False
|
canonical_path = spack.util.path.canonicalize_path(env_path, allow_env=False)
|
||||||
)
|
if env_path == default_env_path:
|
||||||
|
# create the default path if it is missing, if user paths are missing we errors
|
||||||
|
# and force them to create it themselves to keep spack from adding arbitrary directories
|
||||||
|
# and to help debug typos
|
||||||
|
if not os.path.isdir(canonical_path):
|
||||||
|
os.mkdir(canonical_path)
|
||||||
|
return canonical_path
|
||||||
|
|
||||||
|
|
||||||
def check_disallowed_env_config_mods(scopes):
|
def check_disallowed_env_config_mods(scopes):
|
||||||
|
Loading…
Reference in New Issue
Block a user