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
c1e6b521
Commit
c1e6b521
authored
9 years ago
by
Benedikt Hegner
Browse files
Options
Downloads
Patches
Plain Diff
first round of coding rules
parent
05b6c3f8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/spack/spack/config.py
+16
-13
16 additions, 13 deletions
lib/spack/spack/config.py
with
16 additions
and
13 deletions
lib/spack/spack/config.py
+
16
−
13
View file @
c1e6b521
...
...
@@ -129,7 +129,6 @@
import
llnl.util.tty
as
tty
from
llnl.util.filesystem
import
mkdirp
import
copy
import
spack
from
spack.error
import
SpackError
...
...
@@ -306,13 +305,14 @@ def set_pp_defaults(validator, properties, instance, schema):
yield
err
return
validators
.
extend
(
validator_class
,
{
"
properties
"
:
set_defaults
,
"
patternProperties
"
:
set_pp_defaults
"
properties
"
:
set_defaults
,
"
patternProperties
"
:
set_pp_defaults
})
DefaultSettingValidator
=
extend_with_default
(
Draft4Validator
)
def
validate_section
(
data
,
schema
):
"""
Validate data read in from a Spack YAML file.
...
...
@@ -347,16 +347,14 @@ def get_section_filename(self, section):
validate_section_name
(
section
)
return
os
.
path
.
join
(
self
.
path
,
"
%s.yaml
"
%
section
)
def
get_section
(
self
,
section
):
if
not
section
in
self
.
sections
:
if
section
not
in
self
.
sections
:
path
=
self
.
get_section_filename
(
section
)
schema
=
section_schemas
[
section
]
data
=
_read_config_file
(
path
,
schema
)
self
.
sections
[
section
]
=
data
return
self
.
sections
[
section
]
def
write_section
(
self
,
section
):
filename
=
self
.
get_section_filename
(
section
)
data
=
self
.
get_section
(
section
)
...
...
@@ -370,7 +368,6 @@ def write_section(self, section):
except
(
yaml
.
YAMLError
,
IOError
)
as
e
:
raise
ConfigFileError
(
"
Error writing to config file:
'
%s
'"
%
str
(
e
))
def
clear
(
self
):
"""
Empty cached config information.
"""
self
.
sections
=
{}
...
...
@@ -476,7 +473,7 @@ def they_are(t):
# Source dict is merged into dest.
elif
they_are
(
dict
):
for
sk
,
sv
in
source
.
iteritems
():
if
not
sk
in
dest
:
if
sk
not
in
dest
:
dest
[
sk
]
=
copy
.
copy
(
sv
)
else
:
dest
[
sk
]
=
_merge_yaml
(
dest
[
sk
],
source
[
sk
])
...
...
@@ -590,16 +587,20 @@ def spec_externals(spec):
def
is_spec_buildable
(
spec
):
"""
Return true if the spec pkgspec is configured as buildable
"""
allpkgs
=
get_config
(
'
packages
'
)
name
=
spec
.
name
if
not
spec
.
name
in
allpkgs
:
if
spec
.
name
not
in
allpkgs
:
return
True
if
not
'
buildable
'
in
allpkgs
[
spec
.
name
]:
if
'
buildable
'
not
in
allpkgs
[
spec
.
name
]:
return
True
return
allpkgs
[
spec
.
name
][
'
buildable
'
]
class
ConfigError
(
SpackError
):
pass
class
ConfigFileError
(
ConfigError
):
pass
class
ConfigError
(
SpackError
):
pass
class
ConfigFileError
(
ConfigError
):
pass
def
get_path
(
path
,
data
):
if
path
:
...
...
@@ -607,6 +608,7 @@ def get_path(path, data):
else
:
return
data
class
ConfigFormatError
(
ConfigError
):
"""
Raised when a configuration format does not match its schema.
"""
def
__init__
(
self
,
validation_error
,
data
):
...
...
@@ -641,5 +643,6 @@ def __init__(self, validation_error, data):
message
=
'
%s: %s
'
%
(
location
,
validation_error
.
message
)
super
(
ConfigError
,
self
).
__init__
(
message
)
class
ConfigSanityError
(
ConfigFormatError
):
"""
Same as ConfigFormatError, raised when config is written by Spack.
"""
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