Skip to content

Commit 7bd1454

Browse files
committed
Add build-wheels.sh script for manylinux wheels
1 parent ff07f67 commit 7bd1454

2 files changed

Lines changed: 46 additions & 1 deletion

File tree

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Coverage
22
Cython
33
NumPy>=1.17
44
Pillow
5+
tifffile
56
PyQt5
67
PythonQwt>=0.12
78
SciPy>=1.3
@@ -16,4 +17,4 @@ python-docs-theme
1617
sphinx
1718
myst_parser
1819
sphinx-copybutton
19-
sphinx_qt_documentation
20+
sphinx_qt_documentation

scripts/build-wheels.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
set -e -u -x
3+
4+
ARCH=$(uname -m)
5+
export PLAT=manylinux_2_17_$ARCH
6+
7+
# Accurately check if Python version is 3.8 or greater
8+
function is_python_version_ge_38 {
9+
local pydir="$1"
10+
if [[ $pydir =~ cp([0-9]+)([0-9]+)-cp ]]; then
11+
local version="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"
12+
# Use sort with version sort flag to compare version against 3.8
13+
if [[ $(echo -e "3.8\n$version" | sort -V | head -n1) == "3.8" ]]; then
14+
return 0 # True, version is >= 3.8
15+
fi
16+
fi
17+
return 1 # False, version is < 3.8
18+
}
19+
20+
# Compile wheels, only for CPython 3.8+
21+
for PYDIR in /opt/python/*; do
22+
if is_python_version_ge_38 "$PYDIR"; then
23+
PYBIN="$PYDIR/bin"
24+
"${PYBIN}/pip" install -r /io/requirements.txt
25+
"${PYBIN}/pip" wheel /io/ --no-deps -w wheelhouse/
26+
fi
27+
done
28+
29+
# Bundle external shared libraries into the wheels
30+
for wheel in wheelhouse/*.whl; do
31+
if auditwheel show "$wheel"; then
32+
auditwheel repair "$wheel" --plat "$PLAT" -w /io/wheelhouse/
33+
fi
34+
done
35+
36+
# Install packages and test, only for CPython 3.8+
37+
for PYDIR in /opt/python/*; do
38+
if is_python_version_ge_38 "$PYDIR"; then
39+
PYBIN="$PYDIR/bin"
40+
"${PYBIN}/pip" install plotpy --no-index -f /io/wheelhouse
41+
(cd "$HOME"; INSTDIR=$("${PYBIN}/python" -c "import plotpy, os.path as osp; print(osp.dirname(plotpy.__file__))"); export QT_QPA_PLATFORM=offscreen; "${PYBIN}/pytest" "$INSTDIR")
42+
fi
43+
done
44+

0 commit comments

Comments
 (0)