Skip to content

Commit f00f720

Browse files
committed
Implement wheel PR comments
1 parent 0b38387 commit f00f720

File tree

4 files changed

+38
-13
lines changed

4 files changed

+38
-13
lines changed

.github/workflows/wheels.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- uses: actions/checkout@v3
20+
with:
21+
fetch-depth: 0
2022

2123
- name: Build SDist
2224
run: pipx run build --sdist
@@ -58,6 +60,8 @@ jobs:
5860

5961
steps:
6062
- uses: actions/checkout@v3
63+
with:
64+
fetch-depth: 0
6165

6266
- uses: actions/setup-python@v4
6367
with:
@@ -79,8 +83,8 @@ jobs:
7983
# Build SuiteSparse
8084
CIBW_BEFORE_ALL: bash suitesparse.sh ${{ github.ref }}
8185

82-
# Ask suitesparse.sh to build libraries in MSVC style on Windows.
83-
CIBW_ENVIRONMENT_WINDOWS: CMAKE_GNUtoMS=ON
86+
# CMAKE_GNUtoMS=ON asks suitesparse.sh to build libraries in MSVC style on Windows.
87+
CIBW_ENVIRONMENT_WINDOWS: CMAKE_GNUtoMS=ON GRAPHBLAS_PREFIX="C:/GraphBLAS"
8488

8589
# macOS libomp requires special configs. BREW_LIBOMP=1 asks suitesparse.sh to include them.
8690
CIBW_ENVIRONMENT_MACOS: BREW_LIBOMP="1"
@@ -101,7 +105,7 @@ jobs:
101105
# Note: Currently using a workaround: --no-mangle instead of stripping graphblas.dll
102106
# see https://github.com/adang1345/delvewheel/issues/33
103107
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
104-
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair --add-path \"C:\\Program Files (x86)\\bin\" --no-mangle \"libgomp-1.dll;libgcc_s_seh-1.dll\" -w {dest_dir} {wheel}"
108+
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair --add-path \"C:\\GraphBLAS\\bin\" --no-mangle \"libgomp-1.dll;libgcc_s_seh-1.dll\" -w {dest_dir} {wheel}"
105109

106110
# make cibuildwheel install test dependencies from pyproject.toml
107111
CIBW_TEST_EXTRAS: "test"
@@ -118,9 +122,21 @@ jobs:
118122
shell: bash
119123

120124
- uses: actions/upload-artifact@v3
125+
id: uploadAttempt1
126+
continue-on-error: true
121127
with:
122128
path: wheelhouse/*.whl
129+
if-no-files-found: error
123130

131+
# Retry upload if first attempt failed. This happens somewhat randomly and for irregular reasons.
132+
# Logic is a duplicate of previous step.
133+
- uses: actions/upload-artifact@v3
134+
id: uploadAttempt2
135+
if: steps.uploadAttempt1.outcome == 'failure'
136+
continue-on-error: false
137+
with:
138+
path: wheelhouse/*.whl
139+
if-no-files-found: error
124140

125141
upload_all:
126142
name: Upload to PyPI

build_graphblas_cffi.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@
1616
include_dirs.append(os.path.join(sys.prefix, "Library", "include"))
1717
library_dirs.append(os.path.join(sys.prefix, "Library", "lib"))
1818

19-
# suitesparse.sh installs GraphBLAS.h here
20-
include_dirs.append(os.path.join("C:\\", "Program Files (x86)", "include"))
21-
# graphblas.lib and graphblas.dll.a
22-
library_dirs.append(os.path.join("C:\\", "Program Files (x86)", "lib"))
23-
# graphblas.dll
24-
library_dirs.append(os.path.join("C:\\", "Program Files (x86)", "bin"))
19+
# wheels.yml configures suitesparse.sh to install GraphBLAS here.
20+
prefix = "C:\\GraphBLAS"
21+
include_dirs.append(os.path.join(prefix, "include"))
22+
library_dirs.append(os.path.join(prefix, "lib"))
23+
library_dirs.append(os.path.join(prefix, "bin"))
2524

2625
ffibuilder.set_source(
2726
"suitesparse_graphblas._graphblas",

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ requires = [
44
"setuptools >=64",
55
"setuptools-git-versioning",
66
"wheel",
7-
"cffi",
7+
"cffi>=1.11",
88
"cython",
99
"oldest-supported-numpy",
1010
]

suitesparse.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ if [ -n "${CMAKE_GNUtoMS}" ]; then
3434
cmake_params+=(-DCMAKE_STATIC_LIBRARY_PREFIX=)
3535
fi
3636

37+
if [ -n "${GRAPHBLAS_PREFIX}" ]; then
38+
echo "GRAPHBLAS_PREFIX=${GRAPHBLAS_PREFIX}"
39+
cmake_params+=(-DCMAKE_INSTALL_PREFIX="${GRAPHBLAS_PREFIX}")
40+
fi
41+
3742
curl -L https://github.com/DrTimothyAldenDavis/GraphBLAS/archive/refs/tags/v${VERSION}.tar.gz | tar xzf -
3843
cd GraphBLAS-${VERSION}/build
3944

@@ -62,12 +67,17 @@ make -j$NPROC
6267
make install
6368

6469
if [ -n "${CMAKE_GNUtoMS}" ]; then
70+
if [ -z "${GRAPHBLAS_PREFIX}" ]; then
71+
# Windows default
72+
GRAPHBLAS_PREFIX="C:/Program Files (x86)"
73+
fi
74+
6575
# Windows:
6676
# CMAKE_STATIC_LIBRARY_PREFIX is sometimes ignored, possibly when the MinGW toolchain is selected.
6777
# Drop the 'lib' prefix manually.
6878
echo "manually removing lib prefix"
69-
mv "C:/Program Files (x86)/lib/libgraphblas.lib" "C:/Program Files (x86)/lib/graphblas.lib"
70-
mv "C:/Program Files (x86)/lib/libgraphblas.dll.a" "C:/Program Files (x86)/lib/graphblas.dll.a"
79+
mv "${GRAPHBLAS_PREFIX}/lib/libgraphblas.lib" "${GRAPHBLAS_PREFIX}/lib/graphblas.lib"
80+
mv "${GRAPHBLAS_PREFIX}/lib/libgraphblas.dll.a" "${GRAPHBLAS_PREFIX}/lib/graphblas.dll.a"
7181
# cp instead of mv because the GNU tools expect libgraphblas.dll and the MS tools expect graphblas.dll.
72-
cp "C:/Program Files (x86)/bin/libgraphblas.dll" "C:/Program Files (x86)/bin/graphblas.dll"
82+
cp "${GRAPHBLAS_PREFIX}/bin/libgraphblas.dll" "${GRAPHBLAS_PREFIX}/bin/graphblas.dll"
7383
fi

0 commit comments

Comments
 (0)