mirror of
https://github.com/clearml/clearml
synced 2025-06-11 17:10:41 +00:00
Fix git+https requirement using subdirectory is not supported (#947)
Fixes issue #946
This commit is contained in:
parent
37dde23bc9
commit
ea1e4ac087
@ -406,19 +406,30 @@ def _search_path(path):
|
|||||||
# noinspection PyBroadException
|
# noinspection PyBroadException
|
||||||
try:
|
try:
|
||||||
with open(git_direct_json, 'r') as f:
|
with open(git_direct_json, 'r') as f:
|
||||||
vcs_info = json.load(f)
|
direct_json = json.load(f)
|
||||||
|
|
||||||
if 'vcs_info' in vcs_info:
|
if 'vcs_info' in direct_json:
|
||||||
|
vcs_info = direct_json['vcs_info']
|
||||||
git_url = '{vcs}+{url}@{commit}#egg={package}'.format(
|
git_url = '{vcs}+{url}@{commit}#egg={package}'.format(
|
||||||
vcs=vcs_info['vcs_info']['vcs'], url=vcs_info['url'],
|
vcs=vcs_info['vcs'], url=direct_json['url'],
|
||||||
commit=vcs_info['vcs_info']['commit_id'], package=pkg_name)
|
commit=vcs_info['commit_id'], package=pkg_name)
|
||||||
|
# If subdirectory is present, append this to the git_url
|
||||||
|
if 'subdirectory' in direct_json:
|
||||||
|
git_url = '{git_url}&subdirectory={subdirectory}'.format(
|
||||||
|
git_url=git_url, subdirectory=direct_json['subdirectory'])
|
||||||
# Bugfix: package name should be the URL link, because we need it unique
|
# Bugfix: package name should be the URL link, because we need it unique
|
||||||
# mapping[pkg_name] = ('-e', git_url)
|
# mapping[pkg_name] = ('-e', git_url)
|
||||||
pkg_name, version = '-e {}'.format(git_url), ''
|
pkg_name, version = '-e {}'.format(git_url), ''
|
||||||
elif 'url' in vcs_info:
|
elif 'url' in direct_json:
|
||||||
url_link = vcs_info.get('url', '').strip().lower()
|
url_link = direct_json.get('url', '').strip().lower()
|
||||||
if url_link and not url_link.startswith('file://'):
|
if url_link and not url_link.startswith('file://'):
|
||||||
pkg_name, version = vcs_info['url'], ''
|
git_url = direct_json['url']
|
||||||
|
# If subdirectory is present, append this to the git_url
|
||||||
|
if 'subdirectory' in direct_json:
|
||||||
|
git_url = '{git_url}#subdirectory={subdirectory}'.format(
|
||||||
|
git_url=direct_json['url'], subdirectory=direct_json['subdirectory'])
|
||||||
|
|
||||||
|
pkg_name, version = git_url, ''
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user