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
3959ca62
Commit
3959ca62
authored
9 years ago
by
Massimiliano Culpo
Browse files
Options
Downloads
Patches
Plain Diff
modules : added possibility to blacklist or whitelist module files
parent
0e2b1359
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/spack/spack/cmd/module.py
+0
-1
0 additions, 1 deletion
lib/spack/spack/cmd/module.py
lib/spack/spack/config.py
+11
-6
11 additions, 6 deletions
lib/spack/spack/config.py
lib/spack/spack/modules.py
+29
-3
29 additions, 3 deletions
lib/spack/spack/modules.py
with
40 additions
and
10 deletions
lib/spack/spack/cmd/module.py
+
0
−
1
View file @
3959ca62
...
...
@@ -89,7 +89,6 @@ def module_refresh():
shutil
.
rmtree
(
cls
.
path
,
ignore_errors
=
False
)
mkdirp
(
cls
.
path
)
for
spec
in
specs
:
tty
.
debug
(
"
Writing file for %s
"
%
spec
)
cls
(
spec
).
write
()
...
...
This diff is collapsed.
Click to expand it.
lib/spack/spack/config.py
+
11
−
6
View file @
3959ca62
...
...
@@ -292,12 +292,17 @@
'
module_type_configuration
'
:
{
'
type
'
:
'
object
'
,
'
default
'
:
{},
'
properties
'
:
{
'
all
'
:
{
'
$ref
'
:
'
#/definitions/module_file_configuration
'
}
},
'
patternProperties
'
:
{
r
'
\w[\w-]*
'
:
{
'
$ref
'
:
'
#/definitions/module_file_configuration
'
}
}
'
oneOf
'
:
[
{
'
properties
'
:
{
'
whitelist
'
:
{
'
$ref
'
:
'
#/definitions/array_of_strings
'
},
'
blacklist
'
:
{
'
$ref
'
:
'
#/definitions/array_of_strings
'
},
}
},
{
'
patternProperties
'
:
{
r
'
\w[\w-]*
'
:
{
'
$ref
'
:
'
#/definitions/module_file_configuration
'
}}
}
]
}
},
'
patternProperties
'
:
{
...
...
This diff is collapsed.
Click to expand it.
lib/spack/spack/modules.py
+
29
−
3
View file @
3959ca62
...
...
@@ -40,17 +40,15 @@
Each hook in hooks/ implements the logic for writing its specific type of module file.
"""
import
copy
import
os
import
os.path
import
re
import
shutil
import
textwrap
import
copy
import
llnl.util.tty
as
tty
import
spack
import
spack.config
from
llnl.util.filesystem
import
join_path
,
mkdirp
from
spack.build_environment
import
parent_class_modules
,
set_module_variables_for_package
from
spack.environment
import
*
...
...
@@ -225,6 +223,30 @@ def category(self):
# Not very descriptive fallback
return
'
spack installed package
'
@property
def
blacklisted
(
self
):
configuration
=
CONFIGURATION
.
get
(
self
.
name
,
{})
whitelist_matches
=
[
x
for
x
in
configuration
.
get
(
'
whitelist
'
,
[])
if
self
.
spec
.
satisfies
(
x
)]
blacklist_matches
=
[
x
for
x
in
configuration
.
get
(
'
blacklist
'
,
[])
if
self
.
spec
.
satisfies
(
x
)]
if
whitelist_matches
:
message
=
'
\t
%s is whitelisted [matches :
'
%
self
.
spec
.
cshort_spec
for
rule
in
whitelist_matches
:
message
+=
'
%s
'
%
rule
message
+=
'
]
'
tty
.
debug
(
message
)
if
blacklist_matches
:
message
=
'
\t
%s is blacklisted [matches :
'
%
self
.
spec
.
cshort_spec
for
rule
in
blacklist_matches
:
message
+=
'
%s
'
%
rule
message
+=
'
]
'
tty
.
debug
(
message
)
if
not
whitelist_matches
and
blacklist_matches
:
return
True
return
False
def
write
(
self
):
"""
Writes out a module file for this object.
...
...
@@ -233,6 +255,10 @@ def write(self):
- override the header property
- provide formats for autoload, prerequisites and environment changes
"""
if
self
.
blacklisted
:
return
tty
.
debug
(
"
\t
%s : writing module file
"
%
self
.
spec
.
cshort_spec
)
module_dir
=
os
.
path
.
dirname
(
self
.
file_name
)
if
not
os
.
path
.
exists
(
module_dir
):
mkdirp
(
module_dir
)
...
...
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