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 1010#
1111
1212import os
13+ import subprocess
1314from netrc import netrc
1415from typing import Dict
1516from typing import List
@@ -71,6 +72,21 @@ def to_dict(self, generic_paths=False):
7172 "resolution" : self .resolution ,
7273 }
7374
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
7490
7591def resolve_dependencies (
7692 requirement_files = tuple (),
@@ -146,6 +162,11 @@ def resolve_dependencies(
146162
147163 files = []
148164
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+
149170 if PYPI_SIMPLE_URL not in index_urls :
150171 index_urls = tuple ([PYPI_SIMPLE_URL ]) + tuple (index_urls )
151172
You can’t perform that action at this time.
0 commit comments