From f9285e347427384fc217aea7b8e316285b297a54 Mon Sep 17 00:00:00 2001 From: Jaime RGP Date: Thu, 10 Mar 2022 11:24:12 +0100 Subject: [PATCH 1/2] FIX: conda_interface should be able to handle alpha, beta, rc versions --- constructor/conda_interface.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/constructor/conda_interface.py b/constructor/conda_interface.py index 28ae0d20..354f9ff3 100644 --- a/constructor/conda_interface.py +++ b/constructor/conda_interface.py @@ -16,7 +16,11 @@ "with sys.prefix: %s" % sys.prefix) if conda_interface_type == 'conda': - CONDA_MAJOR_MINOR = tuple(int(x) for x in CONDA_INTERFACE_VERSION.split('.')[:2]) + # This import path has been stable since 2016 + from conda.models.version import VersionOrder + + _conda_version = VersionOrder(CONDA_INTERFACE_VERSION).version + CONDA_MAJOR_MINOR = _conda_version[1][0], _conda_version[2][0] from conda._vendor.toolz.itertoolz import ( concatv as _concatv, get as _get, groupby as _groupby, From 6f3c746b01795c8ea62dcad8402f689cfc6fbb6c Mon Sep 17 00:00:00 2001 From: Jaime RGP Date: Thu, 10 Mar 2022 23:25:43 +0100 Subject: [PATCH 2/2] flatten instead of nested access Co-authored-by: jezdez --- constructor/conda_interface.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/constructor/conda_interface.py b/constructor/conda_interface.py index 354f9ff3..eb528a1d 100644 --- a/constructor/conda_interface.py +++ b/constructor/conda_interface.py @@ -3,6 +3,7 @@ import json from os.path import join +from itertools import chain import sys NAV_APPS = ['glueviz', 'jupyterlab', 'notebook', @@ -20,7 +21,8 @@ from conda.models.version import VersionOrder _conda_version = VersionOrder(CONDA_INTERFACE_VERSION).version - CONDA_MAJOR_MINOR = _conda_version[1][0], _conda_version[2][0] + # Flatten VersionOrder.version, skip epoch, and keep only major and minor + CONDA_MAJOR_MINOR = tuple(chain.from_iterable(_conda_version))[1:3] from conda._vendor.toolz.itertoolz import ( concatv as _concatv, get as _get, groupby as _groupby,