Skip to content
This repository has been archived by the owner on Jan 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #276 from dephell/fix-pip
Browse files Browse the repository at this point in the history
fix pip compat
  • Loading branch information
orsinium committed Oct 21, 2019
2 parents d87c1a2 + d948e2e commit 5fabbfa
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions dephell/converters/pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,42 @@ def _get_finder():
except TypeError:
pass

# pip 19.3
from pip._internal.models.search_scope import SearchScope
from pip._internal.models.selection_prefs import SelectionPreferences
try:
return PackageFinder.create(
search_scope=SearchScope(find_links=[], index_urls=[]),
selection_prefs=SelectionPreferences(allow_yanked=False),
session=PipSession(),
)
except TypeError:
pass

# pip 19.3.1
from pip._internal.models.target_python import TargetPython
try:
from pip._internal.collector import LinkCollector
return PackageFinder.create(
link_collector=LinkCollector(
search_scope=SearchScope(find_links=[], index_urls=[]),
session=PipSession(),
),
selection_prefs=SelectionPreferences(allow_yanked=False),
target_python=TargetPython(),
)
except ImportError:
pass

# pip 19.3.2?
from pip._internal.index.collector import LinkCollector
return PackageFinder.create(
search_scope=SearchScope(find_links=[], index_urls=[]),
selection_prefs=SelectionPreferences(allow_yanked=False),
session=PipSession(),
link_collector=LinkCollector(
search_scope=SearchScope(find_links=[], index_urls=[]),
session=PipSession(),
),
target_python=TargetPython(),
allow_yanked=False,
)

# https://github.com/pypa/packaging/blob/master/packaging/requirements.py
Expand Down

0 comments on commit 5fabbfa

Please sign in to comment.