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
67a01ef2
Commit
67a01ef2
authored
9 years ago
by
Massimiliano Culpo
Browse files
Options
Downloads
Patches
Plain Diff
tcl : extended conflict to be an array of strings
parent
5deaaa27
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/spack/spack/config.py
+1
-1
1 addition, 1 deletion
lib/spack/spack/config.py
lib/spack/spack/modules.py
+18
-12
18 additions, 12 deletions
lib/spack/spack/modules.py
lib/spack/spack/test/modules.py
+18
-0
18 additions, 0 deletions
lib/spack/spack/test/modules.py
with
37 additions
and
13 deletions
lib/spack/spack/config.py
+
1
−
1
View file @
67a01ef2
...
...
@@ -276,7 +276,7 @@
},
'
autoload
'
:
{
'
$ref
'
:
'
#/definitions/dependency_selection
'
},
'
prerequisites
'
:
{
'
$ref
'
:
'
#/definitions/dependency_selection
'
},
'
conflict
'
:
{
'
type
'
:
'
string
'
},
'
conflict
'
:
{
'
$ref
'
:
'
#/definitions/array_of_
string
s
'
},
'
environment
'
:
{
'
type
'
:
'
object
'
,
'
default
'
:
{},
...
...
This diff is collapsed.
Click to expand it.
lib/spack/spack/modules.py
+
18
−
12
View file @
67a01ef2
...
...
@@ -46,6 +46,7 @@
import
os.path
import
re
import
textwrap
import
string
import
llnl.util.tty
as
tty
import
spack
...
...
@@ -499,15 +500,20 @@ def header(self):
def
module_specific_content
(
self
,
configuration
):
naming_tokens
=
self
.
tokens
# Conflict
conflict_format
=
configuration
.
get
(
'
conflict
'
,
''
)
if
conflict_format
:
for
naming_dir
,
conflict_dir
in
zip
(
self
.
naming_scheme
.
split
(
'
/
'
),
conflict_format
.
split
(
'
/
'
)):
if
naming_dir
!=
conflict_dir
:
message
=
'
Conflict scheme does not match naming scheme [{spec}]
\n\n
'
message
+=
'
naming scheme :
"
{nformat}
"
\n
'
message
+=
'
conflict scheme :
"
{cformat}
"
\n
'
raise
tty
.
error
(
message
.
format
(
spec
=
self
.
spec
,
nformat
=
self
.
naming_scheme
,
cformat
=
conflict_format
)
)
conflict_format
=
'
conflict
'
+
conflict_format
yield
conflict_format
.
format
(
**
naming_tokens
)
conflict_format
=
configuration
.
get
(
'
conflict
'
,
[])
f
=
string
.
Formatter
()
for
item
in
conflict_format
:
line
=
'
conflict
'
+
item
+
'
\n
'
if
len
([
x
for
x
in
f
.
parse
(
line
)])
>
1
:
# We do have placeholder to substitute
for
naming_dir
,
conflict_dir
in
zip
(
self
.
naming_scheme
.
split
(
'
/
'
),
item
.
split
(
'
/
'
)):
if
naming_dir
!=
conflict_dir
:
message
=
'
conflict scheme does not match naming scheme [{spec}]
\n\n
'
message
+=
'
naming scheme :
"
{nformat}
"
\n
'
message
+=
'
conflict scheme :
"
{cformat}
"
\n\n
'
message
+=
'
** You may want to check your `modules.yaml` configuration file **
\n
'
tty
.
error
(
message
.
format
(
spec
=
self
.
spec
,
nformat
=
self
.
naming_scheme
,
cformat
=
item
)
)
raise
SystemExit
(
'
Module generation aborted.
'
)
line
=
line
.
format
(
**
naming_tokens
)
yield
line
This diff is collapsed.
Click to expand it.
lib/spack/spack/test/modules.py
+
18
−
0
View file @
67a01ef2
...
...
@@ -62,6 +62,16 @@ def mock_open(filename, mode):
}
}
configuration_conflicts
=
{
'
enable
'
:
[
'
tcl
'
],
'
tcl
'
:
{
'
naming_scheme
'
:
'
{name}/{version}-{compiler.name}
'
,
'
all
'
:
{
'
conflict
'
:
[
'
{name}
'
,
'
intel/14.0.1
'
]
}
}
}
from
spack.test.mock_packages_test
import
MockPackagesTest
...
...
@@ -124,3 +134,11 @@ def test_blacklist(self):
content
=
self
.
get_modulefile_content
(
spec
)
self
.
assertEqual
(
len
([
x
for
x
in
content
if
'
is-loaded
'
in
x
]),
1
)
self
.
assertEqual
(
len
([
x
for
x
in
content
if
'
module load
'
in
x
]),
1
)
def
test_conflicts
(
self
):
spack
.
modules
.
CONFIGURATION
=
configuration_conflicts
spec
=
spack
.
spec
.
Spec
(
'
mpileaks=x86-linux
'
)
content
=
self
.
get_modulefile_content
(
spec
)
self
.
assertEqual
(
len
([
x
for
x
in
content
if
x
.
startswith
(
'
conflict
'
)]),
2
)
self
.
assertEqual
(
len
([
x
for
x
in
content
if
x
==
'
conflict mpileaks
'
]),
1
)
self
.
assertEqual
(
len
([
x
for
x
in
content
if
x
==
'
conflict intel/14.0.1
'
]),
1
)
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