Unverified Commit 85ad2a0a authored by Nicola Soranzo's avatar Nicola Soranzo
Browse files

Merge branch 'release_21.01' into release_21.05

parents 8069584d cc0d8119
Loading
Loading
Loading
Loading
+18 −43
Original line number Diff line number Diff line
@@ -26,12 +26,10 @@ SHELL_UNSAFE_PATTERN = re.compile(r"[\s\"']")

IS_OS_X = sys.platform == "darwin"

# BSD 3-clause
CONDA_LICENSE = "http://docs.continuum.io/anaconda/eula"
VERSIONED_ENV_DIR_NAME = re.compile(r"__(.*)@(.*)")
UNVERSIONED_ENV_DIR_NAME = re.compile(r"__(.*)@_uv_")
USE_PATH_EXEC_DEFAULT = False
CONDA_VERSION = "4.6.14"
CONDA_PACKAGE_SPECS = ("conda=4.6.14", "'pyopenssl>=22.1.0'")
CONDA_BUILD_VERSION = "3.17.8"
USE_LOCAL_DEFAULT = False

@@ -105,7 +103,6 @@ class CondaContext(installable.InstallableContext):
            ensure_channels = None
        self.ensure_channels = ensure_channels
        self._conda_version = None
        self._miniconda_version = None
        self._conda_build_available = None
        self.use_local = use_local

@@ -122,35 +119,16 @@ class CondaContext(installable.InstallableContext):
        return self._conda_build_available

    def _guess_conda_properties(self):
        conda_meta_path = self._conda_meta_path
        # Perhaps we should call "conda info --json" and parse it but for now we are going
        # to assume the default.
        conda_version = packaging.version.parse(CONDA_VERSION)
        conda_build_available = False
        miniconda_version = "3"

        if os.path.exists(conda_meta_path):
            for package in os.listdir(conda_meta_path):
                package_parts = package.split("-")
                if len(package_parts) < 3:
                    continue
                package = '-'.join(package_parts[:-2])
                version = package_parts[-2]
                # build = package_parts[-1]
                if package == "conda":
                    conda_version = packaging.version.parse(version)
                if package == "python" and version.startswith("2"):
                    miniconda_version = "2"
                if package == "conda-build":
                    conda_build_available = True

        self._conda_version = conda_version
        self._miniconda_version = miniconda_version
        self._conda_build_available = conda_build_available

    @property
    def _conda_meta_path(self):
        return os.path.join(self.conda_prefix, "conda-meta")
        info = self.conda_info()
        self._conda_version = packaging.version.parse(info["conda_version"])
        self._conda_build_available = False
        conda_build_version = info.get("conda_build_version")
        if conda_build_version != "not installed":
            try:
                self._conda_version = packaging.version.parse(conda_build_version)
                self._conda_build_available = True
            except Exception:
                pass

    @property
    def _override_channels_args(self):
@@ -248,10 +226,9 @@ class CondaContext(installable.InstallableContext):
        """
        Return the process exit code (i.e. 0 in case of success).
        """
        create_args = [
            "-y",
            "--quiet"
        ]
        create_args = ["-y", "--quiet"]
        if self.conda_version >= packaging.version.parse("4.7.5"):
            create_args.append("--strict-channel-priority")
        if allow_local and self.use_local:
            create_args.extend(["--use-local"])
        create_args.extend(self._override_channels_args)
@@ -275,9 +252,9 @@ class CondaContext(installable.InstallableContext):
        """
        Return the process exit code (i.e. 0 in case of success).
        """
        install_args = [
            "-y"
        ]
        install_args = ["-y"]
        if self.conda_version >= packaging.version.parse("4.7.5"):
            install_args.append("--strict-channel-priority")
        if allow_local and self.use_local:
            install_args.append("--use-local")
        install_args.extend(self._override_channels_args)
@@ -432,9 +409,7 @@ def install_conda(conda_context, force_conda_build=False):
        script_path = temp.name
    download_cmd = commands.download_command(conda_link(), to=script_path)
    install_cmd = ['bash', script_path, '-b', '-p', conda_context.conda_prefix]
    package_targets = [
        "conda=%s" % CONDA_VERSION,
    ]
    package_targets = list(CONDA_PACKAGE_SPECS)
    if force_conda_build or conda_context.use_local:
        package_targets.append("conda-build=%s" % CONDA_BUILD_VERSION)
    log.info("Installing conda, this may take several minutes.")