File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed
Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,7 @@ def _get_update_instructions(self):
133133 "2. Go to {blue}https://dvc.org{reset}\n "
134134 "3. Download and install new binary"
135135 ),
136+ "conda" : "Run {yellow}conda{reset} {update}update{reset} dvc" ,
136137 None : (
137138 "Find the latest release at\n {blue}"
138139 "https://github.com/iterative/dvc/releases/latest"
Original file line number Diff line number Diff line change 11from dvc .utils import is_binary
22
33
4+ def is_conda ():
5+ try :
6+ from .build import PKG # patched during conda package build
7+
8+ return PKG == "conda"
9+ except ImportError :
10+ return False
11+
12+
413def get_linux ():
514 import distro
615
@@ -37,6 +46,9 @@ def get_package_manager():
3746 import platform
3847 from dvc .exceptions import DvcException
3948
49+ if is_conda ():
50+ return "conda"
51+
4052 m = {
4153 "Windows" : get_windows (),
4254 "Darwin" : get_darwin (),
Original file line number Diff line number Diff line change @@ -49,3 +49,13 @@ def test_check_version_outdated(updater):
4949 updater .current = "0.20.8"
5050
5151 assert updater ._is_outdated ()
52+
53+
54+ @mock .patch ("dvc.utils.pkg.is_conda" )
55+ def test_check_dvc_from_conda (mocked_is_conda , updater ):
56+ mocked_is_conda .return_value = True
57+ updater .latest = "0.21.0"
58+ updater .current = "0.20.8"
59+
60+ msg = "Run {yellow}conda{reset} {update}update{reset} dvc"
61+ assert updater ._get_update_instructions () == msg
You can’t perform that action at this time.
0 commit comments