mirror of
https://github.com/clearml/clearml-agent
synced 2025-01-31 09:06:52 +00:00
Fix requirements --extra-index-url line with trailing comment
Fix --extra-index-url is added for different command line switches
This commit is contained in:
parent
9acbad28f7
commit
ff6cee4a44
@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from clearml_agent.definitions import PIP_EXTRA_INDICES
|
from clearml_agent.definitions import PIP_EXTRA_INDICES
|
||||||
@ -44,10 +45,12 @@ def parse(reqstr, cwd=None):
|
|||||||
yield requirement
|
yield requirement
|
||||||
elif line.startswith('-f') or line.startswith('--find-links') or \
|
elif line.startswith('-f') or line.startswith('--find-links') or \
|
||||||
line.startswith('-i') or line.startswith('--index-url') or \
|
line.startswith('-i') or line.startswith('--index-url') or \
|
||||||
line.startswith('--extra-index-url') or \
|
|
||||||
line.startswith('--no-index'):
|
line.startswith('--no-index'):
|
||||||
_, extra_index = line.split()
|
warnings.warn('Private repos not supported. Skipping.')
|
||||||
if extra_index not in PIP_EXTRA_INDICES:
|
elif line.startswith('--extra-index-url'):
|
||||||
|
extra_index = line[len('--extra-index-url'):].strip()
|
||||||
|
extra_index = re.sub(r"\s+#.*$", "", extra_index) # strip comments
|
||||||
|
if extra_index and extra_index not in PIP_EXTRA_INDICES:
|
||||||
PIP_EXTRA_INDICES.append(extra_index)
|
PIP_EXTRA_INDICES.append(extra_index)
|
||||||
print(f"appended {extra_index} to list of extra pip indices")
|
print(f"appended {extra_index} to list of extra pip indices")
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user