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:
		| @@ -319,6 +319,8 @@ class ArmplGcc(Package): | |||||||
|     conflicts("%gcc@:7", when="@22.0.1_gcc-8.2") |     conflicts("%gcc@:7", when="@22.0.1_gcc-8.2") | ||||||
|     conflicts("%gcc@:6", when="@22.0.1_gcc-7.5") |     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("ilp64", default=False, description="use ilp64 specific Armpl library") | ||||||
|     variant("shared", default=True, description="enable shared libs") |     variant("shared", default=True, description="enable shared libs") | ||||||
|     variant( |     variant( | ||||||
|   | |||||||
| @@ -61,6 +61,12 @@ class Atlas(Package): | |||||||
|         description="Number of threads to tune to, " "-1 for autodetect, 0 for no threading", |         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("blas") | ||||||
|     provides("lapack") |     provides("lapack") | ||||||
|     provides("lapack@3.6.1") |     provides("lapack@3.6.1") | ||||||
|   | |||||||
| @@ -25,6 +25,9 @@ class CrayLibsci(Package): | |||||||
|     version("16.06.1") |     version("16.06.1") | ||||||
|     version("16.03.1") |     version("16.03.1") | ||||||
| 
 | 
 | ||||||
|  |     conflicts("platform=windows") | ||||||
|  |     conflicts("platform=darwin") | ||||||
|  | 
 | ||||||
|     variant("shared", default=True, description="enable shared libs") |     variant("shared", default=True, description="enable shared libs") | ||||||
|     variant("openmp", default=False, description="link with openmp") |     variant("openmp", default=False, description="link with openmp") | ||||||
|     variant("mpi", default=False, description="link with mpi libs") |     variant("mpi", default=False, description="link with mpi libs") | ||||||
|   | |||||||
| @@ -2,8 +2,6 @@ | |||||||
| # Spack Project Developers. See the top-level COPYRIGHT file for details. | # Spack Project Developers. See the top-level COPYRIGHT file for details. | ||||||
| # | # | ||||||
| # SPDX-License-Identifier: (Apache-2.0 OR MIT) | # SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| from spack.package import * | from spack.package import * | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|   | |||||||
| @@ -394,9 +394,14 @@ def set_blas_lapack(self): | |||||||
| 
 | 
 | ||||||
|     @when("@1.26:") |     @when("@1.26:") | ||||||
|     def setup_build_environment(self, env): |     def setup_build_environment(self, env): | ||||||
|         # https://github.com/scipy/scipy/issues/19357 |  | ||||||
|         if self.spec.satisfies("%apple-clang@15:"): |         if self.spec.satisfies("%apple-clang@15:"): | ||||||
|  |             # https://github.com/scipy/scipy/issues/19357 | ||||||
|             env.append_flags("LDFLAGS", "-Wl,-ld_classic") |             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") |     @when("@:1.25") | ||||||
|     def setup_build_environment(self, env): |     def setup_build_environment(self, env): | ||||||
|   | |||||||
| @@ -1191,6 +1191,11 @@ def setup_dependent_build_environment(self, env, dependent_spec): | |||||||
|             for directory in {self.platlib, self.purelib}: |             for directory in {self.platlib, self.purelib}: | ||||||
|                 env.prepend_path("PYTHONPATH", os.path.join(prefix, directory)) |                 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 |         # 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 |         # the Spack wrapper. Paths to the executables that are used for these | ||||||
|         # operations are normally taken from the sysconfigdata file, which we |         # operations are normally taken from the sysconfigdata file, which we | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 James Smillie
					James Smillie