Merge pull request #2679 from n3hrox/enhance/conda_detection

updater: detect conda
This commit is contained in:
Ruslan Kuprieiev
2019-11-04 22:54:05 +02:00
committed by GitHub
3 changed files with 23 additions and 0 deletions
+1
View File
@@ -133,6 +133,7 @@ class Updater(object): # pragma: no cover
"2. Go to {blue}https://dvc.org{reset}\n"
"3. Download and install new binary"
),
"conda": "Run {yellow}conda{reset} {update}update{reset} dvc",
None: (
"Find the latest release at\n{blue}"
"https://github.com/iterative/dvc/releases/latest"
+12
View File
@@ -1,6 +1,15 @@
from dvc.utils import is_binary
def is_conda():
try:
from .build import PKG # patched during conda package build
return PKG == "conda"
except ImportError:
return False
def get_linux():
import distro
@@ -37,6 +46,9 @@ def get_package_manager():
import platform
from dvc.exceptions import DvcException
if is_conda():
return "conda"
m = {
"Windows": get_windows(),
"Darwin": get_darwin(),
+10
View File
@@ -49,3 +49,13 @@ def test_check_version_outdated(updater):
updater.current = "0.20.8"
assert updater._is_outdated()
@mock.patch("dvc.utils.pkg.is_conda")
def test_check_dvc_from_conda(mocked_is_conda, updater):
mocked_is_conda.return_value = True
updater.latest = "0.21.0"
updater.current = "0.20.8"
msg = "Run {yellow}conda{reset} {update}update{reset} dvc"
assert updater._get_update_instructions() == msg