From 837000557001e37b99d4b19ded1ec163e9f1f9e5 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Mon, 8 May 2023 21:29:27 +1100 Subject: [PATCH] hard-reset scipy source directory for recompilation on windows --- recipe/bld.bat | 9 +++++++++ recipe/build-output.bat | 17 +++++++++++------ recipe/build-output.sh | 3 +++ recipe/build.sh | 3 +++ recipe/meta.yaml | 12 +++++++----- 5 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 recipe/bld.bat diff --git a/recipe/bld.bat b/recipe/bld.bat new file mode 100644 index 00000000..7d4e4fb4 --- /dev/null +++ b/recipe/bld.bat @@ -0,0 +1,9 @@ +@echo on +setlocal enabledelayedexpansion + +:: copy %SRC_DIR%/base somewhere to be able to hard-reset state in build-output.bat +mkdir .\backup +robocopy base backup /E >nul +:: for whatever reason, robocopy returns 1 in case of success, see +:: https://learn.microsoft.com/en-us/troubleshoot/windows-server/backup-and-storage/return-codes-used-robocopy-utility +if %ERRORLEVEL% neq 1 exit 1 diff --git a/recipe/build-output.bat b/recipe/build-output.bat index 43db51ea..ee5567b4 100644 --- a/recipe/build-output.bat +++ b/recipe/build-output.bat @@ -1,6 +1,9 @@ @echo on setlocal enabledelayedexpansion +:: for reason see source section in meta.yaml & below +cd base + REM these are done automatically for openblas by numpy.distutils, but REM not for our blas libraries echo %LIBRARY_LIB%\blas.lib > %LIBRARY_LIB%\blas.fobjects @@ -38,8 +41,8 @@ REM TODO: rewrite wrap_g77_abi.f with iso_c_binding when the compiler supports i cl.exe /I%NP_INC% /I%PY_INC% scipy\_build_utils\src\wrap_g77_abi_c.c -c /MD if %ERRORLEVEL% neq 0 exit 1 echo. > scipy\_build_utils\src\wrap_g77_abi_c.c -echo %SRC_DIR%\wrap_g77_abi_c.obj >> %LIBRARY_LIB%\lapack.fobjects -echo %SRC_DIR%\wrap_g77_abi_c.obj >> %LIBRARY_LIB%\lapack.cobjects +echo %SRC_DIR%\base\wrap_g77_abi_c.obj >> %LIBRARY_LIB%\lapack.fobjects +echo %SRC_DIR%\base\wrap_g77_abi_c.obj >> %LIBRARY_LIB%\lapack.cobjects REM Add a file to load the fortran wrapper libraries in scipy/.libs del scipy\_distributor_init.py @@ -79,8 +82,10 @@ if "%PKG_NAME%"=="scipy" ( set "g=%%f" rmdir /s /q %SP_DIR%\scipy\!g:/=\! ) -) -:: clean up between invocations -rmdir /s /q build -del wrap_g77_abi_c.obj + REM hard-reset %SRC_DIR%\base to original state; see prep in bld.bat + cd .. + rmdir /s /q base + REM `move` can spuriously fail with "Access Denied"; use `robocopy /MOVE` instead + robocopy backup base /E /MOVE >nul +) diff --git a/recipe/build-output.sh b/recipe/build-output.sh index 79ef0625..21b24834 100644 --- a/recipe/build-output.sh +++ b/recipe/build-output.sh @@ -1,6 +1,9 @@ #!/bin/bash set -ex +# for reason see source section in meta.yaml +cd base + # Set a few environment variables that are not set due to # https://github.com/conda/conda-build/issues/3993 export PIP_NO_BUILD_ISOLATION=True diff --git a/recipe/build.sh b/recipe/build.sh index 6c8882dd..4b39b15b 100644 --- a/recipe/build.sh +++ b/recipe/build.sh @@ -1,6 +1,9 @@ #!/bin/bash set -ex +# for reason see source section in meta.yaml +cd base + mkdir builddir # HACK: extend $CONDA_PREFIX/meson_cross_file that's created in diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 35d4181e..3e5d5e37 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -14,6 +14,8 @@ source: # the submodules (not in tarball due to dear-github/dear-github#214) - url: https://github.com/scipy/scipy/archive/refs/tags/v{{ version }}.tar.gz sha256: 8f08e1742c9b09eb58640fa5a56031d6e1844806899e883fbe7447ca86fe8c55 + # need separate folder to do full reset on windows, see build-output.bat + folder: base patches: # backport https://github.com/scipy/scipy/pull/18006 - patches/0001-BLD-use-a-relative-path-to-numpy-pybind11-pythran-in.patch @@ -32,17 +34,17 @@ source: # https://github.com/scipy/scipy/tree/v{{ version }}/scipy/_lib - git_url: https://github.com/scipy/boost-headers-only.git git_rev: 3af99e6d566043072e95bc882d32c9c26f37e0ba - folder: scipy/_lib/boost + folder: base/scipy/_lib/boost - git_url: https://github.com/scipy/highs.git git_rev: 4a122958a82e67e725d08153e099efe4dad099a2 - folder: scipy/_lib/highs + folder: base/scipy/_lib/highs - git_url: https://github.com/scipy/unuran.git git_rev: a63d39160e5ecc4402e7ed0e8417f4c3ff9634cb - folder: scipy/_lib/unuran + folder: base/scipy/_lib/unuran # https://github.com/scipy/scipy/tree/v{{ version }}/scipy/sparse/linalg/_propack - git_url: https://github.com/scipy/PROPACK.git git_rev: cc32f3ba6cf941e4f9f96d96e2fc5762ea0c1014 - folder: scipy/sparse/linalg/_propack/PROPACK + folder: base/scipy/sparse/linalg/_propack/PROPACK build: number: 2 @@ -266,7 +268,7 @@ outputs: about: home: http://www.scipy.org/ license: BSD-3-Clause - license_file: LICENSE.txt + license_file: base/LICENSE.txt summary: Scientific Library for Python description: | SciPy is a Python-based ecosystem of open-source software for mathematics,