Skip to content

Commit 9e0dd5e

Browse files
committed
add entrypoint.txt for pyconf-pypi, cleanup
1 parent 0dfedf0 commit 9e0dd5e

File tree

9 files changed

+47
-62
lines changed

9 files changed

+47
-62
lines changed

.github/workflows/windows.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ jobs:
115115
fi
116116
sed -e "s/bin/lib/" -i local/scipy_openblas64/lib/cmake/openblas/OpenBLASConfig.cmake
117117
sed -e "s/dll/lib/" -i local/scipy_openblas64/lib/cmake/openblas/OpenBLASConfig.cmake
118+
mkdir local/scipy_openblas64/lib/pkgconfig
118119
if [[ "${INTERFACE64}" != "1" ]]; then
119120
mv local/scipy_openblas64 local/scipy_openblas32
120121
# rewrite the name of the project to scipy-openblas32
@@ -125,6 +126,9 @@ jobs:
125126
sed -e "s/cflags =.*/cflags = '-DBLAS_SYMBOL_PREFIX=scipy_'/" -i local/scipy_openblas32/__init__.py
126127
sed -e "s/openblas64/openblas32/" -i local/scipy_openblas32/__init__.py
127128
sed -e "s/openblas64/openblas32/" -i local/scipy_openblas32/__main__.py
129+
PYTHONPATH=$PWD/local python -c "import scipy_openblas32 as s; print(s.get_pkg_config(use_prefix=True))" > local/scipy_openblas32/lib/pkgconfig/scipy-openblas.pc
130+
else
131+
PYTHONPATH=$PWD/local python -c "import scipy_openblas64 as s; print(s.get_pkg_config(use_prefix=True))" > local/scipy_openblas64/lib/pkgconfig/scipy-openblas.pc
128132
fi
129133
echo "" >> LICENSE.txt
130134
echo "----" >> LICENSE.txt
@@ -153,13 +157,17 @@ jobs:
153157
python -m pip install --no-index --find-links dist scipy_openblas64
154158
python -m scipy_openblas64
155159
python -c "import scipy_openblas64; print(scipy_openblas64.get_pkg_config())"
160+
python -m pip install pkgconf
161+
python -m pkgconf scipy-openblas --cflags
156162
157163
- name: Test 32-bit interface wheel
158164
if: matrix.INTERFACE64 != '1'
159165
run: |
160166
python -m pip install --no-index --find-links dist scipy_openblas32
161167
python -m scipy_openblas32
162168
python -c "import scipy_openblas32; print(scipy_openblas32.get_pkg_config())"
169+
python -m pip install pkgconf
170+
python -m pkgconf scipy-openblas --cflags
163171
164172
- uses: conda-incubator/setup-miniconda@v3.1.1
165173
with:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ First, tarballs are built using `build_lib` in `tools/build_steps.sh` (on
2424
posix in a docker and drectly on macos) or `tools/build_steps_windows.sh` on windows.
2525

2626
Then the shared object and header files from the tarball are used to build the
27-
wheel via `tools/build_wheel.sh`, and the wheels uploaded to
27+
wheel via `tools/build_prepare_wheel.sh` and `pip build wheel`, and the wheels uploaded to
2828
https://anaconda.org/scientific=python-nightly-wheels/scipy_openblas32 and
2929
https://anaconda.org/scientific=python-nightly-wheels/scipy_openblas64 via
3030
`tools/upload_to_anaconda_staging.sh`. For a release, the wheels are uploaded

ci-before-build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@ unset -f popd
7373
source build-openblas.sh
7474

7575
# Build wheel
76-
source tools/build_prepare.sh
76+
source tools/build_prepare_wheel.sh

ci-test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ else
2020
# $PYTHON -m pip install --no-index --find-links /tmp/cibuildwheel/repaired_wheel scipy_openblas64
2121
$PYTHON -m scipy_openblas64
2222
fi
23+
24+
$PYTHON -m pip install pkgconf
25+
$PYTHON -m pkgconf scipy-openblas --cflags

local/scipy_openblas64/__init__.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def get_library(fullname=False):
6060
# remove the leading lib from libscipy_openblas*
6161
return os.path.splitext(libs[0])[0][3:]
6262

