Skip to content

Commit c211e21

Browse files
committed
Replace the VERSION = in Makefile.rule with the one from pyproject.toml
1 parent 4e20687 commit c211e21

7 files changed

Lines changed: 56 additions & 36 deletions

File tree

.github/workflows/publish.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ on:
44
workflow_dispatch:
55
inputs:
66
environment:
7-
description: Which PyPI environment to upload to, if any
7+
description: |
8+
Which PyPI environment to upload to?
9+
Be sure to push an annotated tag to 'main' before choosing 'pypi'
810
required: true
911
type: choice
1012
options: [ "none", "testpypi", "pypi" ]

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@ https://anaconda.org/scientific=python-nightly-wheels/scipy_openblas64 via
3434
There are workflow triggers for repo admins. They can trigger a testpypi build
3535
or a pypi build with the publish workflow, which will upload the wheels using
3636
trusted publishing. In order to publish to PyPI, there must be a tag at the HEAD
37-
of the branch used to publish. Use annotated tags:
37+
of the branch used to publish. After merging a PR, be sure to update to main and
38+
use annotated tags:
3839
```
40+
git checkout main; git pull
3941
git tag -a v0.3.31.126.4 -m"fixed something"
4042
```
4143
The wheel is self-contained, it includes all needed gfortran support libraries.
42-
On windows, this is a single DLL.
44+
On windows, this is a single DLL.
4345

4446
## Buildtime
4547

ci-before-build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ if [[ "$NIGHTLY" = "true" ]]; then
5151
sed -e "s/^version = .*/version = \"${version}\"/" -i.bak pyproject.toml
5252
else
5353
export OPENBLAS_COMMIT=$(cat openblas_commit.txt)
54+
version=$(grep "^version =" pyproject.toml | sed 's/version = "//;s/"//')
5455
fi
56+
sed -e "s/^VERSION = .*/VERSION = ${version}/" -i.bak OpenBLAS/Makefile.rule
5557
echo "creating wheel from $OPENBLAS_COMMIT (NIGHTLY is $NIGHTLY)"
5658

5759
if [ "$(uname)" != "Darwin" ]; then

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"
99
[project]
1010
name = "scipy-openblas64"
1111
# v0.3.31-126-g55b16e59
12-
version = "0.3.31.126.5"
12+
version = "0.3.31.126.6"
1313
requires-python = ">=3.7"
1414
description = "Provides OpenBLAS for python packaging"
1515
readme = "README.md"

tools/build_steps_win_arm64.bat

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
:: Build script for scipy_openblas wheel on Windows on ARM64
2-
3-
:: Usage: build_steps_win_arm64.bat [build_bits] [if_bits]
4-
:: e.g build_steps_win_arm64.bat 64 64
5-
6-
:: build_bits (default binary architecture, 32 or 64, unspec -> 64).
7-
:: if_bits (default interface size, 32 or 64, unspec -> 32)
8-
:: If INTERFACE64 environment variable is 1, then if_bits defaults to 64
9-
:: Expects these binaries on the PATH:
10-
:: clang-cl, flang-new, cmake, perl
11-
:: First commit containing WoA build fixes.
12-
:: Minimum OpenBLAS commit to build; we'll update to this if commit not
13-
:: present.
1+
REM Build script for scipy_openblas wheel on Windows on ARM64
2+
3+
REM Usage: build_steps_win_arm64.bat [build_bits] [if_bits]
4+
REM e.g build_steps_win_arm64.bat 64 64
5+
6+
REM build_bits (default binary architecture, 32 or 64, unspec -> 64).
7+
REM if_bits (default interface size, 32 or 64, unspec -> 32)
8+
REM If INTERFACE64 environment variable is 1, then if_bits defaults to 64
9+
REM Expects these binaries on the PATH:
10+
REM clang-cl, flang-new, cmake, perl
11+
REM First commit containing WoA build fixes.
12+
REM Minimum OpenBLAS commit to build; we'll update to this if commit not
13+
REM present.
1414
set first_woa_buildable_commit="de2380e5a6149706a633322a16a0f66faa5591fc"
1515

