File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 10
10
#
11
11
12
12
import os
13
+ import subprocess
13
14
from netrc import netrc
14
15
from typing import Dict
15
16
from typing import List
@@ -71,6 +72,21 @@ def to_dict(self, generic_paths=False):
71
72
"resolution" : self .resolution ,
72
73
}
73
74
75
+ def pip_conf_get_index_urls () -> list :
76
+ pip_index_url_cmd = "pip config get global.index-url"
77
+ pip_extra_index_url_cmd = "pip config get global.extra-index-url"
78
+ index_urls = subprocess .run (pip_index_url_cmd , capture_output = True )
79
+ if index_urls .returncode != 0 :
80
+ index_urls = []
81
+ else :
82
+ index_urls = index_urls .stdout .decode ("utf-8" ).split ()
83
+ extra_index_urls = subprocess .run (pip_extra_index_url_cmd , capture_output = True )
84
+ if extra_index_urls .returncode != 0 :
85
+ extra_index_urls = []
86
+ else :
87
+ extra_index_urls = extra_index_urls .stdout .decode ("utf-8" ).split ()
88
+ all_index_urls = [url for url in index_urls + extra_index_urls if url != "" ]
89
+ return all_index_urls
74
90
75
91
def resolve_dependencies (
76
92
requirement_files = tuple (),
@@ -146,6 +162,11 @@ def resolve_dependencies(
146
162
147
163
files = []
148
164
165
+ pip_conf_index_urls = pip_conf_get_index_urls ()
166
+
167
+ if pip_conf_index_urls != []:
168
+ index_urls = tuple (pip_conf_index_urls ) + tuple (index_urls )
169
+
149
170
if PYPI_SIMPLE_URL not in index_urls :
150
171
index_urls = tuple ([PYPI_SIMPLE_URL ]) + tuple (index_urls )
151
172
You can’t perform that action at this time.
0 commit comments