Skip to content

Commit 5551186

Browse files
Copilotletmaik
andcommitted
Simplify Linux build script to dynamically compute Python path
Co-authored-by: letmaik <530988+letmaik@users.noreply.github.com>
1 parent c1e8b65 commit 5551186

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

.github/scripts/build-linux.sh

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,12 @@ source .github/scripts/retry.sh
88
# List python versions
99
ls /opt/python
1010

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

0 commit comments

Comments
 (0)