Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.buildout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Rafael Monnerat
slapos.buildout
Commits
e65a7906
Commit
e65a7906
authored
Jun 14, 2013
by
Tres Seaver
Browse files
Options
Browse Files
Download
Plain Diff
Merge w/ current master.
parents
87788f7b
33a44075
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
5 deletions
+38
-5
CHANGES.rst
CHANGES.rst
+3
-0
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+10
-3
src/zc/buildout/buildout.txt
src/zc/buildout/buildout.txt
+25
-2
No files found.
CHANGES.rst
View file @
e65a7906
...
...
@@ -4,6 +4,9 @@ Change History
2.2.0dev (unreleased)
=====================
- Handle both addition and subtraction of elements (+= and -=) on the same key
in the same section. Forward-ported from buildout 1.6.
- Suppress the useless ``Link to <URL> ***BLOCKED*** by --allow-hosts``
error message being emitted by distribute / setuptools.
...
...
src/zc/buildout/buildout.py
View file @
e65a7906
...
...
@@ -1636,19 +1636,26 @@ def _dists_sig(dists):
return
result
def
_update_section
(
s1
,
s2
):
# Base section 2 on section 1; section 1 is copied, with key-value pairs
# in section 2 overriding those in section 1. If there are += or -=
# operators in section 2, process these to add or substract items (delimited
# by newlines) from the preexisting values.
s2
=
s2
.
copy
()
# avoid mutating the second argument, which is unexpected
for
k
,
v
in
list
(
s2
.
items
()):
# Sort on key, then on the addition or substraction operator (+ comes first)
for
k
,
v
in
sorted
(
s2
.
items
(),
key
=
lambda
x
:
(
x
[
0
].
rstrip
(
' +'
),
x
[
0
][
-
1
])):
v2
,
note2
=
v
if
k
.
endswith
(
'+'
):
key
=
k
.
rstrip
(
' +'
)
v1
,
note1
=
s1
.
get
(
key
,
(
""
,
""
))
# Find v1 in s2 first; it may have been defined locally too.
v1
,
note1
=
s2
.
get
(
key
,
s1
.
get
(
key
,
(
""
,
""
)))
newnote
=
' [+] '
.
join
((
note1
,
note2
)).
strip
()
s2
[
key
]
=
"
\
n
"
.
join
((
v1
).
split
(
'
\
n
'
)
+
v2
.
split
(
'
\
n
'
)),
newnote
del
s2
[
k
]
elif
k
.
endswith
(
'-'
):
key
=
k
.
rstrip
(
' -'
)
v1
,
note1
=
s1
.
get
(
key
,
(
""
,
""
))
# Find v1 in s2 first; it may have been set by a += operation first
v1
,
note1
=
s2
.
get
(
key
,
s1
.
get
(
key
,
(
""
,
""
)))
newnote
=
' [-] '
.
join
((
note1
,
note2
)).
strip
()
s2
[
key
]
=
(
"
\
n
"
.
join
(
[
v
for
v
in
v1
.
split
(
'
\
n
'
)
...
...
src/zc/buildout/buildout.txt
View file @
e65a7906
...
...
@@ -1286,6 +1286,12 @@ This is illustrated below; first we define a base configuration.
... recipe =
... option = c1 c2
...
... [part4]
... recipe =
... option = d2
... d3
... d5
...
... """)
Extending this configuration, we can "adjust" the values set in the
...
...
@@ -1308,8 +1314,14 @@ base configuration file.
... [part3]
... option+=c3 c4 c5
...
... #
normal assignment
... #
combining both adding and removing
... [part4]
... option += d1
... d4
... option -= d5
...
... # normal assignment
... [part5]
... option = h1 h2
...
... """)
...
...
@@ -1379,7 +1391,7 @@ Verify option values.
... """)
>>> print_(system(os.path.join('bin', 'buildout')), end='')
['a1 a2/na3 a4/na5', 'b1 b2 b3 b4', 'c1 c2/nc3 c4 c5', 'h1 h2']
['a1 a2/na3 a4/na5', 'b1 b2 b3 b4', 'c1 c2/nc3 c4 c5', '
d2/nd3/nd1/nd4', '
h1 h2']
Develop: '/sample-buildout/demo'
Annotated sections output shows which files are responsible for which
...
...
@@ -1419,6 +1431,17 @@ operations.
/sample-buildout/base.cfg
<BLANKLINE>
[part4]
option= d2
d3
d1
d4
/sample-buildout/base.cfg
+= /sample-buildout/extension1.cfg
-= /sample-buildout/extension1.cfg
recipe=
/sample-buildout/base.cfg
<BLANKLINE>
[part5]
option= h1 h2
/sample-buildout/extension1.cfg
[versions]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment