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
6
Merge Requests
6
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
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):
...
@@ -675,159 +675,162 @@ class Buildout(UserDict.DictMixin):
installed_parts
=
installed_part_options
[
'buildout'
][
'parts'
]
installed_parts
=
installed_part_options
[
'buildout'
][
'parts'
]
installed_parts
=
installed_parts
and
installed_parts
.
split
()
or
[]
installed_parts
=
installed_parts
and
installed_parts
.
split
()
or
[]
if
install_args
:
try
:
i
nstall_parts
=
install_args
i
f
install_args
:
uninstall_missing
=
False
install_parts
=
install_args
else
:
uninstall_missing
=
False
install_parts
=
conf_parts
else
:
uninstall_missing
=
True
install_parts
=
conf_parts
uninstall_missing
=
True
# load and initialize recipes
[
self
[
part
][
'recipe'
]
for
part
in
install_parts
]
# load and initialize recipes
if
not
install_args
:
[
self
[
part
][
'recipe'
]
for
part
in
install_parts
]
i
nstall_parts
=
self
.
_parts
i
f
not
install_args
:
install_parts
=
self
.
_parts
if
self
.
_log_level
<
logging
.
DEBUG
:
sections
=
list
(
self
)
if
self
.
_log_level
<
logging
.
DEBUG
:
sections
.
sort
(
)
sections
=
list
(
self
)
print
sections
.
sort
()
print
'Configuration data:'
print
for
section
in
self
.
_data
:
print
'Configuration data:'
_save_options
(
section
,
self
[
section
],
sys
.
stdout
)
for
section
in
self
.
_data
:
print
_save_options
(
section
,
self
[
section
],
sys
.
stdout
)
print
# compute new part recipe signatures
self
.
_compute_part_signatures
(
install_parts
)
# compute new part recipe signatures
self
.
_compute_part_signatures
(
install_parts
)
# uninstall parts that are no-longer used or whose configs
# have changed
# uninstall parts that are no-longer used or whose configs
for
part
in
reversed
(
installed_parts
):
# have changed
if
part
in
install_parts
:
for
part
in
reversed
(
installed_parts
)
:
old_options
=
installed_part_options
[
part
].
copy
()
if
part
in
install_parts
:
installed_files
=
old_options
.
pop
(
'__buildout_installed__'
)
old_options
=
installed_part_options
[
part
].
copy
(
)
new_options
=
self
.
get
(
part
)
installed_files
=
old_options
.
pop
(
'__buildout_installed__'
)
if
old_options
==
new_options
:
new_options
=
self
.
get
(
part
)
# The options are the same, but are all of the
if
old_options
==
new_options
:
# installed files still there? If not, we should
# The options are the same, but are all of the
# reinstall.
# installed files still there? If not, we should
if
not
installed_files
:
# reinstall.
continue
if
not
installed_files
:
for
f
in
installed_files
.
split
(
'
\
n
'
):
continue
if
not
os
.
path
.
exists
(
self
.
_buildout_path
(
f
)
):
for
f
in
installed_files
.
split
(
'
\
n
'
):
break
if
not
os
.
path
.
exists
(
self
.
_buildout_path
(
f
)):
else
:
break
continue
else
:
continue
# output debugging info
if
self
.
_logger
.
getEffectiveLevel
()
<
logging
.
DEBUG
:
# output debugging info
for
k
in
old_options
:
if
self
.
_logger
.
getEffectiveLevel
()
<
logging
.
DEBUG
:
if
k
not
in
new
_options
:
for
k
in
old
_options
:
self
.
_logger
.
debug
(
"Part %s, dropped option %s."
,
if
k
not
in
new_options
:
part
,
k
)
self
.
_logger
.
debug
(
elif
old_options
[
k
]
!=
new_options
[
k
]:
"Part %s, dropped option %s."
,
part
,
k
)
self
.
_logger
.
debug
(
elif
old_options
[
k
]
!=
new_options
[
k
]:
"Part %s, option %s changed:
\
n
%r != %r"
,
self
.
_logger
.
debug
(
part
,
k
,
new_options
[
k
],
old_options
[
k
]
,
"Part %s, option %s changed:
\
n
%r != %r"
,
)
part
,
k
,
new_options
[
k
],
old_options
[
k
]
)
for
k
in
new_options
:
for
k
in
new_options
:
if
k
not
in
old_options
:
if
k
not
in
old_options
:
self
.
_logger
.
debug
(
"Part %s, new option %s."
,
self
.
_logger
.
debug
(
part
,
k
)
"Part %s, new option %s."
,
part
,
k
)
elif
not
uninstall_missing
:
elif
not
uninstall_missing
:
continue
continue
self
.
_uninstall_part
(
part
,
installed_part_options
)
self
.
_uninstall_part
(
part
,
installed_part_options
)
installed_parts
=
[
p
for
p
in
installed_parts
if
p
!=
part
]
installed_parts
=
[
p
for
p
in
installed_parts
if
p
!=
part
]
if
installed_exists
:
if
installed_exists
:
self
.
_update_installed
(
parts
=
' '
.
join
(
installed_parts
))
self
.
_update_installed
(
parts
=
' '
.
join
(
installed_parts
))
# Check for unused buildout options:
# Check for unused buildout options:
_check_for_unused_options_in_section
(
self
,
'buildout'
)
_check_for_unused_options_in_section
(
self
,
'buildout'
)
# install new parts
# install new parts
for
part
in
install_parts
:
for
part
in
install_parts
:
signature
=
self
[
part
].
pop
(
'__buildout_signature__'
)
signature
=
self
[
part
].
pop
(
'__buildout_signature__'
)
saved_options
=
self
[
part
].
copy
()
saved_options
=
self
[
part
].
copy
()
recipe
=
self
[
part
].
recipe
recipe
=
self
[
part
].
recipe
if
part
in
installed_parts
:
# update
if
part
in
installed_parts
:
# update
need_to_save_installed
=
False
need_to_save_installed
=
False
__doing__
=
'Updating %s.'
,
part
__doing__
=
'Updating %s.'
,
part
self
.
_logger
.
info
(
*
__doing__
)
self
.
_logger
.
info
(
*
__doing__
)
old_options
=
installed_part_options
[
part
]
old_options
=
installed_part_options
[
part
]
old_installed_files
=
old_options
[
'__buildout_installed__'
]
old_installed_files
=
old_options
[
'__buildout_installed__'
]
try
:
try
:
update
=
recipe
.
update
update
=
recipe
.
update
except
AttributeError
:
except
AttributeError
:
update
=
recipe
.
install
update
=
recipe
.
install
self
.
_logger
.
warning
(
self
.
_logger
.
warning
(
"The recipe for %s doesn't define an update "
"The recipe for %s doesn't define an update "
"method. Using its install method."
,
"method. Using its install method."
,
part
)
part
)
try
:
try
:
installed_files
=
self
[
part
].
_call
(
update
)
installed_files
=
self
[
part
].
_call
(
update
)
except
:
except
:
installed_parts
.
remove
(
part
)
installed_parts
.
remove
(
part
)
self
.
_uninstall
(
old_installed_files
)
self
.
_uninstall
(
old_installed_files
)
if
installed_exists
:
if
installed_exists
:
self
.
_update_installed
(
self
.
_update_installed
(
parts
=
' '
.
join
(
installed_parts
))
parts
=
' '
.
join
(
installed_parts
))
raise
raise
old_installed_files
=
old_installed_files
.
split
(
'
\
n
'
)
old_installed_files
=
old_installed_files
.
split
(
'
\
n
'
)
if
installed_files
is
None
:
if
installed_files
is
None
:
installed_files
=
old_installed_files
installed_files
=
old_installed_files
else
:
else
:
if
isinstance
(
installed_files
,
str
):
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
]
installed_files
=
[
installed_files
]
else
:
else
:
installed_files
=
list
(
installed_files
)
installed_files
=
list
(
installed_files
)
need_to_save_installed
=
[
installed_part_options
[
part
]
=
saved_options
p
for
p
in
installed_files
saved_options
[
'__buildout_installed__'
if
p
not
in
old_installed_files
]
]
=
'
\
n
'
.
join
(
installed_files
)
saved_options
[
'__buildout_signature__'
]
=
signature
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
installed_parts
=
[
p
for
p
in
installed_parts
if
p
!=
part
]
saved_options
[
'__buildout_installed__'
installed_parts
.
append
(
part
)
]
=
'
\
n
'
.
join
(
installed_files
)
_check_for_unused_options_in_section
(
self
,
part
)
saved_options
[
'__buildout_signature__'
]
=
signature
installed_parts
=
[
p
for
p
in
installed_parts
if
p
!=
part
]
if
need_to_save_installed
:
installed_parts
.
append
(
part
)
installed_part_options
[
'buildout'
][
'parts'
]
=
(
_check_for_unused_options_in_section
(
self
,
part
)
' '
.
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
:
finally
:
installed_part_options
[
'buildout'
][
'parts'
]
=
(
pass
' '
.
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
installed_develop_eggs
:
if
installed_develop_eggs
:
if
not
installed_exists
:
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