From 2f057d729da61e8c12828df44377f0a93fed820f Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Sat, 19 Nov 2022 04:16:01 -0600 Subject: py-scipy: add v1.9 (#31810) --- .../repos/builtin/packages/py-scipy/package.py | 155 ++++++++++++++++----- 1 file changed, 119 insertions(+), 36 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/py-scipy/package.py b/var/spack/repos/builtin/packages/py-scipy/package.py index f2ac3ae4b0..752e40976f 100644 --- a/var/spack/repos/builtin/packages/py-scipy/package.py +++ b/var/spack/repos/builtin/packages/py-scipy/package.py @@ -2,6 +2,10 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import glob +import os + from spack.package import * @@ -17,6 +21,10 @@ class PyScipy(PythonPackage): maintainers = ["adamjstewart", "rgommers"] version("master", branch="master") + version("1.9.3", sha256="fbc5c05c85c1a02be77b1ff591087c83bc44579c6d2bd9fb798bb64ea5e1a027") + version("1.9.2", sha256="99e7720caefb8bca6ebf05c7d96078ed202881f61e0c68bd9e0f3e8097d6f794") + version("1.9.1", sha256="26d28c468900e6d5fdb37d2812ab46db0ccd22c63baa095057871faa3a498bc9") + version("1.9.0", sha256="c0dfd7d2429452e7e94904c6a3af63cbaa3cf51b348bd9d35b42db7e9ad42791") version("1.8.1", sha256="9e3fb1b0e896f14a85aa9a28d5f755daaeeb54c897b746df7a55ccb02b340f33") version("1.8.0", sha256="31d4f2d6b724bc9a98e527b5849b8a7e589bf1ea630c33aa563eda912c9ff0bd") version("1.7.3", sha256="ab5875facfdef77e0a47d5fd39ea178b58e60e454a4c85aa1e52fcb80db7babf") @@ -49,47 +57,62 @@ class PyScipy(PythonPackage): version("0.15.1", sha256="a212cbc3b79e9a563aa45fc5c517b3499198bd7eb7e7be1e047568a5f48c259a") version("0.15.0", sha256="0c74e31e08acc8bf9b6ceb9bced73df2ae0cc76003e0366350bc7b26292bf8b1") - # pyproject.toml - depends_on("py-wheel@:0.37", type="build") - depends_on("py-setuptools", type="build") - depends_on("py-setuptools@:51.0.0", when="@1.6", type="build") - depends_on("py-setuptools@:57", when="@1.7", type="build") - depends_on("py-setuptools@:59", when="@1.8:", type="build") + # TODO: remove once pip build supports BLAS/LAPACK specification + # https://github.com/mesonbuild/meson-python/pull/167 + depends_on("py-build", when="@1.9:", type="build") + + depends_on("py-meson-python@0.9:", when="@1.9.2:", type="build") + depends_on("py-meson-python@0.8.1:", when="@1.9.1", type="build") + depends_on("py-meson-python@0.7", when="@1.9.0", type="build") + depends_on("meson@0.62.2", when="@1.9.0:1.9.1", type="build") + depends_on("py-cython@0.29.32:2", when="@1.9.2:", type="build") + depends_on("py-cython@0.29.21:2", when="@1.9:", type="build") depends_on("py-cython@0.29.18:2", when="@1.7:", type="build") - depends_on("py-pybind11@2.2.4:", when="@1.4.0", type=("build", "link")) - depends_on("py-pybind11@2.4.0:", when="@1.4.1:1.4", type=("build", "link")) - depends_on("py-pybind11@2.4.3:", when="@1.5:1.6.1", type=("build", "link")) - depends_on("py-pybind11@2.4.3:2.6", when="@1.6.2:1.7.1", type=("build", "link")) + depends_on("py-pybind11@2.4.3:2.10", when="@1.9.1:", type=("build", "link")) + depends_on("py-pybind11@2.4.3:2.9", when="@1.9.0", type=("build", "link")) + depends_on("py-pybind11@2.4.3:2.8", when="@1.8", type=("build", "link")) depends_on("py-pybind11@2.4.3:2.7", when="@1.7.2:1.7", type=("build", "link")) - depends_on("py-pybind11@2.4.3:2.8", when="@1.8:", type=("build", "link")) - depends_on("py-pythran@0.9.11", when="@1.7.0:1.7.1", type=("build", "link")) + depends_on("py-pybind11@2.4.3:2.6", when="@1.6.2:1.7.1", type=("build", "link")) + depends_on("py-pybind11@2.4.3:", when="@1.5:1.6.1", type=("build", "link")) + depends_on("py-pybind11@2.4.0:", when="@1.4.1:1.4", type=("build", "link")) + depends_on("py-pybind11@2.2.4:", when="@1.4.0", type=("build", "link")) + depends_on("py-pythran@0.9.12:0.12", when="@1.9.2:", type=("build", "link")) + depends_on("py-pythran@0.9.12:0.11", when="@1.9.0:1.9.1", type=("build", "link")) + depends_on("py-pythran@0.10", when="@1.8", type=("build", "link")) depends_on("py-pythran@0.9.12:0.9", when="@1.7.2:1.7", type=("build", "link")) - depends_on("py-pythran@0.10:", when="@1.8:", type=("build", "link")) - # setup.py - depends_on("py-numpy@1.5.1:+blas+lapack", when="@:0.15", type=("build", "link", "run")) - depends_on("py-numpy@1.6.2:+blas+lapack", when="@0.16:0.17", type=("build", "link", "run")) - depends_on("py-numpy@1.7.1:+blas+lapack", when="@0.18.0:0.18", type=("build", "link", "run")) - depends_on("py-numpy@1.8.2:+blas+lapack", when="@0.19:1.2", type=("build", "link", "run")) - depends_on("py-numpy@1.13.3:+blas+lapack", when="@1.3:1.4", type=("build", "link", "run")) - depends_on("py-numpy@1.14.5:+blas+lapack", when="@1.5.0:1.5", type=("build", "link", "run")) - depends_on("py-numpy@1.16.5:+blas+lapack", when="@1.6:1.6.1", type=("build", "link", "run")) + depends_on("py-pythran@0.9.11", when="@1.7.0:1.7.1", type=("build", "link")) + depends_on("py-wheel@:0.37", type="build") + depends_on("pkgconfig", when="@1.9:", type="build") + depends_on("py-setuptools", when="@:1.8", type="build") + depends_on("py-setuptools@:59", when="@1.8", type="build") + depends_on("py-setuptools@:57", when="@1.7", type="build") + depends_on("py-setuptools@:51.0.0", when="@1.6", type="build") + depends_on("py-numpy@1.18.5:1.25+blas+lapack", when="@1.9:", type=("build", "link", "run")) + depends_on("py-numpy@1.17.3:1.24+blas+lapack", when="@1.8", type=("build", "link", "run")) depends_on( "py-numpy@1.16.5:1.22+blas+lapack", when="@1.6.2:1.7", type=("build", "link", "run") ) - depends_on("py-numpy@1.17.3:1.24+blas+lapack", when="@1.8:", type=("build", "link", "run")) - depends_on("python@2.6:2.8,3.2:", when="@:0.17", type=("build", "link", "run")) - depends_on("python@2.7:2.8,3.4:", when="@0.18:1.2", type=("build", "link", "run")) - depends_on("python@3.5:", when="@1.3:1.4", type=("build", "link", "run")) - depends_on("python@3.6:", when="@1.5.0:1.5", type=("build", "link", "run")) - depends_on("python@3.7:", when="@1.6:1.6.1", type=("build", "link", "run")) - depends_on("python@3.7:3.9", when="@1.6.2:1.7.1", type=("build", "link", "run")) + depends_on("py-numpy@1.16.5:+blas+lapack", when="@1.6:1.6.1", type=("build", "link", "run")) + depends_on("py-numpy@1.14.5:+blas+lapack", when="@1.5.0:1.5", type=("build", "link", "run")) + depends_on("py-numpy@1.13.3:+blas+lapack", when="@1.3:1.4", type=("build", "link", "run")) + depends_on("py-numpy@1.8.2:+blas+lapack", when="@0.19:1.2", type=("build", "link", "run")) + depends_on("py-numpy@1.7.1:+blas+lapack", when="@0.18.0:0.18", type=("build", "link", "run")) + depends_on("py-numpy@1.6.2:+blas+lapack", when="@0.16:0.17", type=("build", "link", "run")) + depends_on("py-numpy@1.5.1:+blas+lapack", when="@:0.15", type=("build", "link", "run")) + depends_on("python@3.8:3.11", when="@1.9:", type=("build", "link", "run")) + depends_on("python@3.8:3.10", when="@1.8", type=("build", "link", "run")) depends_on("python@3.7:3.10", when="@1.7.2:1.7", type=("build", "link", "run")) - depends_on("python@3.8:3.10", when="@1.8:", type=("build", "link", "run")) + depends_on("python@3.7:3.9", when="@1.6.2:1.7.1", type=("build", "link", "run")) + depends_on("python@3.7:", when="@1.6:1.6.1", type=("build", "link", "run")) + depends_on("python@3.6:", when="@1.5.0:1.5", type=("build", "link", "run")) + depends_on("python@3.5:", when="@1.3:1.4", type=("build", "link", "run")) + depends_on("python@2.7:2.8,3.4:", when="@0.18:1.2", type=("build", "link", "run")) + depends_on("python@2.6:2.8,3.2:", when="@:0.17", type=("build", "link", "run")) depends_on("py-pytest", type="test") - # NOTE: scipy should use the same Blas/Lapack as numpy - # This is achieved by calling the set_blas_lapack() and setup_build_environment() - # from numpy in the scipy spec + # NOTE: scipy should use the same BLAS/LAPACK as numpy. + # For scipy 1.8 and older, this is achieved by calling the set_blas_lapack() + # and setup_build_environment() from numpy in the scipy spec. depends_on("blas") depends_on("lapack") # https://github.com/scipy/scipy/wiki/Dropping-support-for-Accelerate @@ -98,6 +121,16 @@ class PyScipy(PythonPackage): # https://github.com/scipy/scipy/pull/11324 conflicts("@1.4.0:1.4.1", when="target=ppc64le:") + # https://github.com/mesonbuild/meson/pull/10909#issuecomment-1282241479 + # Intel OneAPI ifx claims to support -fvisibility, but this does not work. + # Meson adds this flag for all Python extensions which include Fortran code. + conflicts("%oneapi", when="@1.9:") + + # FIXME: mysterious build issues with MKL + conflicts("^intel-mkl", when="@1.9:") + conflicts("^intel-oneapi-mkl", when="@1.9:") + conflicts("^intel-parallel-studio", when="@1.9:") + # https://github.com/scipy/scipy/issues/12860 patch( "https://git.sagemath.org/sage.git/plain/build/pkgs/scipy/patches/extern_decls.patch?id=711fe05025795e44b84233e065d240859ccae5bd", @@ -107,10 +140,15 @@ class PyScipy(PythonPackage): patch("scipy-clang.patch", when="@1.5.0:1.6.3 %clang") + @property + def archive_files(self): + return [join_path(self.stage.source_path, "build", "meson-logs", "meson-log.txt")] + @run_before("install") def set_blas_lapack(self): - # Pick up Blas/Lapack from numpy - self.spec["py-numpy"].package.set_blas_lapack() + # Pick up BLAS/LAPACK from numpy + if self.spec.satisfies("@:1.8"): + self.spec["py-numpy"].package.set_blas_lapack() @run_before("install") def set_fortran_compiler(self): @@ -143,8 +181,53 @@ class PyScipy(PythonPackage): if self.spec["py-pythran"].version < Version("0.12"): env.set("SCIPY_USE_PYTHRAN", "0") - # Pick up Blas/Lapack from numpy - self.spec["py-numpy"].package.setup_build_environment(env) + # Pick up BLAS/LAPACK from numpy + if self.spec.satisfies("@:1.8"): + self.spec["py-numpy"].package.setup_build_environment(env) + + # TODO: remove once pip build supports BLAS/LAPACK specification + # https://github.com/mesonbuild/meson-python/pull/167 + @when("@1.9:") + def install(self, spec, prefix): + blas = spec["blas"].libs.names[0] + lapack = spec["lapack"].libs.names[0] + # FIXME: MKL support doesn't work, why? + if ( + spec["blas"].name == "intel-mkl" + or spec["blas"].name == "intel-parallel-studio" + or spec["blas"].name == "intel-oneapi-mkl" + ): + blas = "mkl-dynamic-lp64-seq" + if ( + spec["lapack"].name == "intel-mkl" + or spec["lapack"].name == "intel-parallel-studio" + or spec["lapack"].name == "intel-oneapi-mkl" + ): + lapack = "mkl-dynamic-lp64-seq" + + args = [ + "setup", + "build", + "-Dblas=" + blas, + "-Dlapack=" + lapack, + "--prefix=" + join_path(os.getcwd(), "build-install"), + "-Ddebug=false", + "-Doptimization=2", + ] + meson = which("meson") + meson(*args) + args = [ + "-m", + "build", + "--wheel", + "-Cbuilddir=build", + "--no-isolation", + "--skip-dependency-check", + ".", + ] + python(*args) + args = std_pip_args + ["--prefix=" + prefix, glob.glob(join_path("dist", "scipy*.whl"))[0]] + pip(*args) @run_after("install") @on_package_attributes(run_tests=True) -- cgit v1.2.3-70-g09d2