python-build: create PEP 394 symlinks for Pyston (#3557)

* Consolidate build_package_pyston2_2 into build_package_pyston
There's no longer a difference

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
This commit is contained in:
David Lawson 2026-09-23 07:49:52 +01:00 committed by GitHub
parent 249f8d888e
commit 4eea9b7848
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 41 additions and 29 deletions

View File

@ -998,27 +998,18 @@ build_package_jython_builder() {
( cd "dist" && build_package_jython )
}
build_package_pyston2_2() {
# currently supported version 2.2 and 2.3
build_package_copy
mkdir -p "${PREFIX_PATH}/bin" "${PREFIX_PATH}/lib"
local bin
shopt -s nullglob
for bin in "bin/"*; do
if [ -f "${bin}" ] && [ -x "${bin}" ] && [ ! -L "${bin}" ]; then
case "${bin##*/}" in
"pyston"* )
( cd "${PREFIX_PATH}/bin" && ln -fs "${bin##*/}" "python" )
;;
esac
fi
done
shopt -u nullglob
}
build_package_pyston() {
# currently supported version 2.3.1v2 and higher
build_package_copy
# Pyston tarballs provide an executable with a version-specific naming scheme
# and `pyston` and `pyston3` symlinks to it.
# Add the `python', `pythonX' and `pythonX.Y' symlinks as per PEP 394.
local real_interpreter version_suffix
real_interpreter=$(resolve_link "${PREFIX_PATH}/bin/pyston" || echo pyston)
version_suffix=$("${PREFIX_PATH}/bin/pyston" -c 'import sys; print("%d.%d" % sys.version_info[:2])' 2>&4)
for name in python "python${version_suffix%.*}" "python${version_suffix}"; do
ln -fs "${real_interpreter}" "${PREFIX_PATH}/bin/$name"
done
}
build_package_ironpython() {

View File

@ -6,7 +6,7 @@ echo
case "$(pyston_architecture 2>/dev/null || true)" in
"linux64" )
install_package "pyston_2.2" "https://github.com/pyston/pyston/releases/download/pyston_2.2/pyston_2.2_portable.tar.gz#d113cc4d1f6821c0f117f7a84978823d8ac751d7970fa7841eb994663ec5a59f" "pyston2_2" verify_py38 get_pip
install_package "pyston_2.2" "https://github.com/pyston/pyston/releases/download/pyston_2.2/pyston_2.2_portable.tar.gz#d113cc4d1f6821c0f117f7a84978823d8ac751d7970fa7841eb994663ec5a59f" pyston verify_py38 get_pip
;;
* )
{ echo

View File

@ -6,7 +6,7 @@ echo
case "$(pyston_architecture 2>/dev/null || true)" in
"linux64" )
install_package "pyston_2.3" "https://github.com/pyston/pyston/releases/download/v2.3/pyston_2.3_portable-v2.tar.gz#90185e29e4a1a19562c095f2bb4e81a5d0715150fa10eca363ec1188b5ba7ee7" "pyston2_2" verify_py38 get_pip
install_package "pyston_2.3" "https://github.com/pyston/pyston/releases/download/v2.3/pyston_2.3_portable-v2.tar.gz#90185e29e4a1a19562c095f2bb4e81a5d0715150fa10eca363ec1188b5ba7ee7" pyston verify_py38 get_pip
;;
* )
{ echo

View File

@ -6,7 +6,7 @@ echo
case "$(pyston_architecture 2>/dev/null || true)" in
"linux64" )
install_package "pyston_2.3.1" "https://github.com/pyston/pyston/releases/download/pyston_2.3.1/pyston_2.3.1_portable_v2.tar.gz#4e16df1eaf5f226c0629f2db1e63033454c94cb9e29f50154177819662df5b15" "pyston" verify_py38 get_pip
install_package "pyston_2.3.1" "https://github.com/pyston/pyston/releases/download/pyston_2.3.1/pyston_2.3.1_portable_v2.tar.gz#4e16df1eaf5f226c0629f2db1e63033454c94cb9e29f50154177819662df5b15" pyston verify_py38 get_pip
;;
* )
{ echo

View File

@ -6,7 +6,7 @@ echo
case "$(pyston_architecture 2>/dev/null || true)" in
"linux64" )
install_package "pyston_2.3.2" "https://github.com/pyston/pyston/releases/download/pyston_2.3.2/pyston_2.3.2_portable.tar.gz#80e71dd2db504e09951ee835e04c9e1183c79412da9aa11d98a6d3f44b95bec1" "pyston" verify_py38 get_pip
install_package "pyston_2.3.2" "https://github.com/pyston/pyston/releases/download/pyston_2.3.2/pyston_2.3.2_portable.tar.gz#80e71dd2db504e09951ee835e04c9e1183c79412da9aa11d98a6d3f44b95bec1" pyston verify_py38 get_pip
;;
* )
{ echo

View File

@ -1,9 +1,9 @@
case "$(pyston_architecture 2>/dev/null || true)" in
"linux64" )
install_package "pyston_2.3.3_portable_amd64" "https://github.com/pyston/pyston/releases/download/pyston_2.3.3/pyston_2.3.3_portable_amd64.tar.gz#7a38e2bd2fed38e6daba4d513bae32af0d5ba6185cadf37cb1af6bcc4de0cb57" "pyston" verify_py38 get_pip
install_package "pyston_2.3.3_portable_amd64" "https://github.com/pyston/pyston/releases/download/pyston_2.3.3/pyston_2.3.3_portable_amd64.tar.gz#7a38e2bd2fed38e6daba4d513bae32af0d5ba6185cadf37cb1af6bcc4de0cb57" pyston verify_py38 get_pip
;;
"linux-aarch64" )
install_package "pyston_2.3.3_portable_arm64" "https://github.com/pyston/pyston/releases/download/pyston_2.3.3/pyston_2.3.3_portable_arm64.tar.gz#f93f55b59120f576e5755bd8f86fa38361a30ca5389dbadc68450051ee2dccb1" "pyston" verify_py38 get_pip
install_package "pyston_2.3.3_portable_arm64" "https://github.com/pyston/pyston/releases/download/pyston_2.3.3/pyston_2.3.3_portable_arm64.tar.gz#f93f55b59120f576e5755bd8f86fa38361a30ca5389dbadc68450051ee2dccb1" pyston verify_py38 get_pip
;;
* )
{ echo

View File

@ -7,10 +7,10 @@ DOWNLOAD='https://github.com/pyston/pyston/releases/download'
case "$(pyston_architecture 2>/dev/null || true)" in
"linux64" )
install_package "pyston_${VER}_portable_amd64" "${DOWNLOAD}/pyston_${VER}/pyston_${VER}_portable_amd64.tar.gz#f8274bdead746f839791d785a5edad8a0b8723016b38751321c8eaf16ebd22db" "pyston" verify_py38 get_pip
install_package "pyston_${VER}_portable_amd64" "${DOWNLOAD}/pyston_${VER}/pyston_${VER}_portable_amd64.tar.gz#f8274bdead746f839791d785a5edad8a0b8723016b38751321c8eaf16ebd22db" pyston verify_py38 get_pip
;;
"linux-aarch64" )
install_package "pyston_${VER}_portable_arm64" "${DOWNLOAD}/pyston_${VER}/pyston_${VER}_portable_arm64.tar.gz#0733d120562c73f129af5633f8ea7faad3fdcab931f2234c02cd81f21eada2cd" "pyston" verify_py38 get_pip
install_package "pyston_${VER}_portable_arm64" "${DOWNLOAD}/pyston_${VER}/pyston_${VER}_portable_arm64.tar.gz#0733d120562c73f129af5633f8ea7faad3fdcab931f2234c02cd81f21eada2cd" pyston verify_py38 get_pip
;;
* )
{ echo

View File

@ -7,10 +7,10 @@ DOWNLOAD='https://github.com/pyston/pyston/releases/download'
case "$(pyston_architecture 2>/dev/null || true)" in
"linux64" )
install_package "pyston_${VER}_portable_amd64" "${DOWNLOAD}/pyston_${VER}/pyston_${VER}_portable_amd64.tar.gz#c71c711d60a9c18f243a9e30fd35e0818674ae96f534c67c27b0cdfbc9132ef8" "pyston" verify_py38 get_pip
install_package "pyston_${VER}_portable_amd64" "${DOWNLOAD}/pyston_${VER}/pyston_${VER}_portable_amd64.tar.gz#c71c711d60a9c18f243a9e30fd35e0818674ae96f534c67c27b0cdfbc9132ef8" pyston verify_py38 get_pip
;;
"linux-aarch64" )
install_package "pyston_${VER}_portable_arm64" "${DOWNLOAD}/pyston_${VER}/pyston_${VER}_portable_arm64.tar.gz#c578cb806c62d9dca8728f190a87e172305bd80887e206df42c4c5658ab469c1" "pyston" verify_py38 get_pip
install_package "pyston_${VER}_portable_arm64" "${DOWNLOAD}/pyston_${VER}/pyston_${VER}_portable_arm64.tar.gz#c578cb806c62d9dca8728f190a87e172305bd80887e206df42c4c5658ab469c1" pyston verify_py38 get_pip
;;
* )
{ echo

View File

@ -243,6 +243,27 @@ OUT
[[ "$(resolve_link "${INSTALL_ROOT}/bin/python-config")" == "python3.4-config" ]]
}
@test "pyston: create python* symlinks" {
mkdir -p "${BATS_TEST_TMPDIR}/pyston_2.3.5/bin"
cd "${BATS_TEST_TMPDIR}/pyston_2.3.5"
executable bin/real_interpreter_name <<OUT
#!$BASH
echo 3.8
OUT
ln -s real_interpreter_name bin/pyston
ln -s real_interpreter_name bin/pyston3
TMPDIR="$BATS_TEST_TMPDIR" run_inline_definition <<OUT
build_package_pyston
verify_python 3.8
OUT
assert_success
for name in python python3 python3.8; do
assert_equal "$(resolve_link "${INSTALL_ROOT}/bin/$name")" "real_interpreter_name"
done
}
@test "enable framework" {
framework_path="${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin"
mkdir -p "$framework_path"