Update base user environment to mambaforge 22.11.1-4

shift some duplicated code into utility functions and constants
This commit is contained in:
Min RK
2023-03-21 14:21:00 +01:00
parent fcf6164e31
commit 1a3c48a500
4 changed files with 120 additions and 54 deletions

View File

@@ -2,6 +2,7 @@
Test conda commandline wrappers
"""
from tljh import conda
from tljh import installer
import os
import pytest
import subprocess
@@ -13,25 +14,20 @@ def prefix():
"""
Provide a temporary directory with a mambaforge conda environment
"""
# see https://github.com/conda-forge/miniforge/releases
mambaforge_version = "4.10.3-7"
if os.uname().machine == "aarch64":
installer_sha256 = (
"ac95f137b287b3408e4f67f07a284357b1119ee157373b788b34e770ef2392b2"
)
elif os.uname().machine == "x86_64":
installer_sha256 = (
"fc872522ec427fcab10167a93e802efaf251024b58cc27b084b915a9a73c4474"
)
installer_url = "https://github.com/conda-forge/miniforge/releases/download/{v}/Mambaforge-{v}-Linux-{arch}.sh".format(
v=mambaforge_version, arch=os.uname().machine
)
machine = os.uname().machine
installer_url, checksum = installer._mambaforge_url()
with tempfile.TemporaryDirectory() as tmpdir:
with conda.download_miniconda_installer(
installer_url, installer_sha256
installer_url, checksum
) as installer_path:
conda.install_miniconda(installer_path, tmpdir)
conda.ensure_conda_packages(tmpdir, ["conda==4.10.3"])
conda.ensure_conda_packages(
tmpdir,
[
f"conda=={installer.MAMBAFORGE_CONDA_VERSION}",
f"mamba=={installer.MAMBAFORGE_MAMBA_VERSION}",
],
)
yield tmpdir