Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pyopencl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Andreas Klöckner
pyopencl
Commits
964a532a
Commit
964a532a
authored
13 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Late option expansion in aksetup.
parent
0f4f1c56
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aksetup_helper.py
+14
-11
14 additions, 11 deletions
aksetup_helper.py
with
14 additions
and
11 deletions
aksetup_helper.py
+
14
−
11
View file @
964a532a
...
...
@@ -165,7 +165,7 @@ def get_config(schema=None, warn_about_no_config=True):
count_down_delay
(
delay
=
10
)
return
schema
.
read_config
()
return
expand_options
(
schema
.
read_config
()
)
...
...
@@ -241,15 +241,23 @@ def expand_value(v, options):
if
isinstance
(
v
,
str
):
return
expand_str
(
v
,
options
)
elif
isinstance
(
v
,
list
):
return
[
expand_value
(
i
,
options
)
for
i
in
v
]
result
=
[]
for
i
in
v
:
try
:
exp_i
=
expand_value
(
i
,
options
)
except
:
pass
else
:
result
.
append
(
exp_i
)
return
result
else
:
return
v
def
expand_options
(
options
):
for
k
in
options
.
keys
():
options
[
k
]
=
expand_value
(
options
[
k
],
options
)
return
options
return
dict
(
(
k
,
expand_value
(
v
,
options
))
for
k
,
v
in
options
.
iteritems
())
...
...
@@ -280,8 +288,7 @@ class ConfigSchema:
self
.
conf_dir
=
conf_dir
def
get_default_config
(
self
):
return
dict
((
opt
.
name
,
opt
.
default
)
for
opt
in
self
.
options
)
return
dict
((
opt
.
name
,
opt
.
default
)
for
opt
in
self
.
options
)
def
read_config_from_pyfile
(
self
,
filename
):
result
=
{}
...
...
@@ -379,8 +386,6 @@ class ConfigSchema:
raise
KeyError
(
"
invalid config key in %s: %s
"
%
(
cfile
,
key
))
expand_options
(
result
)
return
result
def
add_to_configparser
(
self
,
parser
,
def_config
=
None
):
...
...
@@ -395,11 +400,9 @@ class ConfigSchema:
result
=
{}
for
opt
in
self
.
options
:
result
[
opt
.
name
]
=
opt
.
take_from_configparser
(
options
)
expand_options
(
result
)
return
result
def
write_config
(
self
,
config
):
import
os
outf
=
open
(
self
.
get_conf_file
(),
"
w
"
)
for
opt
in
self
.
options
:
value
=
config
[
opt
.
name
]
...
...
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