Ignore incompatibilities when resolve dist

This commit is contained in:
Frost Ming
2021-01-20 09:03:41 +08:00
parent deefb637a6
commit 4c21723f15
4 changed files with 8 additions and 2 deletions
+1
View File
@@ -0,0 +1 @@
Fix a bug that ``importlib-metadata`` from the project's dependencies conflicts with that from ``pipenv``'s.
+6 -1
View File
@@ -118,7 +118,12 @@ class Environment(object):
except (KeyError, AttributeError, OSError, IOError): # The METADATA file can't be found
return deps
for req in reqs:
dist = working_set.find(req)
try:
dist = working_set.find(req)
except pkg_resources.VersionConflict:
# https://github.com/pypa/pipenv/issues/4549
# The requirement is already present with incompatible version.
continue
deps |= cls.resolve_dist(dist, working_set)
return deps
+1 -1
View File
@@ -12,7 +12,7 @@ os.environ["PIP_PYTHON_PATH"] = str(sys.executable)
def find_site_path(pkg, site_dir=None):
import pkg_resources
if site_dir is not None:
if site_dir is None:
site_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
working_set = pkg_resources.WorkingSet([site_dir] + sys.path[:])
for dist in working_set: