File tree 1 file changed +14
-4
lines changed
1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 7
7
except ImportError :
8
8
# It is quick hack to support pip 10 that has changed its internal
9
9
# structure of the modules.
10
- from pip ._internal .download import PipSession
10
+ # Further hack - seems like pip 20 and later does not support
11
+ # pip._internal.download anymore. It appears as though
12
+ # parse_requirements (used below) does not need a valid PipSession.
13
+ # Any value seems to work. So hack this even more.
14
+ try :
15
+ from pip ._internal .download import PipSession
16
+ except ImportError :
17
+ PipSession = object
11
18
from pip ._internal .req .req_file import parse_requirements
12
19
13
20
@@ -22,9 +29,12 @@ def get_requirements(source):
22
29
"""
23
30
24
31
install_reqs = parse_requirements (filename = source , session = PipSession ())
25
-
26
- return [str (ir .req ) for ir in install_reqs ]
27
-
32
+ # pip 20 changed ParsedRequirement.req to ParsedRequirement.requirement.
33
+ try :
34
+ requirements = [str (ir .req ) for ir in install_reqs ]
35
+ except AttributeError :
36
+ requirements = [str (ir .requirement ) for ir in install_reqs ]
37
+ return requirements
28
38
29
39
setup (
30
40
packages = find_packages (),
You can’t perform that action at this time.
0 commit comments