Commit 37adf716 authored by Jim Fulton's avatar Jim Fulton

- Fixed: Buildout merged single-version requirements with

  version-range requirements in a way that caused it to think there
  wasn't a single-version requirement.  IOW, buildout throught that
  versions were being picked when they weren't.
parent 00d50335
Change History
**************
- Fixed: Buildout merged single-version requirements with
version-range requirements in a way that caused it to think there
wasn't a single-version requirement. IOW, buildout throught that
versions were being picked when they weren't.
2.3.0 (2014-12-14)
==================
......
......@@ -1444,7 +1444,13 @@ def _constrained_requirement(constraint, requirement):
constraint = constraint[2:]
if constraint not in requirement:
bad_constraint(constraint, requirement)
constraint = '==' + constraint
# Sigh, copied from Requirement.__str__
extras = ','.join(requirement.extras)
if extras:
extras = '[%s]' % extras
return pkg_resources.Requirement.parse(
"%s%s==%s" % (requirement.project_name, extras, constraint))
if requirement.specs:
return pkg_resources.Requirement.parse(
......
......@@ -163,6 +163,34 @@ We won't get output for the spam distribution, which we didn't pick,
but we will get output for setuptools, which we didn't specify
versions for.
.. Edge case: version applied to range requirement:
>>> write('buildout.cfg',
... '''
... [buildout]
... parts = foo
... find-links = %s
...
... [versions]
... spam = 1
... eggs = 2.2
...
... [foo]
... recipe = spam >0
... ''' % join('recipe', 'dist'))
>>> print_(system(buildout+' -v'), end='')
Installing 'zc.buildout', 'setuptools'.
We have a develop egg: zc.buildout 1.0.0.
We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = 0.6
Installing 'spam >0'.
We have the distribution that satisfies 'spam==1'.
Uninstalling foo.
Installing foo.
recipe v1
You can request buildout to generate an error if it picks any
versions:
......@@ -204,7 +232,8 @@ We can name a version something else, if we wish, using the versions option:
... recipe = spam
... ''' % join('recipe', 'dist'))
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Updating foo.
Uninstalling foo.
Installing foo.
recipe v1
We can also disable checking versions:
......
......@@ -2709,7 +2709,7 @@ def test_constrained_requirement():
>>> examples = [
... # original, constraint, transformed
... ('x', '1', 'x==1'),
... ('x>1', '2', 'x>1,==2'),
... ('x>1', '2', 'x==2'),
... ('x>3', '2', IncompatibleConstraintError),
... ('x>1', '>2', 'x>1,>2'),
... ]
......
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