From 4eea9b784875126dc606361583f440fc64f1fef9 Mon Sep 17 00:00:00 2001 From: David Lawson Date: Wed, 23 Sep 2026 07:49:52 +0100 Subject: [PATCH] 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 Co-authored-by: Ivan Pozdeev --- plugins/python-build/bin/python-build | 29 +++++++------------ .../share/python-build/pyston-2.2 | 2 +- .../share/python-build/pyston-2.3 | 2 +- .../share/python-build/pyston-2.3.1 | 2 +- .../share/python-build/pyston-2.3.2 | 2 +- .../share/python-build/pyston-2.3.3 | 4 +-- .../share/python-build/pyston-2.3.4 | 4 +-- .../share/python-build/pyston-2.3.5 | 4 +-- plugins/python-build/test/pyenv_ext.bats | 21 ++++++++++++++ 9 files changed, 41 insertions(+), 29 deletions(-) diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index 27042aca..5cc272ea 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -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() { diff --git a/plugins/python-build/share/python-build/pyston-2.2 b/plugins/python-build/share/python-build/pyston-2.2 index 31a5c15a..d79a6eb3 100644 --- a/plugins/python-build/share/python-build/pyston-2.2 +++ b/plugins/python-build/share/python-build/pyston-2.2 @@ -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 diff --git a/plugins/python-build/share/python-build/pyston-2.3 b/plugins/python-build/share/python-build/pyston-2.3 index 25d5b413..c53a9b3e 100644 --- a/plugins/python-build/share/python-build/pyston-2.3 +++ b/plugins/python-build/share/python-build/pyston-2.3 @@ -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 diff --git a/plugins/python-build/share/python-build/pyston-2.3.1 b/plugins/python-build/share/python-build/pyston-2.3.1 index c6a44350..96b170a6 100644 --- a/plugins/python-build/share/python-build/pyston-2.3.1 +++ b/plugins/python-build/share/python-build/pyston-2.3.1 @@ -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 diff --git a/plugins/python-build/share/python-build/pyston-2.3.2 b/plugins/python-build/share/python-build/pyston-2.3.2 index 38717b5c..ea66221a 100644 --- a/plugins/python-build/share/python-build/pyston-2.3.2 +++ b/plugins/python-build/share/python-build/pyston-2.3.2 @@ -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 diff --git a/plugins/python-build/share/python-build/pyston-2.3.3 b/plugins/python-build/share/python-build/pyston-2.3.3 index ac20542a..5fd6f6d8 100644 --- a/plugins/python-build/share/python-build/pyston-2.3.3 +++ b/plugins/python-build/share/python-build/pyston-2.3.3 @@ -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 diff --git a/plugins/python-build/share/python-build/pyston-2.3.4 b/plugins/python-build/share/python-build/pyston-2.3.4 index e61eb09f..67afd255 100644 --- a/plugins/python-build/share/python-build/pyston-2.3.4 +++ b/plugins/python-build/share/python-build/pyston-2.3.4 @@ -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 diff --git a/plugins/python-build/share/python-build/pyston-2.3.5 b/plugins/python-build/share/python-build/pyston-2.3.5 index caaac6b5..43302f33 100644 --- a/plugins/python-build/share/python-build/pyston-2.3.5 +++ b/plugins/python-build/share/python-build/pyston-2.3.5 @@ -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 diff --git a/plugins/python-build/test/pyenv_ext.bats b/plugins/python-build/test/pyenv_ext.bats index 09924fc6..27927164 100644 --- a/plugins/python-build/test/pyenv_ext.bats +++ b/plugins/python-build/test/pyenv_ext.bats @@ -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 <