Commit 1167e212 authored by Jason Madden's avatar Jason Madden

Compare using Distribution.parsed_version to account for normalization.

Fixes #451.
parent 9161c43d
......@@ -4,7 +4,8 @@ Change History
2.11.4 (unreleased)
===================
- Nothing changed yet.
- Fix `issue 451 <https://github.com/buildout/buildout/issues/451>`:
distributions with a two-digit version can be installed.
2.11.3 (2018-04-13)
......
......@@ -1655,13 +1655,16 @@ def _get_matching_dist_in_location(dist, location):
Check if `locations` contain only the one intended dist.
Return the dist with metadata in the new location.
"""
# Getting the dist from the environment causes the
# distribution meta data to be read. Cloning isn't
# good enough.
# Getting the dist from the environment causes the distribution
# meta data to be read. Cloning isn't good enough. We must compare
# dist.parsed_version, not dist.version, because one or the other
# may be normalized (e.g., 3.3 becomes 3.3.0 when downloaded from
# PyPI.)
env = pkg_resources.Environment([location])
dists = [ d for project_name in env for d in env[project_name] ]
dist_infos = [ (d.project_name.lower(), d.version) for d in dists ]
if dist_infos == [(dist.project_name.lower(), dist.version)]:
dist_infos = [ (d.project_name.lower(), d.parsed_version) for d in dists ]
if dist_infos == [(dist.project_name.lower(), dist.parsed_version)]:
return dists.pop()
def _move_to_eggs_dir_and_compile(dist, dest):
......
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