Commit c33f38e2 authored by Jim Fulton's avatar Jim Fulton

Fixes #326

Fixed a bug introduced in 2.6.0:
zc.buildout and its dependeoncies were reported as picked even when
their versions were fixed in a ``versions`` section.  Worse, when the
``update-versions-file`` option was used, the ``versions`` section was
updated needlessly on every run.
parent 7a1741fc
...@@ -4,7 +4,11 @@ Change History ...@@ -4,7 +4,11 @@ Change History
2.7.1 (unreleased) 2.7.1 (unreleased)
================== ==================
- Nothing changed yet. - Fixed a bug introduced in 2.6.0:
zc.buildout and its dependeoncies were reported as picked even when
their versions were fixed in a ``versions`` section. Worse, when the
``update-versions-file`` option was used, the ``versions`` section was
updated needlessly on every run.
2.7.0 (2017-01-30) 2.7.0 (2017-01-30)
......
...@@ -558,23 +558,25 @@ class Installer: ...@@ -558,23 +558,25 @@ class Installer:
self._links, self._links,
self._allow_hosts) self._allow_hosts)
for dist in dists: if self._dest is not None:
# Check whether we picked a version and, if we did, report it: # Check whether we picked a version and, if we did, report it:
if not ( for dist in dists:
dist.precedence == pkg_resources.DEVELOP_DIST if not (
or dist.precedence == pkg_resources.DEVELOP_DIST
(len(requirement.specs) == 1 or
and (len(requirement.specs) == 1
requirement.specs[0][0] == '==') and
): requirement.specs[0][0] == '==')
logger.debug('Picked: %s = %s', ):
dist.project_name, dist.version) logger.debug('Picked: %s = %s',
self._picked_versions[dist.project_name] = dist.version dist.project_name, dist.version)
self._picked_versions[dist.project_name] = dist.version
if not self._allow_picked_versions:
raise zc.buildout.UserError( if not self._allow_picked_versions:
'Picked: %s = %s' % (dist.project_name, dist.version) raise zc.buildout.UserError(
) 'Picked: %s = %s' % (dist.project_name,
dist.version)
)
return dists return dists
......
...@@ -420,10 +420,8 @@ The versions file now contains the extra pin: ...@@ -420,10 +420,8 @@ The versions file now contains the extra pin:
And re-running buildout doesn't report any picked versions anymore: And re-running buildout doesn't report any picked versions anymore:
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS >>> 'picked' in system(buildout)
Updating foo. False
recipe v2
...
If you've enabled ``update-versions-file`` but not ``show-picked-versions``, If you've enabled ``update-versions-file`` but not ``show-picked-versions``,
buildout will append the versions to your versions file anyway (without buildout will append the versions to your versions file anyway (without
......
...@@ -2408,12 +2408,12 @@ def wont_downgrade_due_to_prefer_final(): ...@@ -2408,12 +2408,12 @@ def wont_downgrade_due_to_prefer_final():
... parts = ... parts =
... ''') ... ''')
>>> [v] = [l.split('= >=', 1)[1].strip() >>> [v] = [str(l.split('= >=', 1)[1].strip())
... for l in system(buildout+' -vv').split('\n') ... for l in system(buildout+' -vv').split('\n')
... if l.startswith('zc.buildout = >=')] ... if l.startswith('zc.buildout = >=')]
>>> v == pkg_resources.working_set.find( >>> v == str(pkg_resources.working_set.find(
... pkg_resources.Requirement.parse('zc.buildout') ... pkg_resources.Requirement.parse('zc.buildout')
... ).version ... ).version)
True True
>>> write('buildout.cfg', >>> write('buildout.cfg',
...@@ -3062,6 +3062,39 @@ def test_abi_tag_eggs(): ...@@ -3062,6 +3062,39 @@ def test_abi_tag_eggs():
... ...
""" """
def test_buildout_doesnt_keep_adding_itself_to_versions():
r"""
We were constantly writing to versions.cfg for buildout and setuptools
>>> write('buildout.cfg',
... '''
... [buildout]
... parts =
... extends = versions.cfg
... show-picked-versions = true
... update-versions-file = versions.cfg
... extends = versions.cfg
... ''')
>>> write('versions.cfg',
... '''[versions]
... ''')
>>> _ = system(join('bin', 'buildout'))
>>> with open('versions.cfg') as f:
... versions = f.read()
>>> _ = system(join('bin', 'buildout'))
>>> _ = system(join('bin', 'buildout'))
>>> _ = system(join('bin', 'buildout'))
>>> with open('versions.cfg') as f:
... versions == f.read()
True
>>> cat('versions.cfg') # doctest: +ELLIPSIS
[versions]
<BLANKLINE>
# Added by buildout...
setuptools = 34.0.3
...
"""
if sys.platform == 'win32': if sys.platform == 'win32':
del buildout_honors_umask # umask on dohs is academic del buildout_honors_umask # umask on dohs is academic
......
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