Skip to content

Commit 8e4117e

Browse files
committed
build script tweaks
1 parent bc37dd5 commit 8e4117e

4 files changed

Lines changed: 23 additions & 28 deletions

File tree

.github/scripts/build-linux.sh

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,12 @@ CHECK_SHA256=.github/scripts/check_sha256.sh
1010
# List python versions
1111
ls /opt/python
1212

13-
if [ $PYTHON_VERSION == "3.9" ]; then
14-
PYBIN="/opt/python/cp39-cp39/bin"
15-
elif [ $PYTHON_VERSION == "3.10" ]; then
16-
PYBIN="/opt/python/cp310-cp310/bin"
17-
elif [ $PYTHON_VERSION == "3.11" ]; then
18-
PYBIN="/opt/python/cp311-cp311/bin"
19-
elif [ $PYTHON_VERSION == "3.12" ]; then
20-
PYBIN="/opt/python/cp312-cp312/bin"
21-
elif [ $PYTHON_VERSION == "3.13" ]; then
22-
PYBIN="/opt/python/cp313-cp313/bin"
23-
elif [ $PYTHON_VERSION == "3.14" ]; then
24-
PYBIN="/opt/python/cp314-cp314/bin"
25-
else
26-
echo "Unsupported Python version $PYTHON_VERSION"
13+
# Compute PYBIN from PYTHON_VERSION (e.g., "3.14" -> "cp314-cp314")
14+
PYVER_NO_DOT=${PYTHON_VERSION//./}
15+
PYBIN="/opt/python/cp${PYVER_NO_DOT}-cp${PYVER_NO_DOT}/bin"
16+
17+
if [ ! -d "$PYBIN" ]; then
18+
echo "Python version $PYTHON_VERSION not found at $PYBIN"
2719
exit 1
2820
fi
2921

@@ -92,6 +84,10 @@ retry yum install -y libpng-devel freetype-devel
9284
# Install numpy/scipy deps
9385
retry yum install -y lapack-devel blas-devel
9486

87+
# Upgrade pip and prefer binary packages
88+
${PYBIN}/python -m pip install --upgrade pip
89+
export PIP_PREFER_BINARY=1
90+
9591
# install compile-time dependencies
9692
retry ${PYBIN}/pip install numpy==${NUMPY_VERSION} cython setuptools
9793

.github/scripts/build-macos.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ source venv/bin/activate
3030
set -x
3131
popd
3232

33+
# Upgrade pip and prefer binary packages
34+
python -m pip install --upgrade pip
35+
export PIP_PREFER_BINARY=1
36+
3337
# Install dependencies
3438
pip install numpy==$NUMPY_VERSION cython wheel delocate setuptools
3539

.github/scripts/build-windows.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ if (!$env:NUMPY_VERSION) {
120120
Initialize-VS
121121
Initialize-Python
122122

123+
# Prefer binary packages over building from source
124+
$env:PIP_PREFER_BINARY = 1
125+
123126
Get-ChildItem env:
124127

125128
# Install vcpkg and build dependencies

.github/scripts/test-linux.sh

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,12 @@ cd /io
66
# List python versions
77
ls /opt/python
88

9-
if [ $PYTHON_VERSION == "3.9" ]; then
10-
PYBIN="/opt/python/cp39-cp39/bin"
11-
elif [ $PYTHON_VERSION == "3.10" ]; then
12-
PYBIN="/opt/python/cp310-cp310/bin"
13-
elif [ $PYTHON_VERSION == "3.11" ]; then
14-
PYBIN="/opt/python/cp311-cp311/bin"
15-
elif [ $PYTHON_VERSION == "3.12" ]; then
16-
PYBIN="/opt/python/cp312-cp312/bin"
17-
elif [ $PYTHON_VERSION == "3.13" ]; then
18-
PYBIN="/opt/python/cp313-cp313/bin"
19-
elif [ $PYTHON_VERSION == "3.14" ]; then
20-
PYBIN="/opt/python/cp314-cp314/bin"
21-
else
22-
echo "Unsupported Python version $PYTHON_VERSION"
9+
# Compute PYBIN from PYTHON_VERSION (e.g., "3.14" -> "cp314-cp314")
10+
PYVER_NO_DOT=${PYTHON_VERSION//./}
11+
PYBIN="/opt/python/cp${PYVER_NO_DOT}-cp${PYVER_NO_DOT}/bin"
12+
13+
if [ ! -d "$PYBIN" ]; then
14+
echo "Python version $PYTHON_VERSION not found at $PYBIN"
2315
exit 1
2416
fi
2517
PYVER=${PYTHON_VERSION//.}

0 commit comments

Comments
 (0)