Commit 9d1e0b16 authored by Reinout van Rees's avatar Reinout van Rees

Storing the found dist in the 'best' cache at the end

Whatever the method we used to find it, cache the result. Not just in one of
the cases. And it makes the method more readable as it doesn't mix functionality
parent b4d0245b
...@@ -653,7 +653,7 @@ class Installer: ...@@ -653,7 +653,7 @@ class Installer:
dist = ws.by_key.get(req.key) dist = ws.by_key.get(req.key)
if dist is None: if dist is None:
try: try:
dist = best[req.key] = env.best_match(req, ws) dist = env.best_match(req, ws)
except pkg_resources.VersionConflict as err: except pkg_resources.VersionConflict as err:
raise VersionConflict(err, ws) raise VersionConflict(err, ws)
if dist is None: if dist is None:
...@@ -669,6 +669,8 @@ class Installer: ...@@ -669,6 +669,8 @@ class Installer:
# Oops, the "best" so far conflicts with a dependency. # Oops, the "best" so far conflicts with a dependency.
raise VersionConflict( raise VersionConflict(
pkg_resources.VersionConflict(dist, req), ws) pkg_resources.VersionConflict(dist, req), ws)
best[req.key] = dist
requirements.extend(dist.requires(req.extras)[::-1]) requirements.extend(dist.requires(req.extras)[::-1])
processed[req] = True processed[req] = True
return ws return ws
......
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