Compare commits

..

35 Commits

Author SHA1 Message Date
exurd
ce491008e7
python-build: advise user with no c compiler (#3294)
this checks if "no acceptable C compiler found" is in the last 10 lines of the log, and asks if the user has correctly installed the build dependencies.
2026-04-01 21:32:48 +03:00
dependabot[bot]
d26308df49
Bump actions/create-github-app-token in the github-actions group (#3428)
Bumps the github-actions group with 1 update: [actions/create-github-app-token](https://github.com/actions/create-github-app-token).


Updates `actions/create-github-app-token` from 2 to 3
- [Release notes](https://github.com/actions/create-github-app-token/releases)
- [Commits](https://github.com/actions/create-github-app-token/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/create-github-app-token
  dependency-version: '3'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-01 09:31:31 +03:00
Ivan Pozdeev
8397a19c64
- outdated info
[no ci]
2026-03-24 09:05:13 +03:00
Ivan Pozdeev
0d71a264c2
Fix factual errors; highlight pyenv install 3
Closes #3427
[no ci]
2026-03-23 18:12:11 +03:00
Ivan Pozdeev
a6521a0d35
Fix link
[no ci]
2026-03-23 17:05:57 +03:00
native-api
044d816d35
which: update pyenv help global tip (#3424) 2026-03-14 11:23:19 +03:00
Jake Lodwick
6a246fad63
commands: fast path for --sh, replace sort|uniq with sort -u (#3423) 2026-03-13 13:56:23 +03:00
Ivan Pozdeev
174c61526f
2.6.26 2026-03-11 01:37:45 +03:00
native-api
397312d0c3
Merge pull request #3422 from native-api/miniconda3-26.1.1-1
Add miniconda3-26.1.1-1
2026-03-11 01:35:04 +03:00
Ivan Pozdeev
5bd084d816
Add miniconda3-26.1.1-1 2026-03-11 01:18:41 +03:00
Ivan Pozdeev
974e820478
Replace patterns with f-strings for logging
fix KeyError: out_dir
2026-03-11 01:17:34 +03:00
pyenv-bot[bot]
a47dae9131
Add CPython 3.15.0a7 (#3421) 2026-03-11 01:11:17 +03:00
Ivan Pozdeev
d5cd462a35
Revert "Add miniconda3-26.1.1-1 (#3420)"
This reverts commit 1534421e564e2fe74bfa23fb4516294fbeb3ae06.

The scripts actually contain the previous version, 25.11.1-1
2026-03-10 08:23:42 +03:00
binbjz
1534421e56
Add miniconda3-26.1.1-1 (#3420)
Co-authored-by: binbjz <binbjz@gmail.com>
2026-03-10 08:21:06 +03:00
Jake Lodwick
e985ffab82
rehash: simplify source.bash pipeline (#3419)
Same cleanup applied to conda.bash in #3151.
2026-03-10 08:15:46 +03:00
native-api
8037f22665
rehash: streamline executables discovery; fix regression (#3418)
Separate the corner-cutting code for `rehash' into a dedicated branch.

Saves some more time (about 100ms for the large fixture)
2026-03-07 13:09:14 +03:00
Tekin Tian
d5fa1e225e
Fix MacPorts OpenSSL formula detection (#3417)
Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
2026-03-07 11:44:57 +03:00
Jake Lodwick
23bcdebe18
versions: fast path for --bare --skip-aliases (#3411)
Skip sort, native extension probe, and per-symlink realpath
when called with --bare --skip-aliases (the rehash case).
Use readlink to distinguish internal aliases (relative target)
from external installs (absolute target).

In MacOS, speeds up rehash by 5.2 ms (7%) in empty environment,
55.9 ms (33%) in a regular environment (3 ver, 12 venvs, 320 bins),
93.7 ms (15%) in a large environment (6 ver, 60 venvs, 1466 bins)
2026-03-04 10:02:44 +03:00
Ivan Pozdeev
aa2e8b8260
2.6.25 2026-03-03 20:06:38 +03:00
pyenv-bot[bot]
c9d3829169
Add CPython 3.12.13 (#3414) 2026-03-03 20:04:59 +03:00
native-api
05d3a598c4
Add miniforge3-26.1.0-0 (#3413) 2026-03-03 09:07:15 +03:00
Ivan Pozdeev
c89b6b46dc
2.6.24 2026-03-03 08:17:57 +03:00
pyenv-bot[bot]
c4ed80826f
Add CPython 3.10.20, 3.11.15
Co-authored-by: native-api <2670332+native-api@users.noreply.github.com>
2026-03-03 08:15:01 +03:00
Jake Lodwick
47871b2dc3
rehash: drop redundant sort -u from make_shims call (#3410)
register_shim() already deduplicates via associative array (bash 4+) or
by checking if a shim already exists (bash 3.2). The sort -u pipe in the make_shims
call is thus redundant -- the dedup happens downstream regardless. Shim
creation is order-independent and idempotent, so sorting has no semantic
effect either.

Saves one subprocess fork during every rehash invocation.
2026-03-02 00:36:24 +03:00
binbjz
43e83b52a2
Add Anaconda3-2025.12-2 (#3408)
Co-authored-by: binbjz <binbjz@gmail.com>
2026-02-21 00:32:12 +03:00
Ivan Pozdeev
9279111a60
Revert accidentally left test code from "CI: add_version: use Github App token to create PR"
This partially reverts commit 47b6fce29daf3d58acc77a21077a4b01e8278409.
2026-02-19 07:41:21 +03:00
native-api
3100654510
Merge pull request #3406 from pyenv/use_github_app_token
CI: add_version: use Github App token to create PR
2026-02-19 06:05:04 +03:00
Ivan Pozdeev
06bac52676
add_cpython: fix erroneously deleting old thunks
Looks like a leftover from older logic, before
we `git mv`'d thunks on prerelease upgrade
2026-02-19 04:56:42 +03:00
Ivan Pozdeev
47b6fce29d
CI: add_version: use Github App token to create PR
The only way atm that allows to both trigger CI
and get PR notifications, as per
https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#authenticating-with-github-app-generated-tokens

Created helper app https://github.com/apps/pyenv-bot/
2026-02-19 04:56:41 +03:00
Ivan Pozdeev
81befc1592
2.6.23 2026-02-17 02:38:47 +03:00
native-api
c44f03c058
Add CPython 3.15.0a6 (#3403)
Co-authored-by: native-api <2670332+native-api@users.noreply.github.com>
2026-02-17 02:36:26 +03:00
Ivan Pozdeev
b2a43bbcdb
CI: add_verison: Don't run "set PR properties" unnecessarily 2026-02-04 13:58:08 +03:00
Ivan Pozdeev
2f10394d33
CI: add_version: fix Actions not triggering for the pull request 2026-02-04 04:15:00 +03:00
Ivan Pozdeev
57ec277d6a
2.6.22 2026-02-04 03:52:39 +03:00
github-actions[bot]
63edb91375
Add CPython 3.13.12 (#3401) 2026-02-04 03:50:15 +03:00
31 changed files with 336 additions and 86 deletions

View File

@ -15,18 +15,19 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- uses: actions/setup-python@v6 - uses: actions/setup-python@v6
with: with:
python-version: 3 python-version: 3
cache: 'pip' cache: 'pip'
cache-dependency-path: plugins/python-build/scripts/requirements.txt cache-dependency-path: plugins/python-build/scripts/requirements.txt
- run: pip install -r plugins/python-build/scripts/requirements.txt - run: pip install -r plugins/python-build/scripts/requirements.txt
- name: check for a release - name: check for a release
run: | run: |
python plugins/python-build/scripts/add_cpython.py --verbose >added_versions.lst && rc=$? || rc=$? python plugins/python-build/scripts/add_cpython.py --verbose >added_versions.lst && rc=$? || rc=$?
echo "rc=$rc" >> $GITHUB_ENV echo "rc=$rc" >> $GITHUB_ENV
- name: set PR properties - name: set PR properties
if: env.rc == 0
shell: python shell: python
run: | run: |
import os import os
@ -36,10 +37,19 @@ jobs:
f.write(f'branch_name=auto_add_version/{"_".join(versions)}\n') f.write(f'branch_name=auto_add_version/{"_".join(versions)}\n')
f.write(f'pr_name=Add CPython {", ".join(versions)}\n') f.write(f'pr_name=Add CPython {", ".join(versions)}\n')
os.remove("added_versions.lst") os.remove("added_versions.lst")
# https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#authenticating-with-github-app-generated-tokens
- name: Generate Github token
if: env.rc == 0
uses: actions/create-github-app-token@v3
id: generate-token
with:
app-id: ${{ vars.PYENV_BOT_APP_ID }}
private-key: ${{ secrets.PYENV_BOT_PRIVATE_KEY }}
- name: Create Pull Request - name: Create Pull Request
uses: peter-evans/create-pull-request@v8 uses: peter-evans/create-pull-request@v8
if: env.rc == 0 if: env.rc == 0
with: with:
branch: ${{ env.branch_name }} branch: ${{ env.branch_name }}
title: ${{ env.pr_name }} title: ${{ env.pr_name }}
token: ${{ steps.generate-token.outputs.token }}

View File

@ -1,5 +1,28 @@
# Version History # Version History
## Release v2.6.26
* versions: fast path for --bare --skip-aliases by @jakelodwick in https://github.com/pyenv/pyenv/pull/3411
* Fix MacPorts OpenSSL formula detection by @tekintian in https://github.com/pyenv/pyenv/pull/3417
* rehash: streamline executables discovery; fix regression by @native-api in https://github.com/pyenv/pyenv/pull/3418
* rehash: simplify source.bash pipeline by @jakelodwick in https://github.com/pyenv/pyenv/pull/3419
* Add CPython 3.15.0a7 by @pyenv-bot[bot] in https://github.com/pyenv/pyenv/pull/3421
## Release v2.6.25
* Add miniforge3-26.1.0-0 by @native-api in https://github.com/pyenv/pyenv/pull/3413
* Add CPython 3.12.13 by @pyenv-bot[bot] in https://github.com/pyenv/pyenv/pull/3414
## Release v2.6.24
* CI: add_version: use Github App token to create PR by @native-api in https://github.com/pyenv/pyenv/pull/3406
* Add Anaconda3-2025.12-2 by @binbjz in https://github.com/pyenv/pyenv/pull/3408
* rehash: Drop redundant sort -u from make_shims call by @jakelodwick in https://github.com/pyenv/pyenv/pull/3410
* Add CPython 3.10.20, 3.11.15 by @pyenv-bot[bot] in https://github.com/pyenv/pyenv/pull/3412
## Release v2.6.23
* Add CPython 3.15.0a6 by @native-api in https://github.com/pyenv/pyenv/pull/3403
## Release v2.6.22
* Add CPython 3.13.12 by @github-actions[bot] in https://github.com/pyenv/pyenv/pull/3401
## Release v2.6.21 ## Release v2.6.21
* Add GraalPy 25.0.2 by @msimacek in https://github.com/pyenv/pyenv/pull/3395 * Add GraalPy 25.0.2 by @msimacek in https://github.com/pyenv/pyenv/pull/3395
* Add CPython 3.14.3 by @github-actions[bot] in https://github.com/pyenv/pyenv/pull/3400 * Add CPython 3.14.3 by @github-actions[bot] in https://github.com/pyenv/pyenv/pull/3400

View File

@ -40,9 +40,8 @@ Lists all available pyenv commands.
Sets a local application-specific Python version by writing the version Sets a local application-specific Python version by writing the version
name to a `.python-version` file in the current directory. This version name to a `.python-version` file in the current directory. This version
overrides the global version, and can be overridden itself by setting overrides the [global version](#pyenv-global), and can be overridden
the `PYENV_VERSION` environment variable or with the `pyenv shell` itself with the [`pyenv shell`](#pyenv-shell) command.
command.
$ pyenv local 2.7.6 $ pyenv local 2.7.6
@ -98,9 +97,8 @@ This is mainly useful in special cases like provisioning scripts.
## `pyenv global` ## `pyenv global`
Sets the global version of Python to be used in all shells by writing Sets the global version of Python to be used in all shells by writing
the version name to the `~/.pyenv/version` file. This version can be the version name to the `$PYENV_ROOT/version` file. This version can be
overridden by an application-specific `.python-version` file, or by overridden with [`pyenv local`](#pyenv-local) or [`pyenv shell`](#pyenv-shell).
setting the `PYENV_VERSION` environment variable.
$ pyenv global 2.7.6 $ pyenv global 2.7.6
@ -236,6 +234,7 @@ Then install the desired versions:
You can also install the latest version of Python in a specific version line by supplying a prefix instead of a complete name: You can also install the latest version of Python in a specific version line by supplying a prefix instead of a complete name:
$ pyenv install 3.10 $ pyenv install 3.10
$ pyenv install 3
See the [`pyenv latest` documentation](#pyenv-latest) for details on prefix resolution. See the [`pyenv latest` documentation](#pyenv-latest) for details on prefix resolution.
@ -243,9 +242,6 @@ An older option is to use the `:latest` syntax. For example, to install the late
pyenv install 3.8:latest pyenv install 3.8:latest
To install the latest major release for Python 3 try:
pyenv install 3:latest
## `pyenv uninstall` ## `pyenv uninstall`
@ -352,10 +348,9 @@ locations of the currently selected versions.
Displays the latest installed or known version with the given prefix Displays the latest installed or known version with the given prefix
Usage: pyenv latest [-k|--known] [-q|--quiet] <prefix> Usage: pyenv latest [-k|--known] <prefix>
-k/--known Select from all known versions instead of installed -k/--known Select from all known versions instead of installed
-q/--quiet Do not print an error message on resolution failure
Only full prefixes are searched: in the actual name, the given prefix must be followed by a dot or a dash. Only full prefixes are searched: in the actual name, the given prefix must be followed by a dot or a dash.

View File

@ -407,7 +407,7 @@ of the following commands:
* [`pyenv shell <version>`](COMMANDS.md#pyenv-shell) -- select just for current shell session * [`pyenv shell <version>`](COMMANDS.md#pyenv-shell) -- select just for current shell session
* [`pyenv local <version>`](COMMANDS.md#pyenv-local) -- automatically select whenever you are in the current directory (or its subdirectories) * [`pyenv local <version>`](COMMANDS.md#pyenv-local) -- automatically select whenever you are in the current directory (or its subdirectories)
* [`pyenv global <version>`](COMMANDS.md#pyenv-shell) -- select globally for your user account * [`pyenv global <version>`](COMMANDS.md#pyenv-global) -- select globally for your user account
E.g. to select the above-mentioned newly-installed Python 3.10.4 as your preferred version to use: E.g. to select the above-mentioned newly-installed Python 3.10.4 as your preferred version to use:

View File

@ -12,7 +12,7 @@
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
version="2.6.21" version="2.6.26"
git_revision="" git_revision=""
if cd "${BASH_SOURCE%/*}" 2>/dev/null && git remote -v 2>/dev/null | grep -q pyenv; then if cd "${BASH_SOURCE%/*}" 2>/dev/null && git remote -v 2>/dev/null | grep -q pyenv; then

View File

@ -3,19 +3,19 @@
# Usage: pyenv commands [--sh|--no-sh] # Usage: pyenv commands [--sh|--no-sh]
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [[ -n $PYENV_DEBUG ]] && set -x
# Provide pyenv completions # Provide pyenv completions
if [ "$1" = "--complete" ]; then if [[ $1 = "--complete" ]]; then
echo --sh echo --sh
echo --no-sh echo --no-sh
exit exit
fi fi
if [ "$1" = "--sh" ]; then if [[ $1 = "--sh" ]]; then
sh=1 sh=1
shift shift
elif [ "$1" = "--no-sh" ]; then elif [[ $1 = "--no-sh" ]]; then
nosh=1 nosh=1
shift shift
fi fi
@ -24,20 +24,25 @@ IFS=: paths=($PATH)
shopt -s nullglob shopt -s nullglob
{ for path in "${paths[@]}"; do {
for command in "${path}/pyenv-"*; do if [[ -n $sh ]]; then
command="${command##*pyenv-}" for path in "${paths[@]}"; do
if [ -n "$sh" ]; then for command in "${path}"/pyenv-sh-*; do
if [ "${command:0:3}" = "sh-" ]; then echo "${command##*/pyenv-sh-}"
echo "${command##sh-}" done
fi
elif [ -n "$nosh" ]; then
if [ "${command:0:3}" != "sh-" ]; then
echo "${command##sh-}"
fi
else
echo "${command##sh-}"
fi
done done
done else
} | sort | uniq for path in "${paths[@]}"; do
for command in "${path}"/pyenv-*; do
command="${command##*/pyenv-}"
if [[ -n $nosh ]]; then
if [[ ${command:0:3} != "sh-" ]]; then
echo "$command"
fi
else
echo "${command##sh-}"
fi
done
done
fi
} | sort -u

View File

@ -110,17 +110,6 @@ remove_outdated_shims() {
done done
} }
# List basenames of executables for every Python version
list_executable_names() {
local version file
pyenv-versions --bare --skip-aliases | \
while read -r version; do
for file in "${PYENV_ROOT}/versions/${version}/bin/"*; do
echo "${file##*/}"
done
done
}
# The basename of each argument passed to `make_shims` will be # The basename of each argument passed to `make_shims` will be
# registered for installation as a shim. In this way, plugins may call # registered for installation as a shim. In this way, plugins may call
# `make_shims` with a glob to register many shims at once. # `make_shims` with a glob to register many shims at once.
@ -196,7 +185,7 @@ shopt -s nullglob
create_prototype_shim create_prototype_shim
remove_outdated_shims remove_outdated_shims
# shellcheck disable=SC2046 # shellcheck disable=SC2046
make_shims $(list_executable_names | sort -u) make_shims $(pyenv-versions --executables)
# Allow plugins to register shims. # Allow plugins to register shims.

View File

@ -1,13 +1,21 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Summary: List all Python versions available to pyenv # Summary: List all Python versions available to pyenv
# Usage: pyenv versions [--bare] [--skip-aliases] [--skip-envs] # Usage: pyenv versions [--bare] [--skip-aliases] [--skip-envs] [--executables]
# #
# Lists all Python versions found in `$PYENV_ROOT/versions/*'. # Lists all Python versions found in `$PYENV_ROOT/versions/*'.
#
# --bare List just the names, omit `system'
# --skip-aliases Skip symlinks to other versions and to virtual environments
# --skip-envs Skip virtual environments (under <version>/envs)
# --executables Internal. Overrides other options.
# Optimally get a deduplicated list of all executable names in Pyenv-managed
# versions and environments for `pyenv rehash'
#
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
unset bare skip_aliases skip_envs unset bare skip_aliases skip_envs executables
# Provide pyenv completions # Provide pyenv completions
for arg; do for arg; do
case "$arg" in case "$arg" in
@ -16,6 +24,7 @@ for arg; do
echo --skip-aliases echo --skip-aliases
echo --skip-envs echo --skip-envs
exit ;; exit ;;
--executables ) executables=1; break ;;
--bare ) bare=1 ;; --bare ) bare=1 ;;
--skip-aliases ) skip_aliases=1 ;; --skip-aliases ) skip_aliases=1 ;;
--skip-envs ) skip_envs=1 ;; --skip-envs ) skip_envs=1 ;;
@ -26,8 +35,21 @@ for arg; do
esac esac
done done
versions_dir="${PYENV_ROOT}/versions" versions_dir="${PYENV_ROOT}/versions"
# Fast path for rehash: skip filtering and link resolution
if [[ -n "$executables" ]]; then
if [ -d "$versions_dir" ]; then
shopt -s dotglob nullglob
# MacOS 12+ and FreeBSD 15 support `xargs -r -0' and `basename -a'
# `sort -u` is simpler and a bit faster than `awk '!seen[$0]++'`, with the same result for rehash purposes
printf '%s\0' "$versions_dir"/*/bin/* "$versions_dir"/*/envs/*/bin/* | xargs -0 -r basename -a | sort -u
shopt -u dotglob nullglob
fi
exit 0
fi
if ! enable -f "${BASH_SOURCE%/*}"/pyenv-realpath.dylib realpath 2>/dev/null; then if ! enable -f "${BASH_SOURCE%/*}"/pyenv-realpath.dylib realpath 2>/dev/null; then
if [ -n "$PYENV_NATIVE_EXT" ]; then if [ -n "$PYENV_NATIVE_EXT" ]; then
echo "pyenv: failed to load \`realpath' builtin" >&2 echo "pyenv: failed to load \`realpath' builtin" >&2

View File

@ -112,8 +112,8 @@ else
echo "The \`$PYENV_COMMAND' command exists in these Python versions:" echo "The \`$PYENV_COMMAND' command exists in these Python versions:"
echo "$versions" | sed 's/^/ /g' echo "$versions" | sed 's/^/ /g'
echo echo
echo "Note: See 'pyenv help global' for tips on allowing both" echo "Note: See 'pyenv help global' for tips on allowing multiple"
echo " python2 and python3 to be found." echo " Python versions to be found at the same time."
} >&2 } >&2
fi fi
fi fi

View File

@ -175,6 +175,7 @@ You can set certain environment variables to control the build process.
* `PYTHON_BUILD_SKIP_HOMEBREW`, if set, will not search for libraries installed by Homebrew when it would normally will. * `PYTHON_BUILD_SKIP_HOMEBREW`, if set, will not search for libraries installed by Homebrew when it would normally will.
* `PYTHON_BUILD_USE_HOMEBREW`, if set, will search for libraries installed by Homebrew when it would normally not. * `PYTHON_BUILD_USE_HOMEBREW`, if set, will search for libraries installed by Homebrew when it would normally not.
* `PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA`, override the Homebrew OpenSSL formula to use. * `PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA`, override the Homebrew OpenSSL formula to use.
* `PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA`, override the MacPorts OpenSSL formula to use. The default is `openssl3 openssl`.
* `PYTHON_BUILD_TCLTK_FORMULA`, override the Homebrew Tcl/Tk formula to use. * `PYTHON_BUILD_TCLTK_FORMULA`, override the Homebrew Tcl/Tk formula to use.
* `PYTHON_BUILD_SKIP_MACPORTS`, if set, will not search for libraries installed by MacPorts when it would normally will. * `PYTHON_BUILD_SKIP_MACPORTS`, if set, will not search for libraries installed by MacPorts when it would normally will.
* `PYTHON_BUILD_USE_MACPORTS`, if set, will search for libraries installed by MacPorts when it would normally not. * `PYTHON_BUILD_USE_MACPORTS`, if set, will search for libraries installed by MacPorts when it would normally not.

View File

@ -14,7 +14,7 @@
# -g/--debug Build a debug version # -g/--debug Build a debug version
# #
PYTHON_BUILD_VERSION="2.6.21" PYTHON_BUILD_VERSION="2.6.26"
OLDIFS="$IFS" OLDIFS="$IFS"
@ -202,7 +202,14 @@ build_failed() {
colorize 33 "Results logged to ${LOG_PATH}" colorize 33 "Results logged to ${LOG_PATH}"
printf "\n\n" printf "\n\n"
echo "Last 10 log lines:" echo "Last 10 log lines:"
tail -n 10 "$LOG_PATH" TAIL=`tail -n 10 "$LOG_PATH"`
echo "$TAIL"
if echo "$TAIL" | grep -q "no acceptable C compiler found"; then
printf "\n"
echo "Are the build dependencies for Python correctly installed?"
echo "Please consult to the Wiki page for more info."
echo "https://github.com/pyenv/pyenv/wiki#suggested-build-environment"
fi
fi fi
} >&3 } >&3
exit 1 exit 1
@ -1663,12 +1670,20 @@ prefer_openssl11() {
# Allow overriding the preference of OpenSSL version per definition basis (#1302, #1325, #1326) # Allow overriding the preference of OpenSSL version per definition basis (#1302, #1325, #1326)
PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="${PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA:-openssl@1.1 openssl}" PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="${PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA:-openssl@1.1 openssl}"
export PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA export PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA
PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA="${PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA:-openssl11 openssl3 openssl}"
export PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA
} }
prefer_openssl3() { prefer_openssl3() {
# Allow overriding the preference of OpenSSL version per definition basis (#1302, #1325, #1326) # Allow overriding the preference of OpenSSL version per definition basis (#1302, #1325, #1326)
PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="${PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA:-openssl@3 openssl@1.1 openssl}" PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="${PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA:-openssl@3 openssl@1.1 openssl}"
export PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA export PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA
# Set MacPorts OpenSSL formula names for MacPorts environment
PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA="${PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA:-openssl3 openssl openssl11}"
export PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA
} }
build_package_mac_readline() { build_package_mac_readline() {
@ -1727,7 +1742,8 @@ use_macports_openssl() {
command -v port >/dev/null || return 1 command -v port >/dev/null || return 1
local port_location="$(command -v port)" local port_location="$(command -v port)"
local prefix="${port_location%/bin/port}" local prefix="${port_location%/bin/port}"
for openssl in ${PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA:-openssl}; do # MacPorts uses a different package naming convention and does not use the @ symbol.
for openssl in ${PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA:-openssl3 openssl}; do
if [[ $(port -q installed ${openssl} | awk '{print $3}') == "(active)" ]]; then if [[ $(port -q installed ${openssl} | awk '{print $3}') == "(active)" ]]; then
echo "python-build: use ${openssl} from MacPorts" echo "python-build: use ${openssl} from MacPorts"
if [[ -n "${PYTHON_BUILD_CONFIGURE_WITH_OPENSSL:-}" ]]; then if [[ -n "${PYTHON_BUILD_CONFIGURE_WITH_OPENSSL:-}" ]]; then

View File

@ -175,9 +175,6 @@ def handle_t_thunks(version, previous_version, is_prerelease_upgrade):
"mv", "mv",
previous_thunk_name, previous_thunk_name,
thunk_name)) thunk_name))
else:
logger.info(f"Deleting {previous_thunk_path}")
previous_thunk_path.unlink()
logger.info(f"Writing {thunk_path}") logger.info(f"Writing {thunk_path}")
thunk_path.write_text(T_THUNK, encoding='utf-8') thunk_path.write_text(T_THUNK, encoding='utf-8')

View File

@ -47,9 +47,9 @@ here = Path(__file__).resolve()
out_dir: Path = here.parent.parent / "share" / "python-build" out_dir: Path = here.parent.parent / "share" / "python-build"
def download_sha(url): def download_sha(url):
logger.info('Downloading SHA file %(url)s', locals()) logger.info(f'Downloading SHA file {url}')
tup = tuple(reversed(requests.get(url).text.replace('./', '').rstrip().split())) tup = tuple(reversed(requests.get(url).text.replace('./', '').rstrip().split()))
logger.debug('Got %(tup)s', locals()) logger.debug(f'Got {tup}')
return tup return tup
def create_spec(filename, sha, url): def create_spec(filename, sha, url):
@ -72,7 +72,7 @@ def create_spec(filename, sha, url):
'installer_filename': f'{flavor_with_suffix.lower()}-{version}-{subversion}', 'installer_filename': f'{flavor_with_suffix.lower()}-{version}-{subversion}',
} }
logger.debug('Created spec %(spec)s', locals()) logger.debug(f'Created spec {spec}')
return spec return spec
@ -112,7 +112,7 @@ def add_version(release, distributions):
if count > 0: if count > 0:
output_file = out_dir / distribution_specs[0]['installer_filename'] output_file = out_dir / distribution_specs[0]['installer_filename']
logger.info('Writing %(count)d specs for %(distribution)s to %(output_file)s', locals()) logger.info(f'Writing {count} specs for {distribution} to {output_file}')
script_str = install_script_fmt.format( script_str = install_script_fmt.format(
install_lines="\n".join([install_line_fmt.format_map(s) for s in distribution_specs]), install_lines="\n".join([install_line_fmt.format_map(s) for s in distribution_specs]),
@ -122,7 +122,7 @@ def add_version(release, distributions):
with open(output_file, 'w') as f: with open(output_file, 'w') as f:
f.write(script_str) f.write(script_str)
else: else:
logger.info('Did not find specs for %(distribution)s', locals()) logger.info(f'Did not find specs for {distribution}')
def main(): def main():
@ -132,7 +132,7 @@ def main():
if version in SKIPPED_RELEASES: if version in SKIPPED_RELEASES:
continue continue
logger.info('Looking for %(version)s in %(out_dir)s', locals()) logger.info(f'Looking for {version} in {out_dir}')
# mambaforge is retired https://github.com/conda-forge/miniforge/releases/tag/24.11.2-0 # mambaforge is retired https://github.com/conda-forge/miniforge/releases/tag/24.11.2-0
if version_tuple(version) >= (24, 11, 2): if version_tuple(version) >= (24, 11, 2):
@ -141,7 +141,7 @@ def main():
distributions = DISTRIBUTIONS_PRE25 distributions = DISTRIBUTIONS_PRE25
if any(not list(out_dir.glob(f'{distribution}*-{version}')) for distribution in distributions): if any(not list(out_dir.glob(f'{distribution}*-{version}')) for distribution in distributions):
logger.info('Downloading %(version)s', locals()) logger.info(f'Downloading {version}')
add_version(release, distributions) add_version(release, distributions)
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -0,0 +1,9 @@
prefer_openssl3
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
install_package "openssl-3.6.1" "https://github.com/openssl/openssl/releases/download/openssl-3.6.1/openssl-3.6.1.tar.gz#b1bfedcd5b289ff22aee87c9d600f515767ebf45f77168cb6d64f231f518a82e" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.3" "https://ftpmirror.gnu.org/readline/readline-8.3.tar.gz#fe5383204467828cd495ee8d1d3c037a7eba1389c22bc6a041f627976f9061cc" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then
install_package "Python-3.10.20" "https://www.python.org/ftp/python/3.10.20/Python-3.10.20.tar.xz#de6517421601e39a9a3bc3e1bc4c7b2f239297423ee05e282598c83ec0647505" standard verify_py310 copy_python_gdb ensurepip
else
install_package "Python-3.10.20" "https://www.python.org/ftp/python/3.10.20/Python-3.10.20.tgz#4ff5fd4c5bab803b935019f3e31d7219cebd6f870d00389cea53b88bbe935d1a" standard verify_py310 copy_python_gdb ensurepip
fi

View File

@ -0,0 +1,10 @@
prefer_openssl3
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
export PYTHON_BUILD_TCLTK_USE_PKGCONFIG=1
install_package "openssl-3.6.1" "https://github.com/openssl/openssl/releases/download/openssl-3.6.1/openssl-3.6.1.tar.gz#b1bfedcd5b289ff22aee87c9d600f515767ebf45f77168cb6d64f231f518a82e" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.3" "https://ftpmirror.gnu.org/readline/readline-8.3.tar.gz#fe5383204467828cd495ee8d1d3c037a7eba1389c22bc6a041f627976f9061cc" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then
install_package "Python-3.11.15" "https://www.python.org/ftp/python/3.11.15/Python-3.11.15.tar.xz#272179ddd9a2e41a0fc8e42e33dfbdca0b3711aa5abf372d3f2d51543d09b625" standard verify_py311 copy_python_gdb ensurepip
else
install_package "Python-3.11.15" "https://www.python.org/ftp/python/3.11.15/Python-3.11.15.tgz#f4de1b10bd6c70cbb9fa1cd71fc5038b832747a74ee59d599c69ce4846defb50" standard verify_py311 copy_python_gdb ensurepip
fi

View File

@ -0,0 +1,10 @@
prefer_openssl3
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
export PYTHON_BUILD_TCLTK_USE_PKGCONFIG=1
install_package "openssl-3.6.1" "https://github.com/openssl/openssl/releases/download/openssl-3.6.1/openssl-3.6.1.tar.gz#b1bfedcd5b289ff22aee87c9d600f515767ebf45f77168cb6d64f231f518a82e" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.3" "https://ftpmirror.gnu.org/readline/readline-8.3.tar.gz#fe5383204467828cd495ee8d1d3c037a7eba1389c22bc6a041f627976f9061cc" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then
install_package "Python-3.12.13" "https://www.python.org/ftp/python/3.12.13/Python-3.12.13.tar.xz#c08bc65a81971c1dd5783182826503369466c7e67374d1646519adf05207b684" standard verify_py312 copy_python_gdb ensurepip
else
install_package "Python-3.12.13" "https://www.python.org/ftp/python/3.12.13/Python-3.12.13.tgz#0816c4761c97ecdb3f50a3924de0a93fd78cb63ee8e6c04201ddfaedca500b0b" standard verify_py312 copy_python_gdb ensurepip
fi

View File

@ -0,0 +1,10 @@
prefer_openssl3
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
export PYTHON_BUILD_TCLTK_USE_PKGCONFIG=1
install_package "openssl-3.6.1" "https://github.com/openssl/openssl/releases/download/openssl-3.6.1/openssl-3.6.1.tar.gz#b1bfedcd5b289ff22aee87c9d600f515767ebf45f77168cb6d64f231f518a82e" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.3" "https://ftpmirror.gnu.org/readline/readline-8.3.tar.gz#fe5383204467828cd495ee8d1d3c037a7eba1389c22bc6a041f627976f9061cc" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then
install_package "Python-3.13.12" "https://www.python.org/ftp/python/3.13.12/Python-3.13.12.tar.xz#2a84cd31dd8d8ea8aaff75de66fc1b4b0127dd5799aa50a64ae9a313885b4593" standard verify_py313 copy_python_gdb ensurepip
else
install_package "Python-3.13.12" "https://www.python.org/ftp/python/3.13.12/Python-3.13.12.tgz#12e7cb170ad2d1a69aee96a1cc7fc8de5b1e97a2bdac51683a3db016ec9a2996" standard verify_py313 copy_python_gdb ensurepip
fi

View File

@ -1,10 +0,0 @@
prefer_openssl3
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
export PYTHON_BUILD_TCLTK_USE_PKGCONFIG=1
install_package "openssl-3.6.0" "https://github.com/openssl/openssl/releases/download/openssl-3.6.0/openssl-3.6.0.tar.gz#b6a5f44b7eb69e3fa35dbf15524405b44837a481d43d81daddde3ff21fcbb8e9" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.3" "https://ftpmirror.gnu.org/readline/readline-8.3.tar.gz#fe5383204467828cd495ee8d1d3c037a7eba1389c22bc6a041f627976f9061cc" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then
install_package "Python-3.15.0a5" "https://www.python.org/ftp/python/3.15.0/Python-3.15.0a5.tar.xz#fee40da6450b67547c079dcb2852e8a03db6d57e06415466b2d3294449db22ef" standard verify_py315 copy_python_gdb ensurepip
else
install_package "Python-3.15.0a5" "https://www.python.org/ftp/python/3.15.0/Python-3.15.0a5.tgz#c4b535cd6f4c07889a53ce68fedf00c77c720086ab018723a8b5079b25a1e051" standard verify_py315 copy_python_gdb ensurepip
fi

View File

@ -0,0 +1,10 @@
prefer_openssl3
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
export PYTHON_BUILD_TCLTK_USE_PKGCONFIG=1
install_package "openssl-3.6.1" "https://github.com/openssl/openssl/releases/download/openssl-3.6.1/openssl-3.6.1.tar.gz#b1bfedcd5b289ff22aee87c9d600f515767ebf45f77168cb6d64f231f518a82e" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.3" "https://ftpmirror.gnu.org/readline/readline-8.3.tar.gz#fe5383204467828cd495ee8d1d3c037a7eba1389c22bc6a041f627976f9061cc" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then
install_package "Python-3.15.0a7" "https://www.python.org/ftp/python/3.15.0/Python-3.15.0a7.tar.xz#8f590c428b7f0d406df928b85737e7a3afa28eddd4d1419410ea809687ed1ea7" standard verify_py315 copy_python_gdb ensurepip
else
install_package "Python-3.15.0a7" "https://www.python.org/ftp/python/3.15.0/Python-3.15.0a7.tgz#a3ab00d82e04559369fecc98fab90ccb38e14f00bc0171f06e94821c1d2b1413" standard verify_py315 copy_python_gdb ensurepip
fi

View File

@ -0,0 +1,19 @@
case "$(anaconda_architecture 2>/dev/null || true)" in
"Linux-aarch64" )
install_script "Anaconda3-2025.12-2-Linux-aarch64" "https://repo.anaconda.com/archive/Anaconda3-2025.12-2-Linux-aarch64.sh#be13a20f31d82508a061984fa3555369cfd8e4692643721415c19e7dc2e9e0f9" "anaconda" verify_py313
;;
"Linux-x86_64" )
install_script "Anaconda3-2025.12-2-Linux-x86_64" "https://repo.anaconda.com/archive/Anaconda3-2025.12-2-Linux-x86_64.sh#57b2b48cc5b8665e25fce7011f0389d47c1288288007844b3b1ba482d4f39029" "anaconda" verify_py313
;;
"MacOSX-arm64" )
install_script "Anaconda3-2025.12-2-MacOSX-arm64" "https://repo.anaconda.com/archive/Anaconda3-2025.12-2-MacOSX-arm64.sh#8d0b858358456d4ee159feb0c4ee6d635590b777f8b9ffa4aa7553c469aae2b6" "anaconda" verify_py313
;;
* )
{ echo
colorize 1 "ERROR"
echo ": The binary distribution of Anaconda is not available for $(anaconda_architecture 2>/dev/null || true)."
echo
} >&2
exit 1
;;
esac

View File

@ -0,0 +1,20 @@
export CONDA_PLUGINS_AUTO_ACCEPT_TOS=true
case "$(anaconda_architecture 2>/dev/null || true)" in
"Linux-aarch64" )
install_script "Miniconda3-py310_26.1.1-1-Linux-aarch64" "https://repo.anaconda.com/miniconda/Miniconda3-py310_26.1.1-1-Linux-aarch64.sh#0a78d6620113acd42d840925514c0f5eec9f2e1e8ae4394755c401b3b605875b" "miniconda" verify_py310
;;
"Linux-x86_64" )
install_script "Miniconda3-py310_26.1.1-1-Linux-x86_64" "https://repo.anaconda.com/miniconda/Miniconda3-py310_26.1.1-1-Linux-x86_64.sh#4410410a6343f688bbfd48d80eb23e3125964e254e4c18802679d2e61b06876e" "miniconda" verify_py310
;;
"MacOSX-arm64" )
install_script "Miniconda3-py310_26.1.1-1-MacOSX-arm64" "https://repo.anaconda.com/miniconda/Miniconda3-py310_26.1.1-1-MacOSX-arm64.sh#cadb31098a13b7dcc016594f54b01bcf1371161ba762a9ac3ba0d8f04b2615e2" "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

View File

@ -0,0 +1,20 @@
export CONDA_PLUGINS_AUTO_ACCEPT_TOS=true
case "$(anaconda_architecture 2>/dev/null || true)" in
"Linux-aarch64" )
install_script "Miniconda3-py311_26.1.1-1-Linux-aarch64" "https://repo.anaconda.com/miniconda/Miniconda3-py311_26.1.1-1-Linux-aarch64.sh#1726ea55308160a32e82d90a6f4914caa46f58fe157442224f2faf92fdef1e0e" "miniconda" verify_py311
;;
"Linux-x86_64" )
install_script "Miniconda3-py311_26.1.1-1-Linux-x86_64" "https://repo.anaconda.com/miniconda/Miniconda3-py311_26.1.1-1-Linux-x86_64.sh#52d1f19154b0716d7dc0872f0d858702640da08a4e53fd0035ba988608203d6b" "miniconda" verify_py311
;;
"MacOSX-arm64" )
install_script "Miniconda3-py311_26.1.1-1-MacOSX-arm64" "https://repo.anaconda.com/miniconda/Miniconda3-py311_26.1.1-1-MacOSX-arm64.sh#720266b29d46b8da1b466342aa02d7d04683670bf2bf53576cc70d89253f60ca" "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

View File

@ -0,0 +1,20 @@
export CONDA_PLUGINS_AUTO_ACCEPT_TOS=true
case "$(anaconda_architecture 2>/dev/null || true)" in
"Linux-aarch64" )
install_script "Miniconda3-py312_26.1.1-1-Linux-aarch64" "https://repo.anaconda.com/miniconda/Miniconda3-py312_26.1.1-1-Linux-aarch64.sh#0a84d50ec92fbb248e31bff0a5888bf2f4dc322fc979e94ecc6e9946d0324ce7" "miniconda" verify_py312
;;
"Linux-x86_64" )
install_script "Miniconda3-py312_26.1.1-1-Linux-x86_64" "https://repo.anaconda.com/miniconda/Miniconda3-py312_26.1.1-1-Linux-x86_64.sh#eef1283cdc9d37f55743778ea4567e91aa28c2e3be4adab529dda324c3c897a2" "miniconda" verify_py312
;;
"MacOSX-arm64" )
install_script "Miniconda3-py312_26.1.1-1-MacOSX-arm64" "https://repo.anaconda.com/miniconda/Miniconda3-py312_26.1.1-1-MacOSX-arm64.sh#4a1e3630353121edad84fe79982a99ad8001425e27313c34f7ba9b6cec95d3dd" "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

View File

@ -0,0 +1,20 @@
export CONDA_PLUGINS_AUTO_ACCEPT_TOS=true
case "$(anaconda_architecture 2>/dev/null || true)" in
"Linux-aarch64" )
install_script "Miniconda3-py313_26.1.1-1-Linux-aarch64" "https://repo.anaconda.com/miniconda/Miniconda3-py313_26.1.1-1-Linux-aarch64.sh#07c82b5aec04d5f0f3e4b246835b6bc85e104821cbcb0a059c7ea80f028503f4" "miniconda" verify_py313
;;
"Linux-x86_64" )
install_script "Miniconda3-py313_26.1.1-1-Linux-x86_64" "https://repo.anaconda.com/miniconda/Miniconda3-py313_26.1.1-1-Linux-x86_64.sh#f6dfb5b59614fd7b2956b240b2575a9d58203ec7f7a99f85128158a0fdc5c1d7" "miniconda" verify_py313
;;
"MacOSX-arm64" )
install_script "Miniconda3-py313_26.1.1-1-MacOSX-arm64" "https://repo.anaconda.com/miniconda/Miniconda3-py313_26.1.1-1-MacOSX-arm64.sh#745f97a6553ebdce0bfdaafe00b0d1939784b38cdaadb3378ca7868a51616a65" "miniconda" verify_py313
;;
* )
{ 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

View File

@ -0,0 +1,25 @@
case "$(anaconda_architecture 2>/dev/null || true)" in
"Linux-aarch64" )
install_script "Miniforge3-26.1.0-0-Linux-aarch64.sh" "https://github.com/conda-forge/miniforge/releases/download/26.1.0-0/Miniforge3-26.1.0-0-Linux-aarch64.sh#8baf8844ecf13e1458f81659ea286251d04b2d5ed90040efb77f158adedb2d95" "miniconda" verify_py312
;;
"Linux-ppc64le" )
install_script "Miniforge3-26.1.0-0-Linux-ppc64le.sh" "https://github.com/conda-forge/miniforge/releases/download/26.1.0-0/Miniforge3-26.1.0-0-Linux-ppc64le.sh#902190ad825b74b78a6a2816364453bb4d6989a599172aa3785d4afd0ebeb917" "miniconda" verify_py312
;;
"Linux-x86_64" )
install_script "Miniforge3-26.1.0-0-Linux-x86_64.sh" "https://github.com/conda-forge/miniforge/releases/download/26.1.0-0/Miniforge3-26.1.0-0-Linux-x86_64.sh#127b5e14cfe6c83b787f624487cdc2168645ed82fdca1b0c1937caa086aed6d5" "miniconda" verify_py312
;;
"MacOSX-arm64" )
install_script "Miniforge3-26.1.0-0-MacOSX-arm64.sh" "https://github.com/conda-forge/miniforge/releases/download/26.1.0-0/Miniforge3-26.1.0-0-MacOSX-arm64.sh#219b9e0d733fa2086d7d094a5ed830db146ccf22ae32c330b2da5df5c9604b78" "miniconda" verify_py312
;;
"MacOSX-x86_64" )
install_script "Miniforge3-26.1.0-0-MacOSX-x86_64.sh" "https://github.com/conda-forge/miniforge/releases/download/26.1.0-0/Miniforge3-26.1.0-0-MacOSX-x86_64.sh#90a41a28ad0221fbaf728ca1267f6243638a56c579fba8a1b970edfee4062d53" "miniconda" verify_py312
;;
* )
{ echo
colorize 1 "ERROR"
echo ": The binary distribution of Miniforge is not available for $(anaconda_architecture 2>/dev/null || true)."
echo
} >&2
exit 1
;;
esac

View File

@ -2,7 +2,7 @@ PROTOTYPE_SOURCE_SHIM_PATH="${SHIM_PATH}/.pyenv-source-shim"
shims=() shims=()
shopt -s nullglob shopt -s nullglob
for shim in $(cat "${BASH_SOURCE%/*}/source.d/"*".list" | sort | uniq | sed -e 's/#.*$//' | sed -e '/^[[:space:]]*$/d'); do for shim in $(sort -u "${BASH_SOURCE%/*}/source.d/"*".list" | sed -e 's/#.*$//' -e '/^[[:space:]]*$/d'); do
if [ -n "${shim##*/}" ]; then if [ -n "${shim##*/}" ]; then
shims[${#shims[*]}]="${shim})return 0;;" shims[${#shims[*]}]="${shim})return 0;;"
fi fi

View File

@ -135,7 +135,7 @@ path_without() {
if [ "$found" != "${PYENV_ROOT}/shims" ]; then if [ "$found" != "${PYENV_ROOT}/shims" ]; then
alt="${PYENV_TEST_DIR}/$(echo "${found#/}" | tr '/' '-')" alt="${PYENV_TEST_DIR}/$(echo "${found#/}" | tr '/' '-')"
mkdir -p "$alt" mkdir -p "$alt"
for util in bash head cut readlink greadlink tr sed; do for util in bash head cut readlink greadlink tr sed xargs basename sort; do
if [ -x "${found}/$util" ]; then if [ -x "${found}/$util" ]; then
ln -s "${found}/$util" "${alt}/$util" ln -s "${found}/$util" "${alt}/$util"
fi fi

View File

@ -11,6 +11,11 @@ create_alias() {
ln -s "$2" "${PYENV_ROOT}/versions/$1" ln -s "$2" "${PYENV_ROOT}/versions/$1"
} }
create_external_version() {
mkdir -p "$PYENV_TEST_DIR/${1:?}"
create_alias "${1:?}" "$PYENV_TEST_DIR/${1:?}"
}
_setup() { _setup() {
mkdir -p "$PYENV_TEST_DIR" mkdir -p "$PYENV_TEST_DIR"
cd "$PYENV_TEST_DIR" cd "$PYENV_TEST_DIR"
@ -168,15 +173,39 @@ OUT
@test "doesn't list symlink aliases when --skip-aliases" { @test "doesn't list symlink aliases when --skip-aliases" {
create_version "1.8.7" create_version "1.8.7"
create_alias "1.8" "1.8.7" create_alias "1.8" "1.8.7"
mkdir moo create_external_version "moo"
create_alias "1.9" "${PWD}/moo"
run pyenv-versions --bare --skip-aliases run pyenv-versions --bare --skip-aliases
assert_success assert_success
assert_output <<OUT assert_output <<OUT
1.8.7 1.8.7
1.9 moo
OUT
}
@test "--executables lists executables everywhere and overrides other switches" {
create_alt_executable_in_version "3.5.0" "python"
create_alt_executable_in_version "3.5.0" "python1"
create_alt_executable_in_version "3.6.0" "python"
create_alt_executable_in_version "3.5.0/envs/foo" "python_foo"
create_alt_executable_in_version "3.6.0/envs/bar" "python_bar"
create_alias "bar" "3.6.0/envs/bar"
create_external_version "moo"
create_alt_executable_in_version "moo" "moopython"
run pyenv-versions --skip-aliases --skip-envs --executables
assert_success
#The sort order does not matter for this functionality. However,
#MacOS 15 `sort` sorts differently that Linux's due to a different LC_COLLATE definition for en-US:
#https://unix.stackexchange.com/questions/362728/why-does-gnu-sort-sort-differently-on-my-osx-machine-and-linux-machine
#So to get a match, we have to check against the same order that the local `sort` produces
sort <<OUT | assert_output
moopython
python
python1
python_bar
python_foo
OUT OUT
} }

View File

@ -68,8 +68,8 @@ pyenv: py.test: command not found
The \`py.test' command exists in these Python versions: The \`py.test' command exists in these Python versions:
3.4 3.4
Note: See 'pyenv help global' for tips on allowing both Note: See 'pyenv help global' for tips on allowing multiple
python2 and python3 to be found. Python versions to be found at the same time.
OUT OUT
} }
@ -85,8 +85,8 @@ pyenv: py.test: command not found
The \`py.test' command exists in these Python versions: The \`py.test' command exists in these Python versions:
3.4 3.4
Note: See 'pyenv help global' for tips on allowing both Note: See 'pyenv help global' for tips on allowing multiple
python2 and python3 to be found. Python versions to be found at the same time.
OUT OUT
} }
@ -118,8 +118,8 @@ The \`py.test' command exists in these Python versions:
3.3 3.3
3.4 3.4
Note: See 'pyenv help global' for tips on allowing both Note: See 'pyenv help global' for tips on allowing multiple
python2 and python3 to be found. Python versions to be found at the same time.
OUT OUT
} }