@@ -118,20 +118,23 @@ if errorlevel 1 exit /b 1
118118
119119echo Build complete. Returning to Batch.
120120
121+ cd ../..
121122if " %if_bits% " == " 32" (
122123 echo Rewrite to scipy_openblas32
123- cd ../..
124124 set out_pyproject = pyproject_64_32.toml
125125 powershell -Command " (Get-Content 'pyproject.toml') -replace 'openblas64', 'openblas32' | Set-Content !out_pyproject! "
126- powershell -Command " (Get-Content 'local\scipy_openblas32\__main__.py') -replace 'openblas64', 'openblas32' | Out-File 'local\scipy_openblas32\__main__.py' -Encoding utf8"
127- powershell -Command " (Get-Content 'local\scipy_openblas32\__init__.py') -replace 'openblas64', 'openblas32' | Out-File 'local\scipy_openblas32\__init__.py' -Encoding utf8"
128- powershell -Command " (Get-Content 'local\scipy_openblas32\__init__.py') -replace 'openblas_get_config64_', 'openblas_get_config' | Out-File 'local\scipy_openblas32\__init__.py' -Encoding utf8"
129- powershell -Command " (Get-Content 'local\scipy_openblas32\__init__.py') -replace 'cflags =.*', 'cflags = \" -DBLAS_SYMBOL_PREFIX=scipy_\" ' | Out-File 'local\scipy_openblas32\__init__.py' -Encoding utf8"
126+ cd local
127+ move scipy_openblas64 scipy_openblas32
128+ powershell -Command " (Get-Content 'scipy_openblas32\__main__.py') -replace 'openblas64', 'openblas32' | Out-File 'scipy_openblas32\__main__.py' -Encoding utf8"
129+ powershell -Command " (Get-Content 'scipy_openblas32\__init__.py') -replace 'openblas64', 'openblas32' | Out-File 'scipy_openblas32\__init__.py' -Encoding utf8"
130+ powershell -Command " (Get-Content 'scipy_openblas32\__init__.py') -replace 'openblas_get_config64_', 'openblas_get_config' | Out-File 'scipy_openblas32\__init__.py' -Encoding utf8"
131+ powershell -Command " (Get-Content 'scipy_openblas32\__init__.py') -replace 'cflags =.*', 'cflags = \" -DBLAS_SYMBOL_PREFIX=scipy_\" ' | Out-File 'local\scipy_openblas32\__init__.py' -Encoding utf8"
132+ cd ..
130133)
131134
132135:: Prepare destination directory
133136cd OpenBLAS/build
134- echo Preparing destination directory at %DEST_DIR% ...
137+ echo Preparing destination directory at %DEST_DIR%
135138if not exist " %DEST_DIR% \lib\cmake\OpenBLAS" mkdir " %DEST_DIR% \lib\cmake\OpenBLAS"
136139if not exist " %DEST_DIR% \include" mkdir " %DEST_DIR% \include"
137140
@@ -167,12 +170,34 @@ if exist openblas_config.h copy /Y openblas_config.h "%DEST_DIR%\include\"
167170echo Copying LAPACKE header files...
168171xcopy /Y " ..\lapack-netlib\lapacke\include\*.h" " %DEST_DIR% \include\"
169172if errorlevel 1 exit /b 1
170-
173+
174+ echo Create pkgconfig scipy-openblas.pc
175+ cd ../../local
176+ if errorlevel 1 (
177+ echo Current directory %CD% , cannot cd ../../local
178+ exit /b 1
179+ )
180+ if " %if_bits% " == " 32" (
181+ mkdir scipy_openblas32\lib\pkgconfig
182+ python -c " import scipy_openblas32 as s; print(s.get_pkg_config(use_prefix=True))" > scipy_openblas32/lib/pkgconfig/scipy-openblas.pc
183+ ) else (
184+ mkdir scipy_openblas64\lib\pkgconfig
185+ python -c " import scipy_openblas64 as s; print(s.get_pkg_config(use_prefix=True))" > scipy_openblas64/lib/pkgconfig/scipy-openblas.pc
186+ )
187+ if errorlevel 1 (
188+ echo could not construct scipy-openblas.pc
189+ exit /b 1
190+ )
191+
171192:: Move back to the root directory
172- cd ../..
193+ cd ..
194+ if errorlevel 1 (
195+ echo Current directory %CD% , cannot cd ..
196+ exit /b 1
197+ )
173198
174199:: Build the Wheel & Install It
175- echo Running 'python -m build' to build the wheel...
200+ echo Running 'python -m build' to build the wheel in %CD%
176201python -c " import build" 2 > NUL || pip install build
177202if " %if_bits% " == " 64" (
178203 python -m build
@@ -208,5 +233,10 @@ echo Installing wheel: %WHEEL_FILE%
208233pip install " %WHEEL_FILE% "
209234if errorlevel 1 exit /b 1
210235
236+ echo Testing
237+ python -m pip install pkgconf
238+ python -m pkgconf scipy-openblas --cflags
239+ if errorlevel 1 exit /b 1
240+
211241echo Done.
212242exit /b 0
0 commit comments