Commit d85a19b9 authored by jim's avatar jim

Fixed bug in handling saved option values with a single leading or

trailing newline.


git-svn-id: http://svn.zope.org/repos/main/zc.buildout/trunk@69068 62d5b8a3-27da-0310-9561-8e5933582275
parent 1ed741de
......@@ -242,8 +242,22 @@ class Buildout(dict):
if part in install_parts:
old_options = installed_part_options[part].copy()
old_options.pop('__buildout_installed__')
if old_options == self.get(part):
new_options = self.get(part)
if old_options == new_options:
continue
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, %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
......@@ -462,8 +476,9 @@ class Buildout(dict):
_save_options(section, self[section], sys.stdout)
print
_spacey_nl = re.compile('^[ \t\r\f\v]+'
'|''[ \t\r\f\v]*\n[ \t\r\f\v\n]*'
_spacey_nl = re.compile('[ \t\r\f\v]*\n[ \t\r\f\v\n]*'
'|'
'^[ \t\r\f\v]+'
'|'
'[ \t\r\f\v]+$'
)
......@@ -497,6 +512,10 @@ def _save_options(section, options, f):
for option, value in items:
value = value.replace('%', '%%')
value = _spacey_nl.sub(_quote_spacey_nl, value)
if value.startswith('\n\t'):
value = '%(__buildout_space_n__)s' + value[2:]
if value.endswith('\n\t'):
value = value[:-2] + '%(__buildout_space_n__)s'
print >>f, option, '=', value
......
......@@ -80,6 +80,15 @@ def test_comparing_saved_options_with_funny_characters():
...
... </zodb>
... \"\"\"
... options['debug1'] = \"\"\"
... <zodb>
...
... <filestorage>
... path foo
... </filestorage>
...
... </zodb>
... \"\"\"
... options['debug2'] = ' x '
... options['debug3'] = '42'
... options['format'] = '%3d'
......
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