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
Xavier Thompson
slapos.buildout
Commits
7d78585c
Commit
7d78585c
authored
Apr 15, 2020
by
Julien Muchembled
Committed by
Xavier Thompson
Dec 06, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[feat] Add new Options.barrier()
To set a default requirement for not-yet processed parts
parent
6c18ba59
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+18
-0
No files found.
src/zc/buildout/buildout.py
View file @
7d78585c
...
@@ -532,6 +532,7 @@ class Buildout(DictMixin):
...
@@ -532,6 +532,7 @@ class Buildout(DictMixin):
self
.
_parts
=
[]
self
.
_parts
=
[]
self
.
_initializing
=
[]
self
.
_initializing
=
[]
self
.
_signature_cache
=
{}
self
.
_signature_cache
=
{}
self
.
_default_requirement
=
None
# provide some defaults before options are parsed
# provide some defaults before options are parsed
# because while parsing options those attributes might be
# because while parsing options those attributes might be
...
@@ -1629,6 +1630,8 @@ class Options(DictMixin):
...
@@ -1629,6 +1630,8 @@ class Options(DictMixin):
if
'<'
in
self
.
_raw
:
if
'<'
in
self
.
_raw
:
self
.
_raw
=
self
.
_do_extend_raw
(
name
,
self
.
_raw
,
[])
self
.
_raw
=
self
.
_do_extend_raw
(
name
,
self
.
_raw
,
[])
default
=
self
.
buildout
.
_default_requirement
# force substitutions
# force substitutions
for
k
,
v
in
sorted
(
self
.
_raw
.
items
()):
for
k
,
v
in
sorted
(
self
.
_raw
.
items
()):
if
'${'
in
v
:
if
'${'
in
v
:
...
@@ -1642,6 +1645,8 @@ class Options(DictMixin):
...
@@ -1642,6 +1645,8 @@ class Options(DictMixin):
self
.
buildout
[
dname
]
self
.
buildout
[
dname
]
if
self
.
get
(
'recipe'
):
if
self
.
get
(
'recipe'
):
if
default
:
self
.
depends
.
add
(
default
)
self
.
recipe
=
self
.
buildout
.
initialize
(
self
,
*
_recipe
(
self
.
_data
))
self
.
recipe
=
self
.
buildout
.
initialize
(
self
,
*
_recipe
(
self
.
_data
))
self
.
buildout
.
_parts
.
append
(
name
)
self
.
buildout
.
_parts
.
append
(
name
)
...
@@ -1875,6 +1880,19 @@ class Options(DictMixin):
...
@@ -1875,6 +1880,19 @@ class Options(DictMixin):
self
.
name
)
self
.
name
)
return
self
.
_created
return
self
.
_created
def
barrier
(
self
):
"""Set self as a default requirement for not-yet processed parts
This method must be called if this part may alter the processing
of other parts in any way, like modifying environment variables.
In other words, it sets an implicit dependency for these parts.
"""
buildout
=
self
.
buildout
if
not
buildout
.
_initializing
:
raise
zc
.
buildout
.
UserError
(
"Options.barrier() shall only be used during initialization"
)
buildout
.
_default_requirement
=
self
.
name
def
__repr__
(
self
):
def
__repr__
(
self
):
return
repr
(
dict
(
self
))
return
repr
(
dict
(
self
))
...
...
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