1616
@echo off
@@ -33,7 +33,7 @@ if "%2"=="" (
3333
)
3434
echo Building for %build_bits%-bit binary, %if_bits%-bit interface...
3535

36-
:: Define destination directory
36+
REM Define destination directory
3737
pushd "%~dp0\.."
3838
set "ob_out_root=%CD%\local\scipy_openblas"
3939
set "ob_64=%ob_out_root%64"
@@ -54,13 +54,13 @@ if "%if_bits%"=="64" (
5454
)
5555
)
5656

57-
:: Clone OpenBLAS
57+
REM Clone OpenBLAS
5858
echo Cloning OpenBLAS repository with submodules...
5959
git submodule update --init --recursive OpenBLAS
6060
if errorlevel 1 exit /b 1
6161
set /p OPENBLAS_COMMIT=<openblas_commit.txt
6262

63-
:: Enter OpenBLAS directory and checkout buildable commit
63+
REM Enter OpenBLAS directory and checkout buildable commit
6464
cd OpenBLAS
6565
git checkout %OPENBLAS_COMMIT%
6666
git merge-base --is-ancestor %first_woa_buildable_commit% HEAD 2>NUL
@@ -70,30 +70,38 @@ if errorlevel 1 (
7070
exit /b 2
7171
)
7272

73-
:: Patch
73+
REM Patch
7474
for /r %%f in (..\patches\*) do git apply %%f
7575
if errorlevel 1 exit /b 1
7676

77-
:: Set suffixed-ILP64 flags
77+
REM Patch VERSION
78+
REM version=$(grep "^version =" pyproject.toml | sed 's/version = "//;s/"//')
79+
REM sed -e "s/^VERSION = .*/VERSION = ${version}/" -i.bak OpenBLAS/Makefile.rule
80+
81+
for /f "tokens=3 delims= " %%v in ('findstr /b "version = " pyproject.toml') do set version=%%v
82+
set version=%version:"=%
83+
powershell -Command "(Get-Content OpenBLAS/Makefile.rule) -replace '^VERSION = .*', 'VERSION = %version%' | Set-Content OpenBLAS/Makefile.rule"
84+
85+
REM Set suffixed-ILP64 flags
7886
if "%if_bits%"=="64" (
7987
set "interface_flags=-DINTERFACE64=1 -DSYMBOLSUFFIX=64_"
8088
) else (
8189
set "interface_flags="
8290
)
8391

84-
:: Create build directory and navigate to it
92+
REM Create build directory and navigate to it
8593
if exist build (rmdir /S /Q build || exit /b 1)
8694
mkdir build || exit /b 1 & cd build || exit /b 1
8795

8896
echo Setting up ARM64 Developer Command Prompt and running CMake...
8997

90-
:: Initialize VS ARM64 environment
98+
REM Initialize VS ARM64 environment
9199
CALL "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsarm64.bat"
92100

93-
:: Prefer LLVM flang
101+
REM Prefer LLVM flang
94102
PATH=C:\Program Files\LLVM\bin;%PATH%
95103

96-
:: Run CMake and Ninja build
104+
REM Run CMake and Ninja build
97105

98106
set CFLAGS=-Wno-reserved-macro-identifier -Wno-unsafe-buffer-usage -Wno-unused-macros -Wno-sign-conversion -Wno-reserved-identifier
99107
cmake .. -G Ninja ^
@@ -132,13 +140,13 @@ if "%if_bits%"=="32" (
132140
cd ..
133141
)
134142

135-
:: Prepare destination directory
143+
REM Prepare destination directory
136144
cd OpenBLAS/build
137145
echo Preparing destination directory at %DEST_DIR%
138146
if not exist "%DEST_DIR%\lib\cmake\OpenBLAS" mkdir "%DEST_DIR%\lib\cmake\OpenBLAS"
139147
if not exist "%DEST_DIR%\include" mkdir "%DEST_DIR%\include"
140148

