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 ...@@ -4,7 +4,8 @@ Change History
2.11.4 (unreleased) 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) 2.11.3 (2018-04-13)
......
...@@ -1655,13 +1655,16 @@ def _get_matching_dist_in_location(dist, location): ...@@ -1655,13 +1655,16 @@ def _get_matching_dist_in_location(dist, location):
Check if `locations` contain only the one intended dist. Check if `locations` contain only the one intended dist.
Return the dist with metadata in the new location. Return the dist with metadata in the new location.
""" """
# Getting the dist from the environment causes the # Getting the dist from the environment causes the distribution
# distribution meta data to be read. Cloning isn't # meta data to be read. Cloning isn't good enough. We must compare
# good enough. # 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]) env = pkg_resources.Environment([location])
dists = [ d for project_name in env for d in env[project_name] ] 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 ] dist_infos = [ (d.project_name.lower(), d.parsed_version) for d in dists ]
if dist_infos == [(dist.project_name.lower(), dist.version)]: if dist_infos == [(dist.project_name.lower(), dist.parsed_version)]:
return dists.pop() return dists.pop()
def _move_to_eggs_dir_and_compile(dist, dest): 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