Skip to content

Commit 4d84329

Browse files
Marc SerratMarc Serrat
authored andcommitted
Fix for pip v20.X
1 parent 0f2e09e commit 4d84329

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

setup.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,19 @@
77
from os.path import abspath, dirname, exists, join
88
from setuptools import find_packages, setup
99

10-
try: # for pip >= 10
11-
# noinspection PyProtectedMember,PyPackageRequirements
10+
try:
11+
# pip >=20
12+
from pip._internal.network.session import PipSession
1213
from pip._internal.req import parse_requirements
13-
except ImportError: # for pip <= 9.0.3
14-
# noinspection PyPackageRequirements,PyUnresolvedReferences
15-
from pip.req import parse_requirements
14+
except ImportError:
15+
try:
16+
# 10.0.0 <= pip <= 19.3.1
17+
from pip._internal.download import PipSession
18+
from pip._internal.req import parse_requirements
19+
except ImportError:
20+
# pip <= 9.0.3
21+
from pip.download import PipSession
22+
from pip.req import parse_requirements
1623

1724
# noinspection PyTypeChecker
1825
install_reqs = parse_requirements(

0 commit comments

Comments
 (0)