141-
:: Move library files
149+
REM Move library files
142150
echo Moving library files...
143151
if exist lib\release (
144152
move /Y lib\release\*.dll "%DEST_DIR%\lib\"
@@ -154,19 +162,19 @@ if exist lib\release (
154162
exit /b 1
155163
)
156164

157-
:: Copy CMake configuration files
165+
REM Copy CMake configuration files
158166
echo Copying CMake configuration files...
159167
if exist openblasconfig.cmake copy /Y openblasconfig.cmake "%DEST_DIR%\lib\cmake\openblas\"
160168
if exist openblasconfigversion.cmake copy /Y openblasconfigversion.cmake "%DEST_DIR%\lib\cmake\openblas\"
161169

162-
:: Copy header files
170+
REM Copy header files
163171
echo Copying generated header files...
164172
if exist generated xcopy /E /Y generated "%DEST_DIR%\include\"
165173
if exist lapacke_mangling.h copy /Y lapacke_mangling.h "%DEST_DIR%\include\"
166174
if exist openblas_config.h copy /Y openblas_config.h "%DEST_DIR%\include\"
167175

168176

169-
:: Copy LAPACKE header files
177+
REM Copy LAPACKE header files
170178
echo Copying LAPACKE header files...
171179
xcopy /Y "..\lapack-netlib\lapacke\include\*.h" "%DEST_DIR%\include\"
172180
if errorlevel 1 exit /b 1
@@ -189,14 +197,14 @@ if errorlevel 1 (
189197
exit /b 1
190198
)
191199

192-
:: Move back to the root directory
200+
REM Move back to the root directory
193201
cd ..
194202
if errorlevel 1 (
195203
echo Current directory %CD%, cannot cd ..
196204
exit /b 1
197205
)
198206

199-
:: Build the Wheel & Install It
207+
REM Build the Wheel & Install It
200208
echo Running 'python -m build' to build the wheel in %CD%
201209
python -c "import build" 2>NUL || pip install build
202210
if "%if_bits%"=="64" (
@@ -213,15 +221,15 @@ if "%if_bits%"=="32" (
213221
move /Y "%CD%\ob64_backup" "%ob_64%"
214222
)
215223

216-
:: Rename the wheel
224+
REM Rename the wheel
217225
for %%f in (dist\*any.whl) do (
218226
set WHEEL_FILE=dist\%%f
219227
set "filename=%%~nxf"
220228
set "newname=!filename:any.whl=win_arm64.whl!"
221229
ren "dist\!filename!" "!newname!"
222230
)
223231

224-
:: Locate the built wheel
232+
REM Locate the built wheel
225233
for /f %%f in ('dir /b dist\scipy_openblas*.whl 2^>nul') do set WHEEL_FILE=dist\%%f
226234

227235
if not defined WHEEL_FILE (

tools/build_steps_windows.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ OPENBLAS_VERSION=$(git describe --tags --abbrev=8)
9494
# with libquadmath
9595
patch -p1 < ../patches-windows/openblas-make-libs.patch
9696

97+
# Patch VERSION
98+
version=$(grep "^version =" pyproject.toml | sed 's/version = "//;s/"//')
99+
sed -e "s/^VERSION = .*/VERSION = ${version}/" -i.bak OpenBLAS/Makefile.rule
100+
97101
# Build OpenBLAS
98102
CFLAGS="$CFLAGS -fvisibility=protected -fno-ident" \
99103
make BINARY=$build_bits DYNAMIC_ARCH=1 USE_THREAD=1 USE_OPENMP=0 \

tools/local_build.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ else
2020
echo got nothing
2121
exit -1
2222
fi
23-
export OPENBLAS_COMMIT="v0.3.30-349-gf6df9beb"
23+
export OPENBLAS_COMMIT=$(cat openblas_commit.txt)
24+
version=$(echo $OPENBLAS_COMMIT | sed -e "s/^v\(.*\)-g.*/\1/" | sed -e "s/-/./g").0
25+
sed -e "s/^VERSION = .*/VERSION = ${version}/" -i.bak OpenBLAS/Makefile.rule
2426

2527
# export MB_ML_LIBC=musllinux
2628
# export MB_ML_VER=_1_2

0 commit comments

Comments
 (0)