-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Environment activation changes custom scopes priority #48414
Copy link
Copy link
Labels
Description
Steps to reproduce
This is similar to #48254, and refers to #48255 (comment)
A simple reproducer is the following script:
# config_scopes.py
import spack.config
import spack.environment
print(f"BEFORE: {', '.join(spack.config.CONFIG.scopes)}\n")
with spack.environment.no_active_environment():
print(f"NO ENV: {', '.join(spack.config.CONFIG.scopes)}\n")
print(f"AFTER: {', '.join(spack.config.CONFIG.scopes)}\n")run with an environment active:
$ spack env activate --temp
==> Created and activated temporary environment in /tmp/spack-6mtybnl2
$ spack -C /tmp python config_scopes.pyError message
There is no error message, but the output is wrong:
$ spack -C /tmp python ~/PycharmProjects/spack/config_scope.py
BEFORE: _builtin, defaults, defaults/linux, system, system/linux, site, site/linux, user, user/linux, env:/tmp/spack-j27fvyfw, cmd_scope_0, cmd_scope_0/linux, command_line
NO ENV: _builtin, defaults, defaults/linux, system, system/linux, site, site/linux, user, user/linux, cmd_scope_0, cmd_scope_0/linux, command_line
AFTER: _builtin, defaults, defaults/linux, system, system/linux, site, site/linux, user, user/linux, cmd_scope_0, cmd_scope_0/linux, env:/tmp/spack-j27fvyfw, command_lineWhen we exit the context manager, the environment has higher priority than the custom config scopes.
Information on your system
- Spack: 0.24.0.dev0 (fc24be5)
- Python: 3.13.0
- Platform: linux-ubuntu20.04-icelake
General information
- I have run
spack debug reportand reported the version of Spack/Python/Platform - I have searched the issues of this repo and believe this is not a duplicate
- I have run the failing commands in debug mode and reported the output
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done