Commit a9f7e496 authored by Xavier Thompson's avatar Xavier Thompson

[fix] Allow only installable DEVELOP_DIST in index

The package index considers may yield dists found on its local
search_path - sys.path by default - in addition to its index_url.

This commit discards such dists when they do not contain a setup.py
nor a pyproject.toml, as a good heuristic of whether they will be
installable or not.
parent 92d3c86a
...@@ -481,7 +481,9 @@ class Installer(object): ...@@ -481,7 +481,9 @@ class Installer(object):
wheel = getattr(requirement, 'wheel', False) wheel = getattr(requirement, 'wheel', False)
def filter_precedence(dist): def filter_precedence(dist):
return (dist.precedence == WHL_DIST) == wheel and ( return (dist.precedence == WHL_DIST) == wheel and (
not source or dist.precedence == pkg_resources.SOURCE_DIST) dist.precedence == pkg_resources.SOURCE_DIST if source else not (
dist.precedence == pkg_resources.DEVELOP_DIST and
{'setup.py', 'pyproject.toml'}.isdisjoint(os.listdir(dist.location))))
index = self._index index = self._index
if not networkcache_failed: if not networkcache_failed:
......
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