py-numpy package: enable build on Windows (#43686)

* Add conflicts for some blas implementations that don't build on
  Windows (or with %msvc)
* Need to enclose CC/CXX variables in quotes in case those paths
  have spaces, otherwise Meson runs into errors
* On Windows, Python dependencies now add <prefix>/Scripts to the
  PATH (this is established as a standard in PEP 370)
This commit is contained in:
James Smillie 2024-04-18 16:38:08 -06:00 committed by GitHub
parent 6fba31ce34
commit faed43704b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 22 additions and 3 deletions

View file

@ -319,6 +319,8 @@ class ArmplGcc(Package):
conflicts("%gcc@:7", when="@22.0.1_gcc-8.2")
conflicts("%gcc@:6", when="@22.0.1_gcc-7.5")
conflicts("%msvc", msg="Not compatible with MSVC compiler.")
variant("ilp64", default=False, description="use ilp64 specific Armpl library")
variant("shared", default=True, description="enable shared libs")
variant(

View file

@ -61,6 +61,12 @@ class Atlas(Package):
description="Number of threads to tune to, " "-1 for autodetect, 0 for no threading",
)
conflicts(
"platform=windows",
msg="Atlas requires cygwin to build on Windows, which is unsupported by Spack. "
"See https://math-atlas.sourceforge.net/atlas_install/node55.html",
)
provides("blas")
provides("lapack")
provides("lapack@3.6.1")

View file

@ -25,6 +25,9 @@ class CrayLibsci(Package):
version("16.06.1")
version("16.03.1")
conflicts("platform=windows")
conflicts("platform=darwin")
variant("shared", default=True, description="enable shared libs")
variant("openmp", default=False, description="link with openmp")
variant("mpi", default=False, description="link with mpi libs")

View file

@ -2,8 +2,6 @@
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *

View file

@ -394,9 +394,14 @@ def set_blas_lapack(self):
@when("@1.26:")
def setup_build_environment(self, env):
# https://github.com/scipy/scipy/issues/19357
if self.spec.satisfies("%apple-clang@15:"):
# https://github.com/scipy/scipy/issues/19357
env.append_flags("LDFLAGS", "-Wl,-ld_classic")
elif self.spec.satisfies("%msvc"):
# For meson build system, compiler paths must be in quotes
# to prevent paths from being split by spaces.
env.set("CC", f'"{self.compiler.cc}"')
env.set("CXX", f'"{self.compiler.cxx}"')
@when("@:1.25")
def setup_build_environment(self, env):

View file

@ -1191,6 +1191,11 @@ def setup_dependent_build_environment(self, env, dependent_spec):
for directory in {self.platlib, self.purelib}:
env.prepend_path("PYTHONPATH", os.path.join(prefix, directory))
if self.spec.satisfies("platform=windows"):
prefix_scripts_dir = prefix.Scripts
if os.path.exists(prefix_scripts_dir):
env.prepend_path("PATH", prefix_scripts_dir)
# We need to make sure that the extensions are compiled and linked with
# the Spack wrapper. Paths to the executables that are used for these
# operations are normally taken from the sysconfigdata file, which we