mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
Re-instate conda version check fix
Lost https://github.com/jupyterhub/the-littlest-jupyterhub/pull/58 to a rebase. Put it back!
This commit is contained in:
@@ -8,6 +8,7 @@ import hashlib
|
|||||||
import contextlib
|
import contextlib
|
||||||
import tempfile
|
import tempfile
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
from distutils.version import LooseVersion as V
|
||||||
|
|
||||||
|
|
||||||
def md5_file(fname):
|
def md5_file(fname):
|
||||||
@@ -28,12 +29,13 @@ def check_miniconda_version(prefix, version):
|
|||||||
Return true if a miniconda install with version exists at prefix
|
Return true if a miniconda install with version exists at prefix
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
return subprocess.check_output([
|
installed_version = subprocess.check_output([
|
||||||
os.path.join(prefix, 'bin', 'conda'),
|
os.path.join(prefix, 'bin', 'conda'),
|
||||||
'-V'
|
'-V'
|
||||||
]).decode().strip() == 'conda {}'.format(version)
|
]).decode().strip().split()[1]
|
||||||
|
return V(installed_version) >= V(version)
|
||||||
except (subprocess.CalledProcessError, FileNotFoundError):
|
except (subprocess.CalledProcessError, FileNotFoundError):
|
||||||
# Conda doesn't exist, or wrong version
|
# Conda doesn't exist
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user