From ab5dd0e0d89d80e2335e7e63dee3b2b2233575b1 Mon Sep 17 00:00:00 2001 From: Min RK Date: Tue, 17 Jul 2018 08:41:24 -0700 Subject: [PATCH] bootstrap: allow conda to be upgraded use >= instead of == to check installed version --- bootstrap/bootstrap.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bootstrap/bootstrap.py b/bootstrap/bootstrap.py index 7334fec..463c380 100644 --- a/bootstrap/bootstrap.py +++ b/bootstrap/bootstrap.py @@ -11,6 +11,7 @@ Constraints: - Be compatible with Python 3.4 (since we support Ubuntu 16.04) - Use stdlib modules only """ +from distutils.version import LooseVersion as V import os import subprocess import urllib.request @@ -38,13 +39,15 @@ def check_miniconda_version(prefix, version): Return true if a miniconda install with version exists at prefix """ try: - return subprocess.check_output([ + installed_version = subprocess.check_output([ os.path.join(prefix, 'bin', 'conda'), '-V' - ]).decode().strip() == 'conda {}'.format(version) + ]).decode().strip().split()[1] except (subprocess.CalledProcessError, FileNotFoundError): # Conda doesn't exist, or wrong version return False + else: + return V(installed_version) >= V(version) @contextlib.contextmanager