From d276a5f8e442bed61d01d9dd28572768d1e34301 Mon Sep 17 00:00:00 2001 From: Glenn Johnson Date: Tue, 17 Jan 2023 00:00:41 -0600 Subject: py-macs2: add version 2.2.7.1 and support python@3.10: (#34970) * py-macs2: add version 2.2.7.1 and support python@3.10: The tarball from PyPi includes the Cythonized C files. The tarball from github does not. Remove the Cythonized C files from the source so that they are rebuilt with the Spack Python/Cython combination. This is necessary for python-3.10 but make sense for other combinations as well. * Edits based on review - set python version constraint on version 2.2.4 - removed all python-2 versions and related constraints. --- .../repos/builtin/packages/py-macs2/package.py | 24 +++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/py-macs2/package.py b/var/spack/repos/builtin/packages/py-macs2/package.py index 479dbca4d1..d4ddc9e12f 100644 --- a/var/spack/repos/builtin/packages/py-macs2/package.py +++ b/var/spack/repos/builtin/packages/py-macs2/package.py @@ -4,6 +4,8 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import glob + from spack.package import * @@ -13,13 +15,29 @@ class PyMacs2(PythonPackage): homepage = "https://github.com/taoliu/MACS" pypi = "MACS2/MACS2-2.2.4.tar.gz" + version("2.2.7.1", sha256="ad2ca69bdd02a8942a68aae23133289b5c16ba382bcbe20c39fabf3948929de5") version("2.2.4", sha256="b131aadc8f5fd94bec35308b821e1f7585def788d2e7c756fc8cac402ffee25b") - depends_on("python@3.5:", type=("build", "run")) + # patch to correctly identify python-3.10 as greater than required version + patch( + "https://github.com/macs3-project/MACS/pull/497.patch?full_index=1", + sha256="eaff891b9b3c6a910bd5d454dcc6e21288c8d1ad4d6d6f77e370bc8f90921cbd", + when="@2.2.7.1^python@3.10:", + ) + + depends_on("python@3.6:", when="@2.2.7.1:", type=("build", "run")) + # version 2.2.4 does not build with python-3.10 + depends_on("python@3.5:3.9", when="@2.2.4", type=("build", "run")) depends_on("py-cython", type="build") # Most Python packages only require py-setuptools as a build dependency. # However, py-macs2 requires py-setuptools during runtime as well. depends_on("py-setuptools", type=("build", "run")) - depends_on("py-numpy@1.17:", type=("build", "run")) - depends_on("py-numpy@1.16:", type=("build", "run")) + depends_on("py-setuptools@41.2:", when="@2.2.4:", type=("build", "run")) + depends_on("py-numpy@1.17:", when="@2.2.4:", type=("build", "run")) + depends_on("py-cython@0.29:", when="@2.2.4:", type="build") + + def patch(self): + # regenerate C files from pyx files with cython + files = glob.glob("MACS2/**/[!c]*.c", recursive=True) + force_remove(*files) -- cgit v1.2.3-70-g09d2