Skip to content

Commit 7c5c1e9

Browse files
committed
Restored back the automatic addition of https://
1 parent b281aba commit 7c5c1e9

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

shpc/main/registry/remote.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,18 @@ class VersionControl(Provider):
9595

9696
def __init__(self, source, tag=None, subdir=None):
9797
if "://" not in source:
98-
raise ValueError("'%s' is not a valid URL." % source)
98+
if os.path.exists(source):
99+
raise ValueError(
100+
"VersionControl registry must be a remote path, not a local one."
101+
)
102+
# Normalise the URL
103+
# Heuristics: if there is a @, it's probably ssh
104+
if "@" in self.url:
105+
self.url = "ssh://" + source
106+
else:
107+
self.url = "https://" + source
108+
else:
109+
self.url = source
99110

100111
self.is_cloned = False
101112

@@ -106,11 +117,10 @@ def __init__(self, source, tag=None, subdir=None):
106117

107118
# E.g., subdirectory with registry files
108119
self.subdir = subdir
109-
self.url = source
110120

111121
@classmethod
112122
def matches(cls, source):
113-
return "://" in source
123+
return ("://" in source) or not os.path.exists(source)
114124

115125
@property
116126
def library_url(self):

0 commit comments

Comments
 (0)