Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Spack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
eic_tools
Spack
Commits
4b2f51d0
Commit
4b2f51d0
authored
7 years ago
by
Peter Josef Scheibel
Committed by
Todd Gamblin
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
env: preserve command_line as the scope of highest precedence
Co-authored-by:
Elizabeth Fischer
<
rpf2116@columbia.edu
>
parent
d1cce990
Branches
Branches containing commit
Tags
v4.3.0
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/spack/spack/config.py
+17
-7
17 additions, 7 deletions
lib/spack/spack/config.py
lib/spack/spack/test/conftest.py
+6
-3
6 additions, 3 deletions
lib/spack/spack/test/conftest.py
with
23 additions
and
10 deletions
lib/spack/spack/config.py
+
17
−
7
View file @
4b2f51d0
...
...
@@ -261,13 +261,26 @@ def __init__(self, *scopes):
def
push_scope
(
self
,
scope
):
"""
Add a higher precedence scope to the Configuration.
"""
cmd_line_scope
=
None
if
self
.
scopes
:
highest_precedence_scope
=
list
(
self
.
scopes
.
values
())[
-
1
]
if
highest_precedence_scope
.
name
==
'
command_line
'
:
# If the command-line scope is present, it should always
# be the scope of highest precedence
cmd_line_scope
=
self
.
pop_scope
()
self
.
scopes
[
scope
.
name
]
=
scope
if
cmd_line_scope
:
self
.
scopes
[
'
command_line
'
]
=
cmd_line_scope
def
pop_scope
(
self
):
"""
Remove the highest precedence scope and return it.
"""
name
,
scope
=
self
.
scopes
.
popitem
(
last
=
True
)
return
scope
def
remove_scope
(
self
,
scope_name
):
return
self
.
scopes
.
pop
(
scope_name
)
@property
def
file_scopes
(
self
):
"""
List of writable scopes with an associated file.
"""
...
...
@@ -463,20 +476,17 @@ def override(path_or_scope, value=None):
"""
if
isinstance
(
path_or_scope
,
ConfigScope
):
overrides
=
path_or_scope
config
.
push_scope
(
path_or_scope
)
yield
config
config
.
pop_scope
(
path_or_scope
)
else
:
overrides
=
InternalConfigScope
(
'
overrides
'
)
config
.
push_scope
(
overrides
)
config
.
set
(
path_or_scope
,
value
,
scope
=
'
overrides
'
)
yield
config
yield
config
scope
=
config
.
pop
_scope
()
assert
scope
is
overrides
scope
=
config
.
remove
_scope
(
overrides
.
name
)
assert
scope
is
overrides
#: configuration scopes added on the command line
...
...
This diff is collapsed.
Click to expand it.
lib/spack/spack/test/conftest.py
+
6
−
3
View file @
4b2f51d0
...
...
@@ -254,9 +254,12 @@ def config(configuration_dir):
real_configuration
=
spack
.
config
.
config
spack
.
config
.
config
=
spack
.
config
.
Configuration
(
*
[
spack
.
config
.
ConfigScope
(
name
,
str
(
configuration_dir
.
join
(
name
)))
for
name
in
[
'
site
'
,
'
system
'
,
'
user
'
]])
test_scopes
=
[
spack
.
config
.
ConfigScope
(
name
,
str
(
configuration_dir
.
join
(
name
)))
for
name
in
[
'
site
'
,
'
system
'
,
'
user
'
]]
test_scopes
.
append
(
spack
.
config
.
InternalConfigScope
(
'
command_line
'
))
spack
.
config
.
config
=
spack
.
config
.
Configuration
(
*
test_scopes
)
yield
spack
.
config
.
config
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment