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
Jérome Perrin
slapos.buildout
Commits
211b247d
Commit
211b247d
authored
Sep 10, 2015
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add '--dry-run' option.
parent
03dd01fd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
1 deletion
+31
-1
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+20
-1
src/zc/buildout/buildout.txt
src/zc/buildout/buildout.txt
+11
-0
No files found.
src/zc/buildout/buildout.py
View file @
211b247d
...
@@ -228,6 +228,7 @@ _buildout_default_options = _annotate_section({
...
@@ -228,6 +228,7 @@ _buildout_default_options = _annotate_section({
'log-level'
:
'INFO'
,
'log-level'
:
'INFO'
,
'newest'
:
'true'
,
'newest'
:
'true'
,
'offline'
:
'false'
,
'offline'
:
'false'
,
'dry-run'
:
'false'
,
'parts-directory'
:
'parts'
,
'parts-directory'
:
'parts'
,
'prefer-final'
:
'true'
,
'prefer-final'
:
'true'
,
'python'
:
'buildout'
,
'python'
:
'buildout'
,
...
@@ -404,6 +405,7 @@ class Buildout(DictMixin):
...
@@ -404,6 +405,7 @@ class Buildout(DictMixin):
self
.
newest
=
((
not
self
.
offline
)
and
self
.
newest
=
((
not
self
.
offline
)
and
bool_option
(
buildout_section
,
'newest'
)
bool_option
(
buildout_section
,
'newest'
)
)
)
self
.
dry_run
=
(
buildout_section
[
'dry-run'
]
==
'true'
)
##################################################################
##################################################################
## WARNING!!!
## WARNING!!!
...
@@ -743,6 +745,8 @@ class Buildout(DictMixin):
...
@@ -743,6 +745,8 @@ class Buildout(DictMixin):
if
part
in
installed_parts
:
# update
if
part
in
installed_parts
:
# update
__doing__
=
'Updating %s.'
,
part
__doing__
=
'Updating %s.'
,
part
self
.
_logger
.
info
(
*
__doing__
)
self
.
_logger
.
info
(
*
__doing__
)
if
self
.
dry_run
:
continue
old_options
=
self
.
installed_part_options
[
part
]
old_options
=
self
.
installed_part_options
[
part
]
old_installed_files
=
old_options
[
'__buildout_installed__'
]
old_installed_files
=
old_options
[
'__buildout_installed__'
]
...
@@ -784,6 +788,8 @@ class Buildout(DictMixin):
...
@@ -784,6 +788,8 @@ class Buildout(DictMixin):
else
:
# install
else
:
# install
__doing__
=
'Installing %s.'
,
part
__doing__
=
'Installing %s.'
,
part
self
.
_logger
.
info
(
*
__doing__
)
self
.
_logger
.
info
(
*
__doing__
)
if
self
.
dry_run
:
continue
try
:
try
:
installed_files
=
self
[
part
].
_call
(
recipe
.
install
)
installed_files
=
self
[
part
].
_call
(
recipe
.
install
)
except
:
except
:
...
@@ -820,6 +826,8 @@ class Buildout(DictMixin):
...
@@ -820,6 +826,8 @@ class Buildout(DictMixin):
# uninstall part
# uninstall part
__doing__
=
'Uninstalling %s.'
,
part
__doing__
=
'Uninstalling %s.'
,
part
self
.
_logger
.
info
(
*
__doing__
)
self
.
_logger
.
info
(
*
__doing__
)
if
self
.
dry_run
:
return
# run uuinstall recipe
# run uuinstall recipe
recipe
,
entry
=
_recipe
(
installed_part_options
[
part
])
recipe
,
entry
=
_recipe
(
installed_part_options
[
part
])
...
@@ -980,6 +988,8 @@ class Buildout(DictMixin):
...
@@ -980,6 +988,8 @@ class Buildout(DictMixin):
def
_save_installed_options
(
self
):
def
_save_installed_options
(
self
):
if
self
.
dry_run
:
return
installed_options
=
getattr
(
self
,
'installed_part_options'
,
None
)
installed_options
=
getattr
(
self
,
'installed_part_options'
,
None
)
installed
=
self
[
'buildout'
][
'installed'
]
installed
=
self
[
'buildout'
][
'installed'
]
if
not
installed_options
or
not
installed
:
if
not
installed_options
or
not
installed
:
...
@@ -1997,6 +2007,12 @@ Options:
...
@@ -1997,6 +2007,12 @@ Options:
will be started. This is especially useful for debuging recipe
will be started. This is especially useful for debuging recipe
problems.
problems.
--dry-run
Dry-run mode. With this setting, buildout will display what will
be uninstalled and what will be installed without doing anything
in reality.
Assignments are of the form: section:option=value and are used to
Assignments are of the form: section:option=value and are used to
provide configuration options that override those given in the
provide configuration options that override those given in the
configuration file. For example, to run the buildout in offline mode,
configuration file. For example, to run the buildout in offline mode,
...
@@ -2115,12 +2131,15 @@ def main(args=None):
...
@@ -2115,12 +2131,15 @@ def main(args=None):
_error
(
"No timeout value specified for option"
,
orig_op
)
_error
(
"No timeout value specified for option"
,
orig_op
)
except
ValueError
:
except
ValueError
:
_error
(
"Timeout value must be numeric"
,
orig_op
)
_error
(
"Timeout value must be numeric"
,
orig_op
)
elif
orig_op
==
'--dry-run'
:
options
.
append
((
'buildout'
,
'dry-run'
,
'true'
))
elif
op
:
elif
op
:
if
orig_op
==
'--help'
:
if
orig_op
==
'--help'
:
_help
()
_help
()
elif
orig_op
==
'--version'
:
elif
orig_op
==
'--version'
:
_version
()
_version
()
_error
(
"Invalid option"
,
'-'
+
op
[
0
]
)
_error
(
"Invalid option"
,
orig_op
)
elif
'='
in
args
[
0
]:
elif
'='
in
args
[
0
]:
option
,
value
=
args
.
pop
(
0
).
split
(
'='
,
1
)
option
,
value
=
args
.
pop
(
0
).
split
(
'='
,
1
)
option
=
option
.
split
(
':'
)
option
=
option
.
split
(
':'
)
...
...
src/zc/buildout/buildout.txt
View file @
211b247d
...
@@ -333,6 +333,10 @@ we'll see that the directory gets removed and recreated:
...
@@ -333,6 +333,10 @@ we'll see that the directory gets removed and recreated:
... path = mydata
... path = mydata
... """)
... """)
>>> print_(system(buildout+' --dry-run'), end='')
Develop: '/sample-buildout/recipes'
Uninstalling data-dir.
Installing data-dir.
>>> print_(system(buildout), end='')
>>> print_(system(buildout), end='')
Develop: '/sample-buildout/recipes'
Develop: '/sample-buildout/recipes'
Uninstalling data-dir.
Uninstalling data-dir.
...
@@ -353,6 +357,10 @@ If any of the files or directories created by a recipe are removed,
...
@@ -353,6 +357,10 @@ If any of the files or directories created by a recipe are removed,
the part will be reinstalled:
the part will be reinstalled:
>>> rmdir(sample_buildout, 'mydata')
>>> rmdir(sample_buildout, 'mydata')
>>> print_(system(buildout+' --dry-run'), end='')
Develop: '/sample-buildout/recipes'
Uninstalling data-dir.
Installing data-dir.
>>> print_(system(buildout), end='')
>>> print_(system(buildout), end='')
Develop: '/sample-buildout/recipes'
Develop: '/sample-buildout/recipes'
Uninstalling data-dir.
Uninstalling data-dir.
...
@@ -810,6 +818,8 @@ COMMAND_LINE_VALUE).
...
@@ -810,6 +818,8 @@ COMMAND_LINE_VALUE).
DEFAULT_VALUE
DEFAULT_VALUE
directory= /sample-buildout
directory= /sample-buildout
COMPUTED_VALUE
COMPUTED_VALUE
dry-run= false
DEFAULT_VALUE
eggs-directory= /sample-buildout/eggs
eggs-directory= /sample-buildout/eggs
DEFAULT_VALUE
DEFAULT_VALUE
executable= ...
executable= ...
...
@@ -2662,6 +2672,7 @@ database is shown.
...
@@ -2662,6 +2672,7 @@ database is shown.
bin-directory = /sample-buildout/bin
bin-directory = /sample-buildout/bin
develop-eggs-directory = /sample-buildout/develop-eggs
develop-eggs-directory = /sample-buildout/develop-eggs
directory = /sample-buildout
directory = /sample-buildout
dry-run = false
eggs-directory = /sample-buildout/eggs
eggs-directory = /sample-buildout/eggs
executable = python
executable = python
find-links =
find-links =
...
...
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