From 4da42d188c0eaf15804d1c61d42361b619499e37 Mon Sep 17 00:00:00 2001 From: n3hrox Date: Mon, 4 Nov 2019 21:00:09 +0100 Subject: [PATCH] use patch heuristic to determine conda --- dvc/utils/pkg.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dvc/utils/pkg.py b/dvc/utils/pkg.py index a35bd7306..f080d1e1d 100644 --- a/dvc/utils/pkg.py +++ b/dvc/utils/pkg.py @@ -1,9 +1,21 @@ 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 + if is_conda(): + return "conda" + if not is_binary(): return "pip" @@ -21,6 +33,8 @@ def get_linux(): def get_darwin(): + if is_conda(): + return "conda" if not is_binary(): if __file__.startswith("/usr/local/Cellar"): return "formula" @@ -30,6 +44,8 @@ def get_darwin(): def get_windows(): + if is_conda(): + return "conda" return None if is_binary() else "pip"