Commit 13e031e2 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

Fix a bug in $$ escape handling.

That caused uninstall and install everytime for a part containing $$ in its saved options.
Also it caused broken .installed.cfg in case of error, like the referenced section was not defined.
parent 8f6e9cec
......@@ -702,7 +702,7 @@ class Buildout(DictMixin):
if part in install_parts:
old_options = self.installed_part_options[part].copy()
installed_files = old_options.pop('__buildout_installed__')
new_options = self.get(part)
new_options = self.get(part).copy()
if not self.check_signature:
old_signature = old_options.get(
'__buildout_signature__', None)
......@@ -957,7 +957,7 @@ class Buildout(DictMixin):
for k, v in _spacey_defaults:
value = value.replace(k, v)
options[option] = value
result[section] = self.Options(self, section, options)
result[section] = self.Options(self, section, options).copy()
return result
else:
......
......@@ -2135,6 +2135,7 @@ changes, the service shouldn't be changed.
>>> print_(system(buildout), end='')
Develop: '/sample-buildout/recipes'
Updating service.
Unused options for service: 'script'.
Now we change the service part to trigger uninstallation and
re-installation.
......
......@@ -1007,6 +1007,7 @@ Uninstall recipes need to be called when a part is removed too:
uninstalling
Installing demo.
installing
Unused options for demo: 'x'.
>>> write('buildout.cfg', '''
......
  • Issues:

    • Why the change _read_installed_part_options ?
    • The new "Unused options" warning in src/zc/buildout/tests.py is a nice side-effect, but not the other: in fact, such warning is irrelevant when updating a part.
    • check-signature option does not work anymore.

    So I would only keep the change in src/zc/buildout/tests.py and do:

    --- a/src/zc/buildout/buildout.py
    +++ b/src/zc/buildout/buildout.py
    @@ -735,6 +735,7 @@ def install(self, install_args):
                                     new_options['__buildout_signature__'] = old_signature
                                 else:
                                     del(new_options['__buildout_signature__'])
    +                    new_options = new_options.copy()
                         if old_options == new_options:
                             # The options are the same, but are all of the
                             # installed files still there?  If not, we should
    @@ -821,9 +822,9 @@ def install(self, install_args):
                     saved_options['__buildout_installed__'] = installed_files
                     saved_options['__buildout_signature__'] = signature
                     installed_part_options[part] = saved_options
    -                part in installed_parts or installed_parts.append(part)
    -
    -                _check_for_unused_options_in_section(self, part)
    +                if part not in installed_parts:
    +                    installed_parts.append(part)
    +                    _check_for_unused_options_in_section(self, part)
     
             finally:
                 installed_path = self['buildout']['installed']
  • Julien Muchembled @jm

    mentioned in merge request !7 (merged)

    ·

    mentioned in merge request !7 (merged)

    Toggle commit list
  • Fixed in branch 1.x as described above

Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment