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 #363 from dephell/lock-pip
Browse files Browse the repository at this point in the history
Lock pip
  • Loading branch information
orsinium committed Jan 24, 2020
2 parents 38f7c09 + 6fea220 commit f74c7c7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
26 changes: 11 additions & 15 deletions dephell/converters/pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
# external
from dephell_discover import Root as PackageRoot
from dephell_links import DirLink, FileLink
from pip._internal.download import PipSession
from pip._internal.req import parse_requirements

# app
Expand All @@ -25,6 +24,14 @@
# pip>=20.0.1
from pip._internal.index.package_finder import PackageFinder

try:
from pip._internal.download import PipSession
except ImportError:
try:
from pip._internal.network import PipSession
except ImportError:
from pip._internal.network.session import PipSession


class PIPConverter(BaseConverter):
sep = ' \\\n '
Expand Down Expand Up @@ -151,30 +158,19 @@ def _get_finder():
except TypeError:
pass

# pip 19.3.1
from pip._internal.models.target_python import TargetPython
try:
# pip 19.3.1
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
from pip._internal.index.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(),
allow_yanked=False,
)

# https://github.com/pypa/packaging/blob/master/packaging/requirements.py
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ cerberus = ">=1.3"
jinja2 = "*"
m2r = "*"
packaging = "*"
pip = ">=18.0"
pip = ">=18.0,<=19.3.1"
requests = "*"
tomlkit = "*"
yaspin = "*"
Expand Down

0 comments on commit f74c7c7

Please sign in to comment.