summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Christofi <77968333+ChristopherChristofi@users.noreply.github.com>2024-05-09 19:48:40 +0100
committerGitHub <noreply@github.com>2024-05-09 12:48:40 -0600
commit3381899c6903d8cbc01f6c8bda5d34606f890af5 (patch)
tree06ad1c62c84cc626f7980660fb8b8bcff176a85d
parentc7cf5eabc1fc7fae57719d294de21b418854124d (diff)
downloadspack-3381899c6903d8cbc01f6c8bda5d34606f890af5.tar.gz
spack-3381899c6903d8cbc01f6c8bda5d34606f890af5.tar.bz2
spack-3381899c6903d8cbc01f6c8bda5d34606f890af5.tar.xz
spack-3381899c6903d8cbc01f6c8bda5d34606f890af5.zip
miniforge3: add new versions with mamba installation (#43995)
* miniforge3: add new version with mamba installation * fix styling * update maintainers * Fix variant directive ordering
-rw-r--r--var/spack/repos/builtin/packages/miniforge3/package.py91
1 files changed, 52 insertions, 39 deletions
diff --git a/var/spack/repos/builtin/packages/miniforge3/package.py b/var/spack/repos/builtin/packages/miniforge3/package.py
index d1b22e4f9e..f690742aca 100644
--- a/var/spack/repos/builtin/packages/miniforge3/package.py
+++ b/var/spack/repos/builtin/packages/miniforge3/package.py
@@ -3,50 +3,63 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+import platform
+from os.path import split
+
from spack.package import *
+from spack.util.environment import EnvironmentModifications
+
+_versions = {
+ "24.3.0-0": {
+ "Linux-x86_64": ("23367676b610de826f50f7ddc91139a816d4b59bd4c69cc9b6082d9b2e7fe8a3",)
+ },
+ "24.1.2-0": {
+ "Linux-x86_64": ("dbadb808edf4da00af35d888d3eeebbfdce71972b60bf4b16dbacaee2ab57f28",)
+ },
+ "4.8.3-4": {
+ "Linux-x86_64": ("24951262a126582f5f2e1cf82c9cd0fa20e936ef3309fdb8397175f29e647646",),
+ "Linux-aarch64": ("52a8dde14ecfb633800a2de26543a78315058e30f5883701da1ad2f2d5ba9ed8",),
+ },
+ "4.8.3-2": {
+ "Linux-x86_64": ("c8e5b894fe91ce0f86e61065d2247346af107f8d53de0ad89ec848701c4ec1f9",),
+ "Linux-aarch64": ("bfefc0ede6354568978b4198607edd7f17c2f50ca4c6a47e9f22f8c257c8230a",),
+ "MacOSX-x86_64": ("25ca082ab00a776db356f9bbc660edf6d24659e2aec1cbec5fd4ce992d4d193d"),
+ },
+}
class Miniforge3(Package):
- """Miniforge3 is a minimal installer for conda specific to conda-forge."""
+ """Miniforge3 is a minimal installer for conda and mamba specific to conda-forge."""
homepage = "https://github.com/conda-forge/miniforge"
- url = "https://github.com/conda-forge/miniforge/releases/download/4.8.3-2/Miniforge3-4.8.3-2-Linux-x86_64.sh"
-
- version(
- "4.8.3-4-Linux-x86_64",
- url="https://github.com/conda-forge/miniforge/releases/download/4.8.3-4/Miniforge3-4.8.3-4-Linux-x86_64.sh",
- sha256="24951262a126582f5f2e1cf82c9cd0fa20e936ef3309fdb8397175f29e647646",
- expand=False,
- )
- version(
- "4.8.3-4-Linux-aarch64",
- url="https://github.com/conda-forge/miniforge/releases/download/4.8.3-4/Miniforge3-4.8.3-4-Linux-aarch64.sh",
- sha256="52a8dde14ecfb633800a2de26543a78315058e30f5883701da1ad2f2d5ba9ed8",
- expand=False,
- )
- version(
- "4.8.3-2-Linux-x86_64",
- url="https://github.com/conda-forge/miniforge/releases/download/4.8.3-2/Miniforge3-4.8.3-2-Linux-x86_64.sh",
- sha256="c8e5b894fe91ce0f86e61065d2247346af107f8d53de0ad89ec848701c4ec1f9",
- expand=False,
- )
- version(
- "4.8.3-2-Linux-aarch64",
- url="https://github.com/conda-forge/miniforge/releases/download/4.8.3-2/Miniforge3-4.8.3-2-Linux-aarch64.sh",
- sha256="bfefc0ede6354568978b4198607edd7f17c2f50ca4c6a47e9f22f8c257c8230a",
- expand=False,
- )
- version(
- "4.8.3-2-MacOSX-x86_64",
- url="https://github.com/conda-forge/miniforge/releases/download/4.8.3-2/Miniforge3-4.8.3-2-MacOSX-x86_64.sh",
- sha256="25ca082ab00a776db356f9bbc660edf6d24659e2aec1cbec5fd4ce992d4d193d",
- expand=False,
- )
+
+ maintainers("ChristopherChristofi")
+
+ license("BSD-3-Clause")
+
+ for ver, packages in _versions.items():
+ key = f"{platform.system()}-{platform.machine()}"
+ pkg = packages.get(key)
+ if pkg:
+ version(ver, sha256=pkg[0], expand=False)
+
+ variant("mamba", default=True, description="Enable mamba support.")
+
+ conflicts("+mamba", when="@:22.3.1-0")
+
+ def url_for_version(self, version):
+ script = f"Miniforge3-{version}-{platform.system()}-{platform.machine()}.sh"
+ return f"https://github.com/conda-forge/miniforge/releases/download/{version}/{script}"
def install(self, spec, prefix):
- mkdirp(prefix)
- pkgname = "Miniforge3-{0}.sh".format(self.version)
- chmod = which("chmod")
- chmod("+x", pkgname)
- sh = which("sh")
- sh("./{0}".format(pkgname), "-b", "-f", "-s", "-p", prefix)
+ dir, script = split(self.stage.archive_file)
+ bash = which("bash")
+ bash(script, "-b", "-f", "-p", self.prefix)
+
+ def setup_run_environment(self, env):
+ filename = self.prefix.etc.join("profile.d").join("conda.sh")
+ env.extend(EnvironmentModifications.from_sourcing_file(filename))
+
+ if "+mamba" in self.spec:
+ filename = self.prefix.etc.join("profile.d").join("mamba.sh")
+ env.extend(EnvironmentModifications.from_sourcing_file(filename))