version: add supported remotes (#3498)

Since our remotes have optional dependencies, it is really useful to be
able to see what is currently supported. Also helps debug issues with
packages such as brew/conda/etc.
This commit is contained in:
Ruslan Kuprieiev
2020-03-18 01:14:59 +02:00
committed by GitHub
parent f19d800f43
commit 42c8fab47f
3 changed files with 21 additions and 3 deletions
+12
View File
@@ -31,6 +31,7 @@ class CmdVersion(CmdBaseNoRepo):
"Platform: {}".format(platform.platform()),
"Binary: {}".format(is_binary()),
"Package: {}".format(PKG),
"Supported remotes: {}".format(self.get_supported_remotes()),
]
try:
@@ -112,6 +113,17 @@ class CmdVersion(CmdBaseNoRepo):
return ", ".join(cache)
@staticmethod
def get_supported_remotes():
from dvc.remote import REMOTES
supported_remotes = []
for remote in REMOTES:
if not remote.get_missing_deps():
supported_remotes.append(remote.scheme)
return ", ".join(supported_remotes)
def add_parser(subparsers, parent_parser):
VERSION_HELP = "Show DVC version and system/environment information."
+7 -3
View File
@@ -108,17 +108,21 @@ class RemoteBASE(object):
self.cache_types = config.get("type") or copy(self.DEFAULT_CACHE_TYPES)
self.cache_type_confirmed = False
def _check_requires(self, config):
@classmethod
def get_missing_deps(cls):
import importlib
missing = []
for package, module in self.REQUIRES.items():
for package, module in cls.REQUIRES.items():
try:
importlib.import_module(module)
except ImportError:
missing.append(package)
return missing
def _check_requires(self, config):
missing = self.get_missing_deps()
if not missing:
return
+2
View File
@@ -17,6 +17,7 @@ def test_info_in_repo(tmp_dir, dvc, caplog):
assert re.search(r"Platform: .*", caplog.text)
assert re.search(r"Binary: (True|False)", caplog.text)
assert re.search(r"Package: .*", caplog.text)
assert re.search(r"Supported remotes: .*", caplog.text)
assert re.search(
r"(Cache: (.*link - (not )?supported(,\s)?){3})", caplog.text
)
@@ -39,6 +40,7 @@ def test_info_outside_of_repo(tmp_dir, caplog):
assert re.search(r"Platform: .*", caplog.text)
assert re.search(r"Binary: (True|False)", caplog.text)
assert re.search(r"Package: .*", caplog.text)
assert re.search(r"Supported remotes: .*", caplog.text)
assert not re.search(r"(Cache: (.*link - (not )?(,\s)?){3})", caplog.text)