From 7947efc130cadf6b9e3743dc4edc5b9a341b8995 Mon Sep 17 00:00:00 2001 From: binbjz <8213913+binbjz@users.noreply.github.com> Date: Fri, 28 Jun 2024 01:18:34 +0800 Subject: [PATCH 1/9] Add support for miniconda3 24.5.0-0 with py3.12, py3.11, py3.10, py3.9 (#2994) --- .../python-build/miniconda3-3.10-24.5.0-0 | 25 +++++++++++++++++++ .../python-build/miniconda3-3.11-24.5.0-0 | 25 +++++++++++++++++++ .../python-build/miniconda3-3.12-24.5.0-0 | 25 +++++++++++++++++++ .../python-build/miniconda3-3.9-24.5.0-0 | 25 +++++++++++++++++++ 4 files changed, 100 insertions(+) create mode 100644 plugins/python-build/share/python-build/miniconda3-3.10-24.5.0-0 create mode 100644 plugins/python-build/share/python-build/miniconda3-3.11-24.5.0-0 create mode 100644 plugins/python-build/share/python-build/miniconda3-3.12-24.5.0-0 create mode 100644 plugins/python-build/share/python-build/miniconda3-3.9-24.5.0-0 diff --git a/plugins/python-build/share/python-build/miniconda3-3.10-24.5.0-0 b/plugins/python-build/share/python-build/miniconda3-3.10-24.5.0-0 new file mode 100644 index 00000000..c759e635 --- /dev/null +++ b/plugins/python-build/share/python-build/miniconda3-3.10-24.5.0-0 @@ -0,0 +1,25 @@ +case "$(anaconda_architecture 2>/dev/null || true)" in +"Linux-aarch64" ) + install_script "Miniconda3-py310_24.5.0-0-Linux-aarch64.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py310_24.5.0-0-Linux-aarch64.sh#edcf076c80846beded0b72e98811cf7b93d0abc2ae93c060efc76f8da1e6fc45" "miniconda" verify_py310 + ;; +"Linux-s390x" ) + install_script "Miniconda3-py310_24.5.0-0-Linux-s390x.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py310_24.5.0-0-Linux-s390x.sh#e00f3d03d13fc4fa394a5d20a5476087237ee6cb029eba3b02322acc104b530b" "miniconda" verify_py310 + ;; +"Linux-x86_64" ) + install_script "Miniconda3-py310_24.5.0-0-Linux-x86_64.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py310_24.5.0-0-Linux-x86_64.sh#b3d73db6a05069fbdf20dc33fc9b6a29fa7198578f0d090c639f5ca0e84102bd" "miniconda" verify_py310 + ;; +"MacOSX-arm64" ) + install_script "Miniconda3-py310_24.5.0-0-MacOSX-arm64.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py310_24.5.0-0-MacOSX-arm64.sh#e422602aa19140c600b5889e5b41a0d7187640107ea82fcb5da857dd25330148" "miniconda" verify_py310 + ;; +"MacOSX-x86_64" ) + install_script "Miniconda3-py310_24.5.0-0-MacOSX-x86_64.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py310_24.5.0-0-MacOSX-x86_64.sh#6d7c1cc138adfc4bb2ccbb8a22eb8e9eb13a366b6af0d63245b643e6c3a3c708" "miniconda" verify_py310 + ;; +* ) + { echo + colorize 1 "ERROR" + echo ": The binary distribution of Miniconda is not available for $(anaconda_architecture 2>/dev/null || true)." + echo + } >&2 + exit 1 + ;; +esac diff --git a/plugins/python-build/share/python-build/miniconda3-3.11-24.5.0-0 b/plugins/python-build/share/python-build/miniconda3-3.11-24.5.0-0 new file mode 100644 index 00000000..ca06844b --- /dev/null +++ b/plugins/python-build/share/python-build/miniconda3-3.11-24.5.0-0 @@ -0,0 +1,25 @@ +case "$(anaconda_architecture 2>/dev/null || true)" in +"Linux-aarch64" ) + install_script "Miniconda3-py311_24.5.0-0-Linux-aarch64.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py311_24.5.0-0-Linux-aarch64.sh#94a742af7bf5c7bae3dba6bd07d84d94b858b839e15af2ea0cd10fdf2bde8a73" "miniconda" verify_py311 + ;; +"Linux-s390x" ) + install_script "Miniconda3-py311_24.5.0-0-Linux-s390x.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py311_24.5.0-0-Linux-s390x.sh#002963f32aebe1091d5da9a82416831f3c11217e6b4ea164c655f0d11f0cff80" "miniconda" verify_py311 + ;; +"Linux-x86_64" ) + install_script "Miniconda3-py311_24.5.0-0-Linux-x86_64.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py311_24.5.0-0-Linux-x86_64.sh#38b203bb1f2be78b735ebc00162f29e8e73fcd9a619ed5980490a72193ee1f58" "miniconda" verify_py311 + ;; +"MacOSX-arm64" ) + install_script "Miniconda3-py311_24.5.0-0-MacOSX-arm64.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py311_24.5.0-0-MacOSX-arm64.sh#a3d62f20f09e8079db76379090f21b7ae34832dadeb5a250e4fab324c8328727" "miniconda" verify_py311 + ;; +"MacOSX-x86_64" ) + install_script "Miniconda3-py311_24.5.0-0-MacOSX-x86_64.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py311_24.5.0-0-MacOSX-x86_64.sh#9e7dc7e0fbf0e9b2ff6bafdae9bf6ef122ae92d53533c2bbeb73433c0c6a4bd9" "miniconda" verify_py311 + ;; +* ) + { echo + colorize 1 "ERROR" + echo ": The binary distribution of Miniconda is not available for $(anaconda_architecture 2>/dev/null || true)." + echo + } >&2 + exit 1 + ;; +esac diff --git a/plugins/python-build/share/python-build/miniconda3-3.12-24.5.0-0 b/plugins/python-build/share/python-build/miniconda3-3.12-24.5.0-0 new file mode 100644 index 00000000..d9c91fdd --- /dev/null +++ b/plugins/python-build/share/python-build/miniconda3-3.12-24.5.0-0 @@ -0,0 +1,25 @@ +case "$(anaconda_architecture 2>/dev/null || true)" in +"Linux-aarch64" ) + install_script "Miniconda3-py312_24.5.0-0-Linux-aarch64.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py312_24.5.0-0-Linux-aarch64.sh#70afe954cc8ee91f605f9aa48985bfe01ecfc10751339e8245eac7262b01298d" "miniconda" verify_py312 + ;; +"Linux-s390x" ) + install_script "Miniconda3-py312_24.5.0-0-Linux-s390x.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py312_24.5.0-0-Linux-s390x.sh#bd2a0a8ea34c84c860868d5b8efde07afc51cdede76b64dd94e9c3fd2d65257e" "miniconda" verify_py312 + ;; +"Linux-x86_64" ) + install_script "Miniconda3-py312_24.5.0-0-Linux-x86_64.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py312_24.5.0-0-Linux-x86_64.sh#4b3b3b1b99215e85fd73fb2c2d7ebf318ac942a457072de62d885056556eb83e" "miniconda" verify_py312 + ;; +"MacOSX-arm64" ) + install_script "Miniconda3-py312_24.5.0-0-MacOSX-arm64.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py312_24.5.0-0-MacOSX-arm64.sh#12e678b8156aea69a132568b6176a019c7a1ba753ddf5caedf086d3c5460fe92" "miniconda" verify_py312 + ;; +"MacOSX-x86_64" ) + install_script "Miniconda3-py312_24.5.0-0-MacOSX-x86_64.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py312_24.5.0-0-MacOSX-x86_64.sh#b1c87c8334ea878d30a9976c1860b1004e6d55bdec5228089fec40be81156363" "miniconda" verify_py312 + ;; +* ) + { echo + colorize 1 "ERROR" + echo ": The binary distribution of Miniconda is not available for $(anaconda_architecture 2>/dev/null || true)." + echo + } >&2 + exit 1 + ;; +esac diff --git a/plugins/python-build/share/python-build/miniconda3-3.9-24.5.0-0 b/plugins/python-build/share/python-build/miniconda3-3.9-24.5.0-0 new file mode 100644 index 00000000..827ad869 --- /dev/null +++ b/plugins/python-build/share/python-build/miniconda3-3.9-24.5.0-0 @@ -0,0 +1,25 @@ +case "$(anaconda_architecture 2>/dev/null || true)" in +"Linux-aarch64" ) + install_script "Miniconda3-py39_24.5.0-0-Linux-aarch64.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py39_24.5.0-0-Linux-aarch64.sh#b716e3bc556e9ab7a4f206b04b53bd57c24e94956598d89fc78863b115cce9e8" "miniconda" verify_py39 + ;; +"Linux-s390x" ) + install_script "Miniconda3-py39_24.5.0-0-Linux-s390x.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py39_24.5.0-0-Linux-s390x.sh#c2d6bec964a96130eb5f1c4ea46993cf10f7957d45ac31d9aa94c34b5ebfed32" "miniconda" verify_py39 + ;; +"Linux-x86_64" ) + install_script "Miniconda3-py39_24.5.0-0-Linux-x86_64.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py39_24.5.0-0-Linux-x86_64.sh#07a2435123fd8f41e6528baa5f272ce754fd8acaef08ce7081afb00227b8754a" "miniconda" verify_py39 + ;; +"MacOSX-arm64" ) + install_script "Miniconda3-py39_24.5.0-0-MacOSX-arm64.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py39_24.5.0-0-MacOSX-arm64.sh#f5f63a0de44b7b0872f3c00dca71b896933ccc844a93bf120aad6df66b6475b3" "miniconda" verify_py39 + ;; +"MacOSX-x86_64" ) + install_script "Miniconda3-py39_24.5.0-0-MacOSX-x86_64.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py39_24.5.0-0-MacOSX-x86_64.sh#b65d7f01820bdfe1abb6b4dd84d48e6c62a6d72ee0cc400a4e8bb4ea89ff1c84" "miniconda" verify_py39 + ;; +* ) + { echo + colorize 1 "ERROR" + echo ": The binary distribution of Miniconda is not available for $(anaconda_architecture 2>/dev/null || true)." + echo + } >&2 + exit 1 + ;; +esac From d660c5a84f6b03a94961eb0e49adb2b25cd091b1 Mon Sep 17 00:00:00 2001 From: Sam Gross Date: Thu, 27 Jun 2024 16:18:14 -0400 Subject: [PATCH 2/9] Add support for free-threaded Python (#2995) --- plugins/python-build/bin/python-build | 7 +++++++ plugins/python-build/share/python-build/3.13t-dev | 2 ++ plugins/python-build/share/python-build/3.14t-dev | 2 ++ 3 files changed, 11 insertions(+) create mode 100644 plugins/python-build/share/python-build/3.13t-dev create mode 100644 plugins/python-build/share/python-build/3.14t-dev diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index 923fcc62..a0be4fbf 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -822,6 +822,7 @@ build_package_standard_build() { use_homebrew_zlib || true fi use_dsymutil || true + use_free_threading || true fi ( if [ "${CFLAGS+defined}" ] || [ "${!PACKAGE_CFLAGS+defined}" ]; then @@ -1761,6 +1762,12 @@ use_dsymutil() { fi } +use_free_threading() { + if [[ -n "$PYTHON_BUILD_FREE_THREADING" ]]; then + package_option python configure --disable-gil + fi +} + build_package_enable_shared() { package_option python configure --enable-shared } diff --git a/plugins/python-build/share/python-build/3.13t-dev b/plugins/python-build/share/python-build/3.13t-dev new file mode 100644 index 00000000..cd9d2f09 --- /dev/null +++ b/plugins/python-build/share/python-build/3.13t-dev @@ -0,0 +1,2 @@ +export PYTHON_BUILD_FREE_THREADING=1 +source "$(dirname "${BASH_SOURCE[0]}")"/3.13-dev diff --git a/plugins/python-build/share/python-build/3.14t-dev b/plugins/python-build/share/python-build/3.14t-dev new file mode 100644 index 00000000..7c6180f0 --- /dev/null +++ b/plugins/python-build/share/python-build/3.14t-dev @@ -0,0 +1,2 @@ +export PYTHON_BUILD_FREE_THREADING=1 +source "$(dirname "${BASH_SOURCE[0]}")"/3.14-dev From 9546f729f775342f7ed5dc83c36531043d4f7fa3 Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Thu, 27 Jun 2024 23:21:27 +0300 Subject: [PATCH 3/9] 2.4.4 --- CHANGELOG.md | 4 ++++ libexec/pyenv---version | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2b18f76..4295c45c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Version History +## Release v2.4.4 +* Add support for miniconda3 24.5.0-0 with py3.12, py3.11, py3.10, py3.9 by @binbjz in https://github.com/pyenv/pyenv/pull/2994 +* Add support for free-threaded Python by @colesbury in https://github.com/pyenv/pyenv/pull/2995 + ## Release v2.4.3 * Add miniconda3 24.4.0-0 by @binbjz in https://github.com/pyenv/pyenv/pull/2982 diff --git a/libexec/pyenv---version b/libexec/pyenv---version index 73758005..c6046b55 100755 --- a/libexec/pyenv---version +++ b/libexec/pyenv---version @@ -12,7 +12,7 @@ set -e [ -n "$PYENV_DEBUG" ] && set -x -version="2.4.3" +version="2.4.4" git_revision="" if cd "${BASH_SOURCE%/*}" 2>/dev/null && git remote -v 2>/dev/null | grep -q pyenv; then From e8e8cfddcd72df55e01db7c2eec6c21bc1f35ee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez=20Mondrag=C3=B3n?= <16805946+edgarrmondragon@users.noreply.github.com> Date: Sun, 30 Jun 2024 11:55:53 -0600 Subject: [PATCH 4/9] Add CPython 3.13.0b3 (#2996) --- .../python-build/share/python-build/{3.13.0b2 => 3.13.0b3} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename plugins/python-build/share/python-build/{3.13.0b2 => 3.13.0b3} (57%) diff --git a/plugins/python-build/share/python-build/3.13.0b2 b/plugins/python-build/share/python-build/3.13.0b3 similarity index 57% rename from plugins/python-build/share/python-build/3.13.0b2 rename to plugins/python-build/share/python-build/3.13.0b3 index 88c2fc55..f286f05b 100644 --- a/plugins/python-build/share/python-build/3.13.0b2 +++ b/plugins/python-build/share/python-build/3.13.0b3 @@ -3,7 +3,7 @@ export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1 install_package "openssl-3.3.1" "https://www.openssl.org/source/openssl-3.3.1.tar.gz#777cd596284c883375a2a7a11bf5d2786fc5413255efab20c50d6ffe6d020b7e" mac_openssl --if has_broken_mac_openssl install_package "readline-8.2" "https://ftpmirror.gnu.org/readline/readline-8.2.tar.gz#3feb7171f16a84ee82ca18a36d7b9be109a52c04f492a053331d7d1095007c35" mac_readline --if has_broken_mac_readline if has_tar_xz_support; then - install_package "Python-3.13.0b2" "https://www.python.org/ftp/python/3.13.0/Python-3.13.0b2.tar.xz#bf11be01b42a07a3659e4e233591e03da631b7112aa61ee1e030eeb8c5dfd869" standard verify_py313 copy_python_gdb ensurepip + install_package "Python-3.13.0b3" "https://www.python.org/ftp/python/3.13.0/Python-3.13.0b3.tar.xz#3be094ad08b11dc2a065463524239c78dc9f2b342b01dcd4e1e606dbbc5c78a5" standard verify_py313 copy_python_gdb ensurepip else - install_package "Python-3.13.0b2" "https://www.python.org/ftp/python/3.13.0/Python-3.13.0b2.tgz#c87c42aa8137230a15a02ed90a6600610ba680cb5b54c0fbc57581a0d032e0c4" standard verify_py313 copy_python_gdb ensurepip + install_package "Python-3.13.0b3" "https://www.python.org/ftp/python/3.13.0/Python-3.13.0b3.tgz#5e9c01cdb3e2fb1f5732a55e9522cb6a011693e795ec347b3f69ff5e217175e4" standard verify_py313 copy_python_gdb ensurepip fi From 2c2c7616e2c3a8ab7623bea3c353ff520750b812 Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Sun, 30 Jun 2024 20:58:02 +0300 Subject: [PATCH 5/9] 2.4.5 --- CHANGELOG.md | 3 +++ libexec/pyenv---version | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4295c45c..3ed452e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Version History +## Release v2.4.5 +* Add CPython 3.13.0b3 by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/2996 + ## Release v2.4.4 * Add support for miniconda3 24.5.0-0 with py3.12, py3.11, py3.10, py3.9 by @binbjz in https://github.com/pyenv/pyenv/pull/2994 * Add support for free-threaded Python by @colesbury in https://github.com/pyenv/pyenv/pull/2995 diff --git a/libexec/pyenv---version b/libexec/pyenv---version index c6046b55..79b0d347 100755 --- a/libexec/pyenv---version +++ b/libexec/pyenv---version @@ -12,7 +12,7 @@ set -e [ -n "$PYENV_DEBUG" ] && set -x -version="2.4.4" +version="2.4.5" git_revision="" if cd "${BASH_SOURCE%/*}" 2>/dev/null && git remote -v 2>/dev/null | grep -q pyenv; then From 1bcaab05b71601269b91185a4cbeb3aa037a00a8 Mon Sep 17 00:00:00 2001 From: native-api Date: Mon, 1 Jul 2024 22:38:06 +0300 Subject: [PATCH 6/9] CI: push MacOS jobs to MacOS 13 and 14 (#3002) Github has finally released those as free and retired macos-11 --- .github/workflows/macos_build.yml | 2 +- .github/workflows/modified_scripts_build.yml | 2 +- .github/workflows/pyenv_tests.yml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/macos_build.yml b/.github/workflows/macos_build.yml index 6622b6a3..6459fabc 100644 --- a/.github/workflows/macos_build.yml +++ b/.github/workflows/macos_build.yml @@ -15,7 +15,7 @@ jobs: - "3.10" - "3.11" - "3.12" - runs-on: macos-11 + runs-on: macos-14 steps: - uses: actions/checkout@v4 # Normally, we would use the superbly maintained... diff --git a/.github/workflows/modified_scripts_build.yml b/.github/workflows/modified_scripts_build.yml index 79dbdb89..1f5cf7f4 100644 --- a/.github/workflows/modified_scripts_build.yml +++ b/.github/workflows/modified_scripts_build.yml @@ -30,7 +30,7 @@ jobs: fail-fast: false matrix: python-version: ${{fromJson(needs.discover_modified_scripts.outputs.versions)}} - os: ["macos-11", "macos-12"] + os: ["macos-13", "macos-14"] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/pyenv_tests.yml b/.github/workflows/pyenv_tests.yml index f05430cd..aa8f4959 100644 --- a/.github/workflows/pyenv_tests.yml +++ b/.github/workflows/pyenv_tests.yml @@ -12,8 +12,8 @@ jobs: os: - ubuntu-22.04 - ubuntu-20.04 - - macos-12 - - macos-11 + - macos-14 + - macos-13 runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 From 384361167a372068e3bb2f0f5627519ec8f90774 Mon Sep 17 00:00:00 2001 From: Sam Gross Date: Mon, 1 Jul 2024 15:50:03 -0400 Subject: [PATCH 7/9] Add 3.13.0b3t and exclude it from `pyenv latest` (#3001) This adds the free-threaded (without GIL) version of 3.13.0b3. Co-authored-by: Ivan Pozdeev --- libexec/pyenv-latest | 2 +- plugins/python-build/share/python-build/3.13.0b3t | 2 ++ pyenv.d/install/latest.bash | 2 +- test/latest.bats | 3 +++ 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 plugins/python-build/share/python-build/3.13.0b3t diff --git a/libexec/pyenv-latest b/libexec/pyenv-latest index d5e95e95..6f2d9e97 100755 --- a/libexec/pyenv-latest +++ b/libexec/pyenv-latest @@ -50,7 +50,7 @@ IFS=$'\n' DEFINITION_CANDIDATES=(\ $(printf '%s\n' "${DEFINITION_CANDIDATES[@]}" | \ - sed -E -e '/-dev$/d' -e '/-src$/d' -e '/-latest$/d' -e '/(a|b|rc)[0-9]+$/d')); + sed -E -e '/-dev$/d' -e '/-src$/d' -e '/-latest$/d' -e '/(a|b|rc)[0-9]+$/d' -e '/[0-9]+t$/d')); # Compose a sorting key, followed by | and original value DEFINITION_CANDIDATES=(\ diff --git a/plugins/python-build/share/python-build/3.13.0b3t b/plugins/python-build/share/python-build/3.13.0b3t new file mode 100644 index 00000000..31f54da0 --- /dev/null +++ b/plugins/python-build/share/python-build/3.13.0b3t @@ -0,0 +1,2 @@ +export PYTHON_BUILD_FREE_THREADING=1 +source "$(dirname "${BASH_SOURCE[0]}")"/3.13.0b3 diff --git a/pyenv.d/install/latest.bash b/pyenv.d/install/latest.bash index 790b2dd1..c99162b3 100644 --- a/pyenv.d/install/latest.bash +++ b/pyenv.d/install/latest.bash @@ -10,7 +10,7 @@ pyenv_install_resolve_latest() { $(python-build --definitions | \ grep -F "${DEFINITION_PREFIX}" | \ grep "^${DEFINITION_TYPE}" | \ - sed -E -e '/-dev$/d' -e '/-src$/d' -e '/(b|rc)[0-9]+$/d' | \ + sed -E -e '/-dev$/d' -e '/-src$/d' -e '/(b|rc)[0-9]+$/d' -e '/[0-9]+t$/d' | \ sort -t. -k1,1r -k 2,2nr -k 3,3nr \ || true)) DEFINITION="${DEFINITION_CANDIDATES}" diff --git a/test/latest.bats b/test/latest.bats index c145eff7..d382a926 100644 --- a/test/latest.bats +++ b/test/latest.bats @@ -103,6 +103,9 @@ echo 3.8.5-latest echo 3.8.5a2 echo 3.8.5b3 echo 3.8.5rc2 +echo 3.8.5t +echo 3.8.5b3t +echo 3.8.5rc2t echo 3.8.1 echo 3.8.1/envs/foo ! From 672eef15618072112ae157f1b023cee0b5b01da4 Mon Sep 17 00:00:00 2001 From: Jon Crall Date: Wed, 3 Jul 2024 20:49:12 -0400 Subject: [PATCH 8/9] Speed up pyenv prefix by not constructing advice text when it would be discarded (#3005) by adding an internal flag --- libexec/pyenv-prefix | 6 ++--- libexec/pyenv-versions | 6 ++--- libexec/pyenv-which | 54 +++++++++++++++++++++++++++--------------- test/which.bats | 12 ++++++++++ 4 files changed, 53 insertions(+), 25 deletions(-) diff --git a/libexec/pyenv-prefix b/libexec/pyenv-prefix index 38b8f823..261b865f 100755 --- a/libexec/pyenv-prefix +++ b/libexec/pyenv-prefix @@ -30,9 +30,9 @@ OLDIFS="$IFS" { IFS=: for version in ${PYENV_VERSION}; do if [ "$version" = "system" ]; then - if PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python 2>/dev/null)" || \ - PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python3 2>/dev/null)" || \ - PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python2 2>/dev/null)"; then + if PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python --skip-advice 2>/dev/null)" || \ + PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python3 --skip-advice 2>/dev/null)" || \ + PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python2 --skip-advice 2>/dev/null)"; then shopt -s extglob # In some distros (Arch), Python can be found in sbin as well as bin PYENV_PREFIX_PATH="${PYTHON_PATH%/?(s)bin/*}" diff --git a/libexec/pyenv-versions b/libexec/pyenv-versions index 0dd57dec..dbccaa32 100755 --- a/libexec/pyenv-versions +++ b/libexec/pyenv-versions @@ -128,9 +128,9 @@ print_version() { # Include "system" in the non-bare output, if it exists if [ -n "$include_system" ] && \ - (PYENV_VERSION=system pyenv-which python >/dev/null 2>&1 || \ - PYENV_VERSION=system pyenv-which python3 >/dev/null 2>&1 || \ - PYENV_VERSION=system pyenv-which python2 >/dev/null 2>&1) ; then + (PYENV_VERSION=system pyenv-which python --skip-advice >/dev/null 2>&1 || \ + PYENV_VERSION=system pyenv-which python3 --skip-advice >/dev/null 2>&1 || \ + PYENV_VERSION=system pyenv-which python2 --skip-advice >/dev/null 2>&1) ; then print_version system "/" fi diff --git a/libexec/pyenv-which b/libexec/pyenv-which index 29b44318..6f12761e 100755 --- a/libexec/pyenv-which +++ b/libexec/pyenv-which @@ -2,13 +2,14 @@ # # Summary: Display the full path to an executable # -# Usage: pyenv which [--nosystem] +# Usage: pyenv which [--nosystem] [--skip-advice] # # Displays the full path to the executable that pyenv will invoke when # you run the given command. # Use --nosystem argument in case when you don't need to search command in the # system environment. -# +# Internal switch --skip-advice used to skip printing an error message on a +# failed search. set -e [ -n "$PYENV_DEBUG" ] && set -x @@ -18,11 +19,27 @@ if [ "$1" = "--complete" ]; then exec pyenv-shims --short fi -if [ "$2" = "--nosystem" ]; then - system="" -else - system="system" -fi +system="system" +SKIP_ADVICE="" +PYENV_COMMAND="$1" + +while [[ $# -gt 0 ]] +do + case "$1" in + --skip-advice) + SKIP_ADVICE=1 + shift + ;; + --nosystem) + system="" + shift + ;; + *) + shift + ;; + esac +done + remove_from_path() { local path_to_remove="$1" @@ -36,8 +53,6 @@ remove_from_path() { echo "${result#:}" } -PYENV_COMMAND="$1" - if [ -z "$PYENV_COMMAND" ]; then pyenv-help --usage which >&2 exit 1 @@ -85,16 +100,17 @@ else fi echo "pyenv: $PYENV_COMMAND: command not found" >&2 - - versions="$(pyenv-whence "$PYENV_COMMAND" || true)" - if [ -n "$versions" ]; then - { echo - echo "The \`$1' command exists in these Python versions:" - echo "$versions" | sed 's/^/ /g' - echo - echo "Note: See 'pyenv help global' for tips on allowing both" - echo " python2 and python3 to be found." - } >&2 + if [ -z "$SKIP_ADVICE" ]; then + versions="$(pyenv-whence "$PYENV_COMMAND" || true)" + if [ -n "$versions" ]; then + { echo + echo "The \`$PYENV_COMMAND' command exists in these Python versions:" + echo "$versions" | sed 's/^/ /g' + echo + echo "Note: See 'pyenv help global' for tips on allowing both" + echo " python2 and python3 to be found." + } >&2 + fi fi exit 127 diff --git a/test/which.bats b/test/which.bats index 193b95a4..e6c4ee69 100644 --- a/test/which.bats +++ b/test/which.bats @@ -155,3 +155,15 @@ exit PYENV_VERSION=3.4 run pyenv-which python assert_success "version=3.4.2" } + +@test "skip advice supresses error messages" { + create_executable "2.7" "python" + create_executable "3.3" "py.test" + create_executable "3.4" "py.test" + + PYENV_VERSION=2.7 run pyenv-which py.test --skip-advice + assert_failure + assert_output < Date: Fri, 5 Jul 2024 06:56:36 +0300 Subject: [PATCH 9/9] 2.4.6 --- CHANGELOG.md | 5 +++++ libexec/pyenv---version | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ed452e1..dfba5607 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Version History +## Release v2.4.6 +* CI: push MacOS jobs to MacOS 13 and 14 by @native-api in https://github.com/pyenv/pyenv/pull/3002 +* Add 3.13.0b3t and exclude it from `pyenv latest` by @colesbury in https://github.com/pyenv/pyenv/pull/3001 +* Speed up `pyenv prefix` by not constructing advice text when it would be discarded by @Erotemic in https://github.com/pyenv/pyenv/pull/3005 + ## Release v2.4.5 * Add CPython 3.13.0b3 by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/2996 diff --git a/libexec/pyenv---version b/libexec/pyenv---version index 79b0d347..ec87819d 100755 --- a/libexec/pyenv---version +++ b/libexec/pyenv---version @@ -12,7 +12,7 @@ set -e [ -n "$PYENV_DEBUG" ] && set -x -version="2.4.5" +version="2.4.6" git_revision="" if cd "${BASH_SOURCE%/*}" 2>/dev/null && git remote -v 2>/dev/null | grep -q pyenv; then