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
Boxiang Sun
slapos.buildout
Commits
bf58aa81
Commit
bf58aa81
authored
Jul 03, 2015
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Indent big section of code before actual changes
parent
837c540d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
143 additions
and
140 deletions
+143
-140
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+143
-140
No files found.
src/zc/buildout/buildout.py
View file @
bf58aa81
...
...
@@ -675,159 +675,162 @@ class Buildout(UserDict.DictMixin):
installed_parts
=
installed_part_options
[
'buildout'
][
'parts'
]
installed_parts
=
installed_parts
and
installed_parts
.
split
()
or
[]
if
install_args
:
i
nstall_parts
=
install_args
uninstall_missing
=
False
else
:
install_parts
=
conf_parts
uninstall_missing
=
True
# load and initialize recipes
[
self
[
part
][
'recipe'
]
for
part
in
install_parts
]
if
not
install_args
:
i
nstall_parts
=
self
.
_parts
if
self
.
_log_level
<
logging
.
DEBUG
:
sections
=
list
(
self
)
sections
.
sort
(
)
print
print
'Configuration data:'
for
section
in
self
.
_data
:
_save_options
(
section
,
self
[
section
],
sys
.
stdout
)
print
# compute new part recipe signatures
self
.
_compute_part_signatures
(
install_parts
)
# uninstall parts that are no-longer used or whose configs
# have changed
for
part
in
reversed
(
installed_parts
):
if
part
in
install_parts
:
old_options
=
installed_part_options
[
part
].
copy
()
installed_files
=
old_options
.
pop
(
'__buildout_installed__'
)
new_options
=
self
.
get
(
part
)
if
old_options
==
new_options
:
# The options are the same, but are all of the
# installed files still there? If not, we should
# reinstall.
if
not
installed_files
:
continue
for
f
in
installed_files
.
split
(
'
\
n
'
):
if
not
os
.
path
.
exists
(
self
.
_buildout_path
(
f
)
):
break
else
:
continue
# output debugging info
if
self
.
_logger
.
getEffectiveLevel
()
<
logging
.
DEBUG
:
for
k
in
old_options
:
if
k
not
in
new
_options
:
self
.
_logger
.
debug
(
"Part %s, dropped option %s."
,
part
,
k
)
elif
old_options
[
k
]
!=
new_options
[
k
]:
self
.
_logger
.
debug
(
"Part %s, option %s changed:
\
n
%r != %r"
,
part
,
k
,
new_options
[
k
],
old_options
[
k
]
,
)
for
k
in
new_options
:
if
k
not
in
old_options
:
self
.
_logger
.
debug
(
"Part %s, new option %s."
,
part
,
k
)
elif
not
uninstall_missing
:
continue
try
:
i
f
install_args
:
install_parts
=
install_args
uninstall_missing
=
False
else
:
install_parts
=
conf_parts
uninstall_missing
=
True
# load and initialize recipes
[
self
[
part
][
'recipe'
]
for
part
in
install_parts
]
i
f
not
install_args
:
install_parts
=
self
.
_parts
if
self
.
_log_level
<
logging
.
DEBUG
:
sections
=
list
(
self
)
sections
.
sort
()
print
print
'Configuration data:'
for
section
in
self
.
_data
:
_save_options
(
section
,
self
[
section
],
sys
.
stdout
)
print
# compute new part recipe signatures
self
.
_compute_part_signatures
(
install_parts
)
# uninstall parts that are no-longer used or whose configs
# have changed
for
part
in
reversed
(
installed_parts
)
:
if
part
in
install_parts
:
old_options
=
installed_part_options
[
part
].
copy
(
)
installed_files
=
old_options
.
pop
(
'__buildout_installed__'
)
new_options
=
self
.
get
(
part
)
if
old_options
==
new_options
:
# The options are the same, but are all of the
# installed files still there? If not, we should
# reinstall.
if
not
installed_files
:
continue
for
f
in
installed_files
.
split
(
'
\
n
'
):
if
not
os
.
path
.
exists
(
self
.
_buildout_path
(
f
)):
break
else
:
continue
# output debugging info
if
self
.
_logger
.
getEffectiveLevel
()
<
logging
.
DEBUG
:
for
k
in
old
_options
:
if
k
not
in
new_options
:
self
.
_logger
.
debug
(
"Part %s, dropped option %s."
,
part
,
k
)
elif
old_options
[
k
]
!=
new_options
[
k
]:
self
.
_logger
.
debug
(
"Part %s, option %s changed:
\
n
%r != %r"
,
part
,
k
,
new_options
[
k
],
old_options
[
k
]
)
for
k
in
new_options
:
if
k
not
in
old_options
:
self
.
_logger
.
debug
(
"Part %s, new option %s."
,
part
,
k
)
elif
not
uninstall_missing
:
continue
self
.
_uninstall_part
(
part
,
installed_part_options
)
installed_parts
=
[
p
for
p
in
installed_parts
if
p
!=
part
]
self
.
_uninstall_part
(
part
,
installed_part_options
)
installed_parts
=
[
p
for
p
in
installed_parts
if
p
!=
part
]
if
installed_exists
:
self
.
_update_installed
(
parts
=
' '
.
join
(
installed_parts
))
if
installed_exists
:
self
.
_update_installed
(
parts
=
' '
.
join
(
installed_parts
))
# Check for unused buildout options:
_check_for_unused_options_in_section
(
self
,
'buildout'
)
# Check for unused buildout options:
_check_for_unused_options_in_section
(
self
,
'buildout'
)
# install new parts
for
part
in
install_parts
:
signature
=
self
[
part
].
pop
(
'__buildout_signature__'
)
saved_options
=
self
[
part
].
copy
()
recipe
=
self
[
part
].
recipe
if
part
in
installed_parts
:
# update
need_to_save_installed
=
False
__doing__
=
'Updating %s.'
,
part
self
.
_logger
.
info
(
*
__doing__
)
old_options
=
installed_part_options
[
part
]
old_installed_files
=
old_options
[
'__buildout_installed__'
]
# install new parts
for
part
in
install_parts
:
signature
=
self
[
part
].
pop
(
'__buildout_signature__'
)
saved_options
=
self
[
part
].
copy
()
recipe
=
self
[
part
].
recipe
if
part
in
installed_parts
:
# update
need_to_save_installed
=
False
__doing__
=
'Updating %s.'
,
part
self
.
_logger
.
info
(
*
__doing__
)
old_options
=
installed_part_options
[
part
]
old_installed_files
=
old_options
[
'__buildout_installed__'
]
try
:
update
=
recipe
.
update
except
AttributeError
:
update
=
recipe
.
install
self
.
_logger
.
warning
(
"The recipe for %s doesn't define an update "
"method. Using its install method."
,
part
)
try
:
update
=
recipe
.
update
except
AttributeError
:
update
=
recipe
.
install
self
.
_logger
.
warning
(
"The recipe for %s doesn't define an update "
"method. Using its install method."
,
part
)
try
:
installed_files
=
self
[
part
].
_call
(
update
)
except
:
installed_parts
.
remove
(
part
)
self
.
_uninstall
(
old_installed_files
)
if
installed_exists
:
self
.
_update_installed
(
parts
=
' '
.
join
(
installed_parts
))
raise
old_installed_files
=
old_installed_files
.
split
(
'
\
n
'
)
if
installed_files
is
None
:
installed_files
=
old_installed_files
else
:
if
isinstance
(
installed_files
,
str
):
try
:
installed_files
=
self
[
part
].
_call
(
update
)
except
:
installed_parts
.
remove
(
part
)
self
.
_uninstall
(
old_installed_files
)
if
installed_exists
:
self
.
_update_installed
(
parts
=
' '
.
join
(
installed_parts
))
raise
old_installed_files
=
old_installed_files
.
split
(
'
\
n
'
)
if
installed_files
is
None
:
installed_files
=
old_installed_files
else
:
if
isinstance
(
installed_files
,
str
):
installed_files
=
[
installed_files
]
else
:
installed_files
=
list
(
installed_files
)
need_to_save_installed
=
[
p
for
p
in
installed_files
if
p
not
in
old_installed_files
]
if
need_to_save_installed
:
installed_files
=
(
old_installed_files
+
need_to_save_installed
)
else
:
# install
need_to_save_installed
=
True
__doing__
=
'Installing %s.'
,
part
self
.
_logger
.
info
(
*
__doing__
)
installed_files
=
self
[
part
].
_call
(
recipe
.
install
)
if
installed_files
is
None
:
self
.
_logger
.
warning
(
"The %s install returned None. A path or "
"iterable of paths should be returned."
,
part
)
installed_files
=
()
elif
isinstance
(
installed_files
,
str
):
installed_files
=
[
installed_files
]
else
:
installed_files
=
list
(
installed_files
)
need_to_save_installed
=
[
p
for
p
in
installed_files
if
p
not
in
old_installed_files
]
if
need_to_save_installed
:
installed_files
=
(
old_installed_files
+
need_to_save_installed
)
else
:
# install
need_to_save_installed
=
True
__doing__
=
'Installing %s.'
,
part
self
.
_logger
.
info
(
*
__doing__
)
installed_files
=
self
[
part
].
_call
(
recipe
.
install
)
if
installed_files
is
None
:
self
.
_logger
.
warning
(
"The %s install returned None. A path or "
"iterable of paths should be returned."
,
part
)
installed_files
=
()
elif
isinstance
(
installed_files
,
str
):
installed_files
=
[
installed_files
]
else
:
installed_files
=
list
(
installed_files
)
installed_part_options
[
part
]
=
saved_options
saved_options
[
'__buildout_installed__'
]
=
'
\
n
'
.
join
(
installed_files
)
saved_options
[
'__buildout_signature__'
]
=
signature
installed_part_options
[
part
]
=
saved_options
saved_options
[
'__buildout_installed__'
]
=
'
\
n
'
.
join
(
installed_files
)
saved_options
[
'__buildout_signature__'
]
=
signature
installed_parts
=
[
p
for
p
in
installed_parts
if
p
!=
part
]
installed_parts
.
append
(
part
)
_check_for_unused_options_in_section
(
self
,
part
)
installed_parts
=
[
p
for
p
in
installed_parts
if
p
!=
part
]
installed_parts
.
append
(
part
)
_check_for_unused_options_in_section
(
self
,
part
)
if
need_to_save_installed
:
installed_part_options
[
'buildout'
][
'parts'
]
=
(
' '
.
join
(
installed_parts
))
self
.
_save_installed_options
(
installed_part_options
)
installed_exists
=
True
else
:
assert
installed_exists
# nothing to tell the user here
self
.
_update_installed
(
parts
=
' '
.
join
(
installed_parts
))
if
need_to_save_installed
:
installed_part_options
[
'buildout'
][
'parts'
]
=
(
' '
.
join
(
installed_parts
))
self
.
_save_installed_options
(
installed_part_options
)
installed_exists
=
True
else
:
assert
installed_exists
# nothing to tell the user here
self
.
_update_installed
(
parts
=
' '
.
join
(
installed_parts
))
finally
:
pass
if
installed_develop_eggs
:
if
not
installed_exists
:
...
...
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