Commit ab3f7aca authored by jim's avatar jim

Bug fixed:

  Option incrementing and decrementing didn't work for options
  specified on the command line.


git-svn-id: http://svn.zope.org/repos/main/zc.buildout/trunk@103351 62d5b8a3-27da-0310-9561-8e5933582275
parent 1012259f
...@@ -14,6 +14,9 @@ Bugs fixed: ...@@ -14,6 +14,9 @@ Bugs fixed:
didn't work in the buildout section. didn't work in the buildout section.
https://bugs.launchpad.net/zc.buildout/+bug/420463 https://bugs.launchpad.net/zc.buildout/+bug/420463
- Option incrementing and decrementing didn't work for options
specified on the command line.
1.4.0 (2009-08-26) 1.4.0 (2009-08-26)
================== ==================
......
...@@ -14,31 +14,30 @@ ...@@ -14,31 +14,30 @@
"""Buildout main script """Buildout main script
""" """
from rmtree import rmtree
try:
from hashlib import md5
except ImportError:
# Python 2.4 and older
from md5 import md5
import ConfigParser
import copy
import distutils.errors import distutils.errors
import glob
import itertools
import logging import logging
import os import os
import pkg_resources
import re import re
import shutil import shutil
import sys import sys
import tempfile import tempfile
import ConfigParser
import UserDict import UserDict
import glob
import copy
import pkg_resources
import zc.buildout import zc.buildout
import zc.buildout.download import zc.buildout.download
import zc.buildout.easy_install import zc.buildout.easy_install
from rmtree import rmtree
try:
from hashlib import md5
except ImportError:
# Python 2.4 and older
from md5 import md5
realpath = zc.buildout.easy_install.realpath realpath = zc.buildout.easy_install.realpath
...@@ -160,9 +159,14 @@ class Buildout(UserDict.DictMixin): ...@@ -160,9 +159,14 @@ class Buildout(UserDict.DictMixin):
else: else:
base = None base = None
override = dict((option, (value, 'COMMAND_LINE_VALUE'))
for section, option, value in cloptions cloptions = dict(
if section == 'buildout') (section, dict((option, (value, 'COMMAND_LINE_VALUE'))
for (_, option, value) in v))
for (section, v) in itertools.groupby(sorted(cloptions),
lambda v: v[0])
)
override = cloptions.get('buildout', {}).copy()
# load user defaults, which override defaults # load user defaults, which override defaults
if user_defaults: if user_defaults:
...@@ -178,11 +182,7 @@ class Buildout(UserDict.DictMixin): ...@@ -178,11 +182,7 @@ class Buildout(UserDict.DictMixin):
data['buildout'].copy(), override)) data['buildout'].copy(), override))
# apply command-line options # apply command-line options
for (section, option, value) in cloptions: _update(data, cloptions)
options = data.get(section)
if options is None:
options = data[section] = {}
options[option] = value, "COMMAND_LINE_VALUE"
self._annotated = copy.deepcopy(data) self._annotated = copy.deepcopy(data)
self._raw = _unannotate(data) self._raw = _unannotate(data)
......
...@@ -11,11 +11,6 @@ ...@@ -11,11 +11,6 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
"""XXX short summary goes here.
$Id$
"""
from zope.testing import doctest from zope.testing import doctest
from zope.testing import renormalizing from zope.testing import renormalizing
import os import os
...@@ -2591,7 +2586,31 @@ def increment_buildout_options(): ...@@ -2591,7 +2586,31 @@ def increment_buildout_options():
recipe='zc.buildout:debug' recipe='zc.buildout:debug'
""" """
def increment_on_command_line():
r"""
>>> write('buildout.cfg', '''
... [buildout]
... parts = p1
... x = 1
... y = a
... b
...
... [p1]
... recipe = zc.buildout:debug
... foo = ${buildout:x} ${buildout:y}
...
... [p2]
... <= p1
... ''')
>>> print system(buildout+' buildout:parts+=p2 p1:foo+=bar'),
Installing p1.
foo='1 a\nb\nbar'
recipe='zc.buildout:debug'
Installing p2.
foo='1 a\nb\nbar'
recipe='zc.buildout:debug'
"""
###################################################################### ######################################################################
......
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