diff options
author | Peter Scheibel <scheibel1@llnl.gov> | 2019-04-16 19:08:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-16 19:08:10 -0700 |
commit | ef8b5c73cedc0cdbc1dd93277cf533f6c89de65a (patch) | |
tree | b40f61772972e88fe7365fbd103a526c5f1f29c4 | |
parent | 308805cd54d28f18fafba16dab406b4d73b4e263 (diff) | |
download | spack-ef8b5c73cedc0cdbc1dd93277cf533f6c89de65a.tar.gz spack-ef8b5c73cedc0cdbc1dd93277cf533f6c89de65a.tar.bz2 spack-ef8b5c73cedc0cdbc1dd93277cf533f6c89de65a.tar.xz spack-ef8b5c73cedc0cdbc1dd93277cf533f6c89de65a.zip |
don't record 'view: True' in environment config (#11182)
The default (implied) behavior for all environments, as of ea1de6b,
is that an environment will maintain a view in a location of its
choosing. ea1de6b explicitly recorded all three possible states of
maintaining a view:
1. Maintain a view, and let the environment decide where to put it
(default)
2. Maintain a view, and let the user decide
3. Don't maintain a view
This commit updates the config writer so that for case [1], nothing
will be written to the config.yaml. This will not change any existing
behavior, it just serves to keep the config more compact.
-rw-r--r-- | lib/spack/spack/environment.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/spack/spack/environment.py b/lib/spack/spack/environment.py index 68639a9deb..62cad8545c 100644 --- a/lib/spack/spack/environment.py +++ b/lib/spack/spack/environment.py @@ -1029,7 +1029,14 @@ class Environment(object): view = self._view_path else: view = False - config_dict(self.yaml)['view'] = view + + if view is not True: + # The default case is to keep an active view inside of the + # Spack environment directory. To avoid cluttering the config, + # we omit the setting in this case. + yaml_dict['view'] = view + elif 'view' in yaml_dict: + del yaml_dict['view'] # if all that worked, write out the manifest file at the top level with fs.write_tmp_and_move(self.manifest_path) as f: |