|
| 1 | +# Copyright Spack Project Developers. See COPYRIGHT file for details. |
| 2 | +# |
| 3 | +# SPDX-License-Identifier: (Apache-2.0 OR MIT) |
| 4 | + |
| 5 | +import platform |
| 6 | + |
| 7 | +from spack_repo.builtin.build_systems.generic import Package |
| 8 | + |
| 9 | +from spack.package import * |
| 10 | + |
| 11 | +# Declaring versions depending on architecture |
| 12 | +_versions = { |
| 13 | + "2025.1.0": { |
| 14 | + "x86_64": ( |
| 15 | + "e28f4c3ad8f15aaf455b46d6c46f6451fa8aef51ffee134bb766f98570941c8c", |
| 16 | + "https://www.maqao.org/maqao_archive/maqao.x86_64.2025.1.0.tar.xz", |
| 17 | + ), |
| 18 | + "aarch64": ( |
| 19 | + "993d610a3625c7ff605233a388981d87a2f42741a900c29e5de1e47ae69e5b67", |
| 20 | + "https://www.maqao.org/maqao_archive/maqao.aarch64.2025.1.0.tar.xz", |
| 21 | + ), |
| 22 | + } |
| 23 | +} |
| 24 | + |
| 25 | + |
| 26 | +class Maqao(Package): |
| 27 | + """MAQAO performance analysis framework""" |
| 28 | + |
| 29 | + homepage = "https://www.maqao.org" |
| 30 | + |
| 31 | + maintainers("cvalensi") |
| 32 | + |
| 33 | + license("LGPL-2.1-or-later", checked_by="cvalensi") |
| 34 | + |
| 35 | + # Loading version corresponding to the architecture |
| 36 | + for ver, package in _versions.items(): |
| 37 | + archpack = package.get(f"{platform.machine()}") |
| 38 | + if archpack: |
| 39 | + version(ver, sha256=archpack[0], url=archpack[1], extension="tar.xz") |
| 40 | + |
| 41 | + def install(self, spec, prefix): |
| 42 | + # Checking platform is Linux |
| 43 | + if spec.platform != "linux": |
| 44 | + raise InstallError( |
| 45 | + "Unsupported platform: {0}. Supported platforms: linux".format(spec.platform) |
| 46 | + ) |
| 47 | + # Checking architecture is either x86_64 or aarch64 |
| 48 | + arch = spec.target.family |
| 49 | + if arch not in ["x86_64", "aarch64"]: |
| 50 | + raise InstallError( |
| 51 | + "Unsupported architecture: {0}. Supported architectures: x86_64, aarch64".format( |
| 52 | + arch |
| 53 | + ) |
| 54 | + ) |
| 55 | + # Installing from archive |
| 56 | + tar = which("tar") |
| 57 | + tar("xJf", self.stage.archive_file) |
| 58 | + install_tree(".", prefix) |
0 commit comments