63-
def get_pkg_config(use_preloading=False):
63+
def get_pkg_config(use_preloading=False, use_prefix=False):
6464
"""Return a multi-line string that, when saved to a file, can be used with
6565
pkg-config for build systems like meson
6666
@@ -81,9 +81,16 @@ def get_pkg_config(use_preloading=False):
8181
else:
8282
libs_flags = f"${{libdir}}/{get_library(fullname=True)} -Wl,-rpath,${{libdir}}"
8383
cflags = "-DBLAS_SYMBOL_PREFIX=scipy_ -DBLAS_SYMBOL_SUFFIX=64_ -DHAVE_BLAS_ILP64 -DOPENBLAS_ILP64_NAMING_SCHEME"
84+
if use_prefix:
85+
libdir = "${pcfiledir}/../../lib
86+
incdir = "${pcfiledir}/../../include
87+
else:
88+
# Don't use `$prefix` since the file may be located outside the package tree
89+
libdir = get_lib_dir()
90+
incdir = get_include_dir()
8491
return dedent(f"""\
85-
libdir={get_lib_dir()}
86-
includedir={get_include_dir()}
92+
libdir={libdir}
93+
includedir={incdir}
8794
openblas_config= {get_openblas_config()}
8895
version={get_openblas_config().split(" ")[1]}
8996
extralib={extralib}

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,6 @@ environment-pass = [
5757
]
5858
[tool.cibuildwheel.linux]
5959
environment = { CC = "/opt/clang/bin/clang", CXX = "/opt/clang/bin/clang++", LDFLAGS = "-fuse-ld=lld" }
60+
61+
[tool.entry-points.pkg_config]
62+
scipy-openblas = scipy_openblas64/lib/pkgconfig
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ PYTHON=${PYTHON:-python3.9}
1111

1212
mkdir -p local/openblas
1313
mkdir -p dist
14-
$PYTHON -m pip install wheel auditwheel
1514

1615
tar -C local/scipy_openblas64 --strip-components=2 -xf libs/openblas.tar.gz
1716

@@ -40,6 +39,7 @@ if [ $(uname) == "Darwin" ]; then
4039
fi
4140

4241
rm -rf local/scipy_openblas64/lib/pkgconfig
42+
mkdir local/scipy_openblas64/lib/pkgconfig
4343
echo "" >> LICENSE.txt
4444
echo "----" >> LICENSE.txt
4545
echo "" >> LICENSE.txt
@@ -63,6 +63,9 @@ if [ "${INTERFACE64}" != "1" ]; then
6363
sed -e "s/openblas64/openblas32/" -i.bak local/scipy_openblas32/__main__.py
6464
sed -e "s/openblas64/openblas32/" -i.bak local/scipy_openblas32/__init__.py
6565
rm local/scipy_openblas32/*.bak
66+
PYTHONPATH=$PWD/local python -c "import scipy_openblas32 as s; print(s.get_pkg_config(use_prefix=True))" > local/scipy_openblas32/lib/pkgconfig/scipy-openblas.pc
67+
else
68+
PYTHONPATH=$PWD/local python -c "import scipy_openblas64 as s; print(s.get_pkg_config(use_prefix=True))" > local/scipy_openblas64/lib/pkgconfig/scipy-openblas.pc
6669
fi
6770

6871
rm -rf dist/*

tools/build_steps_win_arm64.bat

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,18 @@ if "%if_bits%"=="32" (
123123
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+
mkdir scipy_openblas32\lib\pkgconfig
133+
python -c "import scipy_openblas32 as s; print(s.get_pkg_config(use_prefix=True))" > scipy_openblas32/lib/pkgconfig/scipy-openblas.pc
134+
) else (
135+
cd local
136+
mkdir scipy_openblas64\lib\pkgconfig
137+
python -c "import scipy_openblas64 as s; print(s.get_pkg_config(use_prefix=True))" > scipy_openblas64/lib/pkgconfig/scipy-openblas.pc
130138
)
131139

132140
:: Prepare destination directory
@@ -208,5 +216,10 @@ echo Installing wheel: %WHEEL_FILE%
208216
pip install "%WHEEL_FILE%"
209217
if errorlevel 1 exit /b 1
210218

219+
echo Testing
220+
python -m pip install pkgconf
221+
python -m pkgconf scipy-openblas --cflags
222+
if errorlevel 1 exit /b 1
223+
211224
echo Done.
212225
exit /b 0

tools/build_wheel.sh

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)