Skip to content
Snippets Groups Projects
Unverified Commit bd236918 authored by Dr. Christian Tacke's avatar Dr. Christian Tacke Committed by GitHub
Browse files

Configuration: allow usage of command-line scopes with environments (#14608)


Spack did not support usage of the `--config-scope` option in
combination with an environment: In `lib/spack/spack/main.py`,
`spack.config.command_line_scopes` is set equal to any config scopes
passed by the `--config-scope` option. However, this is done after
activating an environment. In the process of activating an environment,
the `spack.config.config` singleton is instantiated, so later setting of
`spack.config.command_line_scopes` is ignored.

This commit sets command line scopes before activating an environment to
ensure that they are included in the configuration.

Co-authored-by: default avatarTim Fuller <tjfulle@sandia.gov>
parent 3949a85f
No related branches found
No related tags found
No related merge requests found
...@@ -701,16 +701,16 @@ def main(argv=None): ...@@ -701,16 +701,16 @@ def main(argv=None):
if stored_var_name in os.environ: if stored_var_name in os.environ:
os.environ[var] = os.environ[stored_var_name] os.environ[var] = os.environ[stored_var_name]
# make spack.config aware of any command line configuration scopes
if args.config_scopes:
spack.config.command_line_scopes = args.config_scopes
# activate an environment if one was specified on the command line # activate an environment if one was specified on the command line
if not args.no_env: if not args.no_env:
env = ev.find_environment(args) env = ev.find_environment(args)
if env: if env:
ev.activate(env, args.use_env_repo) ev.activate(env, args.use_env_repo)
# make spack.config aware of any command line configuration scopes
if args.config_scopes:
spack.config.command_line_scopes = args.config_scopes
if args.print_shell_vars: if args.print_shell_vars:
print_setup_info(*args.print_shell_vars.split(',')) print_setup_info(*args.print_shell_vars.split(','))
return 0 return 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment