mirror of
https://github.com/clearml/clearml-agent
synced 2025-02-07 13:26:08 +00:00
Fix python package with git+git:// links or git+ssh:// conversion
This commit is contained in:
parent
06010ef1b7
commit
5c5802c089
@ -64,10 +64,19 @@ class ExternalRequirements(SimpleSubstitution):
|
|||||||
vcs_url = req_line[4:]
|
vcs_url = req_line[4:]
|
||||||
# reverse replace
|
# reverse replace
|
||||||
vcs_url = vcs_url[::-1].replace(fragment[::-1], '', 1)[::-1]
|
vcs_url = vcs_url[::-1].replace(fragment[::-1], '', 1)[::-1]
|
||||||
|
# remove ssh:// or git:// prefix for git detection and credentials
|
||||||
|
scheme = ''
|
||||||
|
if vcs_url and (vcs_url.startswith('ssh://') or vcs_url.startswith('git://')):
|
||||||
|
scheme = 'ssh://' # notice git:// is actually ssh://
|
||||||
|
vcs_url = vcs_url[6:]
|
||||||
|
|
||||||
from ..repo import Git
|
from ..repo import Git
|
||||||
vcs = Git(session=session, url=vcs_url, location=None, revision=None)
|
vcs = Git(session=session, url=vcs_url, location=None, revision=None)
|
||||||
vcs._set_ssh_url()
|
vcs._set_ssh_url()
|
||||||
new_req_line = 'git+{}{}'.format(vcs.url_with_auth, fragment)
|
new_req_line = 'git+{}{}{}'.format(
|
||||||
|
'' if scheme and '://' in vcs.url else scheme,
|
||||||
|
vcs.url_with_auth, fragment
|
||||||
|
)
|
||||||
if new_req_line != req_line:
|
if new_req_line != req_line:
|
||||||
furl_line = furl(new_req_line)
|
furl_line = furl(new_req_line)
|
||||||
print('Replacing original pip vcs \'{}\' with \'{}\''.format(
|
print('Replacing original pip vcs \'{}\' with \'{}\''.format(
|
||||||
|
Loading…
Reference in New Issue
Block a user