diff --git a/.travis.yml b/.travis.yml index 353d0a7..ee1cc34 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,11 +4,14 @@ sudo: false env: - PYTHON_VERSION=2.7 CONDA_VERSION=4.2.16 - - PYTHON_VERSION=3.4 CONDA_VERSION=4.2.16 + - PYTHON_VERSION=3.5 CONDA_VERSION=4.2.16 - PYTHON_VERSION=3.6 CONDA_VERSION=4.2.16 - PYTHON_VERSION=2.7 CONDA_VERSION=4.3.21 - - PYTHON_VERSION=3.4 CONDA_VERSION=4.3.21 + - PYTHON_VERSION=3.5 CONDA_VERSION=4.3.21 - PYTHON_VERSION=3.6 CONDA_VERSION=4.3.21 + - PYTHON_VERSION=2.7 CONDA_VERSION=4.5.3 + - PYTHON_VERSION=3.5 CONDA_VERSION=4.5.3 + - PYTHON_VERSION=3.6 CONDA_VERSION=4.5.3 install: - export CONDA_BASE=http://repo.continuum.io/miniconda/Miniconda3 diff --git a/conda_execute/conda_interface.py b/conda_execute/conda_interface.py index 5f9617d..71defdd 100644 --- a/conda_execute/conda_interface.py +++ b/conda_execute/conda_interface.py @@ -12,26 +12,33 @@ def parse_conda_version_major_minor(string): CONDA_VERSION_MAJOR_MINOR = parse_conda_version_major_minor(CONDA_VERSION) conda_42 = CONDA_VERSION_MAJOR_MINOR >= (4, 2) conda_43 = CONDA_VERSION_MAJOR_MINOR >= (4, 3) +conda_44 = CONDA_VERSION_MAJOR_MINOR >= (4, 4) +conda_45 = CONDA_VERSION_MAJOR_MINOR >= (4, 5) from conda.lock import Locked -from conda.config import user_rc_path, sys_rc_path -user_rc_path, sys_rc_path = user_rc_path, sys_rc_path Locked = Locked - -if conda_42: +if conda_44: + from conda.base.context import user_rc_path, sys_rc_path + from conda.exports import envs_dirs, pkgs_dirs + from conda.exports import Resolve + from conda.exports import get_index + from conda.common.serialize import yaml_dump, yaml_load +elif conda_42: + from conda.config import user_rc_path, sys_rc_path from conda.exports import envs_dirs, pkgs_dirs from conda.exports import Resolve from conda.exports import get_index - from conda.common.yaml import yaml_load else: + from conda.config import user_rc_path, sys_rc_path from conda.config import envs_dirs, pkgs_dirs from conda.resolve import Resolve from conda.api import get_index - from conda.utils import yaml_load +user_rc_path, sys_rc_path = user_rc_path, sys_rc_path + envs_dirs, pkgs_dirs = envs_dirs, pkgs_dirs Resolve = Resolve get_index = get_index diff --git a/conda_execute/tmpenv.py b/conda_execute/tmpenv.py index 562825e..9e4834f 100644 --- a/conda_execute/tmpenv.py +++ b/conda_execute/tmpenv.py @@ -82,7 +82,16 @@ def _create_env_conda_43(prefix, index, full_list_of_packages): txn = UnlinkLinkTransaction.create_from_dists(index, prefix, (), full_list_of_packages) txn.execute() - +def _create_env_conda_44(prefix, full_list_of_packages): + assert CONDA_VERSION_MAJOR_MINOR >= (4, 4) + from conda.models.match_spec import MatchSpec + from conda.core.solve import Solver + + matched_list_of_packages = (MatchSpec(d) for d in full_list_of_packages) + m = Solver(prefix, (), specs_to_add=matched_list_of_packages) + txn = m.solve_for_transaction() + txn.execute() + def create_env(spec, force_recreation=False, extra_channels=()): """ Create a temporary environment from the given specification. @@ -110,8 +119,9 @@ def create_env(spec, force_recreation=False, extra_channels=()): # Put out a newline. Conda's solve doesn't do it for us. log.info('\n') - - if CONDA_VERSION_MAJOR_MINOR >= (4, 3): + if CONDA_VERSION_MAJOR_MINOR >= (4, 4): + _create_env_conda_44(env_locn, full_list_of_packages) + elif CONDA_VERSION_MAJOR_MINOR >= (4, 3): sorted_list_of_packages = r.dependency_sort({d.name: d for d in full_list_of_packages}) _create_env_conda_43(env_locn, index, sorted_list_of_packages) else: