diff --git a/shpc/main/registry/provider.py b/shpc/main/registry/provider.py index c396c99bb..6a62ab287 100644 --- a/shpc/main/registry/provider.py +++ b/shpc/main/registry/provider.py @@ -33,7 +33,7 @@ class Provider: """ def __init__(self, source, *args, **kwargs): - if not (source.startswith("https://") or os.path.exists(source)): + if not (source.startswith("https://") or source.startswith("ssh://") or os.path.exists(source)): raise ValueError( "Registry source must exist on the filesystem or be given as https://." ) @@ -44,7 +44,7 @@ def exists(self, name): @property def is_filesystem_registry(self): - return not self.source.startswith("http") and os.path.exists(self.source) + return not (self.source.startswith("http") or self.source.startswith("ssh")) and os.path.exists(self.source) @property def name(self): diff --git a/shpc/main/registry/remote.py b/shpc/main/registry/remote.py index 6053a079d..934917249 100644 --- a/shpc/main/registry/remote.py +++ b/shpc/main/registry/remote.py @@ -104,7 +104,7 @@ def __init__(self, *args, **kwargs): @classmethod def matches(cls, source): - return cls.provider_name in source and source.startswith("http") + return cls.provider_name in source and (source.startswith("http") or source.startswith("ssh")) @property def source_url(self): @@ -190,6 +190,8 @@ def _update_cache(self, force=False): if self._cache and not force: return + if self.source.startswith("ssh"): + return self._update_clone_cache() # Check for exposed library API on GitHub or GitLab pages response = requests.get(self.web_url) if response.status_code != 200: