Skip to content

Commit e3e6a24

Browse files
committed
Fix 180: Make sure to use pip as defined by python
Signed-off-by: Cesar Lizarraga <[email protected]>
1 parent 4bf69cf commit e3e6a24

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/python_inspector/api.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,14 @@ def to_dict(self, generic_paths=False):
7373
}
7474

7575
def pip_conf_get_index_urls() -> list:
76-
# Get index urls from pip
77-
pip_index_url_cmd = ["pip", "config", "get", "global.index-url"]
78-
pip_extra_index_url_cmd = ["pip", "config", "get", "global.extra-index-url"]
76+
"""
77+
Returns a list of index_urls as provided by `pip config get`. If none, it returns an empty list.
78+
"""
79+
80+
# Get index URLS from pip and split them into lists.
81+
# Index URLs are split by whitespace
82+
pip_index_url_cmd = ["/usr/bin/env", "python", "-m", "pip", "config", "get", "global.index-url"]
83+
pip_extra_index_url_cmd = ["/usr/bin/env", "python", "-m", "pip", "config", "get", "global.extra-index-url"]
7984
index_urls = subprocess.run(pip_index_url_cmd, capture_output=True)
8085
if index_urls.returncode != 0:
8186
index_urls = []

0 commit comments

Comments
 (0)