mirror of
https://github.com/pyenv/pyenv.git
synced 2025-12-06 18:08:37 +00:00
Compare commits
10 Commits
7fbb81d052
...
e50ca2e5ee
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e50ca2e5ee | ||
|
|
8d3bba2f92 | ||
|
|
a419b003b4 | ||
|
|
1c05252dfc | ||
|
|
0541b2ce08 | ||
|
|
a2d20cd3c3 | ||
|
|
11b615f709 | ||
|
|
99c693df39 | ||
|
|
2ac251faa1 | ||
|
|
2df60ca4ea |
@ -1,5 +1,8 @@
|
||||
# Version History
|
||||
|
||||
## Release v2.6.10
|
||||
* Add CPython 3.12.12, 3.11.14, 3.10.19, 3.9.24 by @nedbat in https://github.com/pyenv/pyenv/pull/3344
|
||||
|
||||
## Release v2.6.9
|
||||
* CI: modified-scripts-build: fix CPython-specific jobs never firing by @tuzi3040 in https://github.com/pyenv/pyenv/pull/3338
|
||||
* CI: modified-scripts-build: fix output variable for CPython-specific workflows by @native-api in https://github.com/pyenv/pyenv/pull/3340
|
||||
|
||||
15
README.md
15
README.md
@ -271,6 +271,19 @@ See [Advanced configuration](#advanced-configuration) for details and more confi
|
||||
|
||||
</details>
|
||||
|
||||
#### Microsoft PowerShell
|
||||
|
||||
<details>
|
||||
|
||||
Add the commands to `$profile.CurrentUserAllHosts` by running the following in your terminal:
|
||||
|
||||
~~~ pwsh
|
||||
echo '$Env:PYENV_ROOT="$HOME/.pyenv"' >> $profile.CurrentUserAllHosts
|
||||
echo '$Env:PATH="$Env:PYENV_ROOT/bin:$Env:PATH"' >> $profile.CurrentUserAllHosts
|
||||
echo 'iex ((pyenv init -) -join "`n")' >> $profile.CurrentUserAllHosts
|
||||
~~~
|
||||
|
||||
</details>
|
||||
|
||||
### C. Restart your shell
|
||||
----
|
||||
@ -689,7 +702,7 @@ opposed to this idea. Here's what `eval "$(pyenv init -)"` actually does:
|
||||
|
||||
3. **Installs autocompletion.** This is entirely optional but pretty
|
||||
useful. Sourcing `<pyenv installation prefix>/completions/pyenv.bash` will set that
|
||||
up. There are also completions for Zsh and Fish.
|
||||
up. There are also completions for Zsh, Fish and PowerShell.
|
||||
|
||||
4. **Rehashes shims.** From time to time you'll need to rebuild your
|
||||
shim files. Doing this on init makes sure everything is up to
|
||||
|
||||
17
completions/pyenv.pwsh
Normal file
17
completions/pyenv.pwsh
Normal file
@ -0,0 +1,17 @@
|
||||
$scriptblock = {
|
||||
param($wordToComplete, $commandAst, $cursorPosition)
|
||||
$words = $commandAst.ToString()
|
||||
if ( $wordToComplete ) {
|
||||
$matches = (($words[0..$cursorPosition] -join '') | Select-String -Pattern "\s+" -AllMatches).Matches
|
||||
if ( $matches ) {
|
||||
$cursorPosition = $matches[-1].Index - 1
|
||||
}
|
||||
}
|
||||
$words = $words[0..$cursorPosition] -join '' -split "\s+"
|
||||
if ( $words.Count -ge 2 ) {
|
||||
pyenv completions $words[1] | where { $_ -match $wordToComplete }
|
||||
} else {
|
||||
pyenv commands | where { $_ -match $wordToComplete }
|
||||
}
|
||||
}
|
||||
Register-ArgumentCompleter -Native -CommandName pyenv -ScriptBlock $scriptblock
|
||||
@ -12,7 +12,7 @@
|
||||
set -e
|
||||
[ -n "$PYENV_DEBUG" ] && set -x
|
||||
|
||||
version="2.6.9"
|
||||
version="2.6.10"
|
||||
git_revision=""
|
||||
|
||||
if cd "${BASH_SOURCE%/*}" 2>/dev/null && git remote -v 2>/dev/null | grep -q pyenv; then
|
||||
|
||||
@ -15,6 +15,7 @@ if [ "$1" = "--complete" ]; then
|
||||
echo bash
|
||||
echo fish
|
||||
echo ksh
|
||||
echo pwsh
|
||||
echo zsh
|
||||
exit
|
||||
fi
|
||||
@ -102,6 +103,10 @@ function detect_profile() {
|
||||
profile_explain="~/.bash_profile if it exists, otherwise ~/.profile"
|
||||
rc='~/.bashrc'
|
||||
;;
|
||||
pwsh )
|
||||
profile='~/.config/powershell/profile.ps1'
|
||||
rc='~/.config/powershell/profile.ps1'
|
||||
;;
|
||||
zsh )
|
||||
profile='~/.zprofile'
|
||||
rc='~/.zshrc'
|
||||
@ -150,6 +155,21 @@ function help_() {
|
||||
echo 'pyenv init - fish | source'
|
||||
echo
|
||||
;;
|
||||
pwsh )
|
||||
echo '# Load pyenv automatically by appending'
|
||||
echo -n "# the following to "
|
||||
if [ "$profile" == "$rc" ]; then
|
||||
echo "$profile :"
|
||||
else
|
||||
echo
|
||||
echo "${profile_explain:-$profile} (for login shells)"
|
||||
echo "and $rc (for interactive shells) :"
|
||||
fi
|
||||
echo
|
||||
echo '$Env:PYENV_ROOT="$HOME/.pyenv"'
|
||||
echo '$Env:PATH="$Env:PYENV_ROOT/bin:$Env:PATH"'
|
||||
echo 'iex ((pyenv init -) -join "`n")'
|
||||
;;
|
||||
* )
|
||||
echo '# Load pyenv automatically by appending'
|
||||
echo -n "# the following to "
|
||||
@ -186,6 +206,11 @@ function print_path() {
|
||||
print_path_prepend_shims
|
||||
echo 'end'
|
||||
;;
|
||||
pwsh )
|
||||
echo 'if ( $Env:PATH -match "'"${PYENV_ROOT}/shims"'" ) {'
|
||||
print_path_prepend_shims
|
||||
echo '}'
|
||||
;;
|
||||
* )
|
||||
echo 'if [[ ":$PATH:" != *'\':"${PYENV_ROOT}"/shims:\''* ]]; then'
|
||||
print_path_prepend_shims
|
||||
@ -199,6 +224,10 @@ function print_path() {
|
||||
echo 'set -eg PATH[$pyenv_index]; end; set -e pyenv_index'
|
||||
print_path_prepend_shims
|
||||
;;
|
||||
pwsh )
|
||||
echo '$Env:PATH="$(($Env:PATH -split '"':'"' | where { -not ($_ -match '"'${PYENV_ROOT}/shims'"') }) -join '"':'"')"'
|
||||
print_path_prepend_shims
|
||||
;;
|
||||
* )
|
||||
# Some distros (notably Debian-based) set Bash's SSH_SOURCE_BASHRC compilation option
|
||||
# that makes it source `bashrc` under SSH even when not interactive.
|
||||
@ -223,6 +252,9 @@ function print_path_prepend_shims() {
|
||||
fish )
|
||||
echo 'set -gx PATH '\'"${PYENV_ROOT}/shims"\'' $PATH'
|
||||
;;
|
||||
pwsh )
|
||||
echo '$Env:PATH="'"${PYENV_ROOT}"'/shims:$Env:PATH"'
|
||||
;;
|
||||
* )
|
||||
echo 'export PATH="'"${PYENV_ROOT}"'/shims:${PATH}"'
|
||||
;;
|
||||
@ -234,6 +266,9 @@ function print_env() {
|
||||
fish )
|
||||
echo "set -gx PYENV_SHELL $shell"
|
||||
;;
|
||||
pwsh )
|
||||
echo '$Env:PYENV_SHELL="'"$shell"'"'
|
||||
;;
|
||||
* )
|
||||
echo "export PYENV_SHELL=$shell"
|
||||
;;
|
||||
@ -243,13 +278,27 @@ function print_env() {
|
||||
function print_completion() {
|
||||
completion="${0%/*/*}/completions/pyenv.${shell}"
|
||||
if [ -r "$completion" ]; then
|
||||
echo "source '$completion'"
|
||||
case "$shell" in
|
||||
pwsh )
|
||||
echo "iex (gc $completion -Raw)"
|
||||
;;
|
||||
* )
|
||||
echo "source '$completion'"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
function print_rehash() {
|
||||
if [ -z "$no_rehash" ]; then
|
||||
echo 'command pyenv rehash 2>/dev/null'
|
||||
case "$shell" in
|
||||
pwsh )
|
||||
echo '& pyenv rehash 2>/dev/null'
|
||||
;;
|
||||
* )
|
||||
echo 'command pyenv rehash 2>/dev/null'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
@ -270,6 +319,25 @@ function print_shell_function() {
|
||||
end
|
||||
end'
|
||||
;;
|
||||
pwsh )
|
||||
cat <<EOS
|
||||
function pyenv {
|
||||
\$command=""
|
||||
if ( \$args.Count -gt 0 ) {
|
||||
\$command, \$args = \$args
|
||||
}
|
||||
|
||||
if ( ("${commands[*]}" -split ' ') -contains \$command ) {
|
||||
\$shell_cmds = & \$Env:PYENV_ROOT/bin/pyenv sh-\$command \$args
|
||||
if ( \$shell_cmds.Count -gt 0 ) {
|
||||
iex (\$shell_cmds -join "\`n")
|
||||
}
|
||||
} else {
|
||||
& \$Env:PYENV_ROOT/bin/pyenv \$command \$args
|
||||
}
|
||||
}
|
||||
EOS
|
||||
;;
|
||||
ksh | ksh93 | mksh )
|
||||
echo \
|
||||
'function pyenv {
|
||||
@ -281,8 +349,8 @@ end'
|
||||
local command=${1:-}'
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$shell" != "fish" ]; then
|
||||
|
||||
if [ "$shell" != "fish" ] && [ "$shell" != "pwsh" ]; then
|
||||
IFS="|"
|
||||
echo \
|
||||
' [ "$#" -gt 0 ] && shift
|
||||
|
||||
@ -14,7 +14,7 @@ shell="$(basename "${PYENV_SHELL:-$SHELL}")"
|
||||
pyenv-rehash
|
||||
|
||||
case "$shell" in
|
||||
fish )
|
||||
fish | pwsh )
|
||||
# no rehash support
|
||||
;;
|
||||
* )
|
||||
|
||||
@ -48,6 +48,9 @@ if [ "$versions" = "--unset" ]; then
|
||||
echo 'set -gu PYENV_VERSION_OLD "$PYENV_VERSION"'
|
||||
echo "set -e PYENV_VERSION"
|
||||
;;
|
||||
pwsh )
|
||||
echo '$Env:PYENV_VERSION, $Env:PYENV_VERSION_OLD = $null, $Env:PYENV_VERSION'
|
||||
;;
|
||||
* )
|
||||
echo 'PYENV_VERSION_OLD="${PYENV_VERSION-}"'
|
||||
echo "unset PYENV_VERSION"
|
||||
@ -74,6 +77,16 @@ else
|
||||
echo "pyenv: PYENV_VERSION_OLD is not set" >&2
|
||||
false
|
||||
end
|
||||
EOS
|
||||
;;
|
||||
pwsh )
|
||||
cat <<EOS
|
||||
if ( Get-Item -Path Env:\PYENV_VERSION* ) {
|
||||
\$Env:PYENV_VERSION, \$Env:PYENV_VERSION_OLD = \$Env:PYENV_VERSION_OLD, \$Env:PYENV_VERSION
|
||||
} else {
|
||||
Write-Error "pyenv: Env:PYENV_VERSION_OLD is not set"
|
||||
return \$false
|
||||
}
|
||||
EOS
|
||||
;;
|
||||
* )
|
||||
@ -109,6 +122,9 @@ if pyenv-prefix "${versions[@]}" >/dev/null; then
|
||||
echo 'set -gu PYENV_VERSION_OLD "$PYENV_VERSION"'
|
||||
echo "set -gx PYENV_VERSION \"$version\""
|
||||
;;
|
||||
pwsh )
|
||||
echo '$Env:PYENV_VERSION, $Env:PYENV_VERSION_OLD = "'"${version}"'", $Env:PYENV_VERSION'
|
||||
;;
|
||||
* )
|
||||
echo 'PYENV_VERSION_OLD="${PYENV_VERSION-}"'
|
||||
echo "export PYENV_VERSION=\"${version}\""
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
# -g/--debug Build a debug version
|
||||
#
|
||||
|
||||
PYTHON_BUILD_VERSION="2.6.9"
|
||||
PYTHON_BUILD_VERSION="2.6.10"
|
||||
|
||||
OLDIFS="$IFS"
|
||||
|
||||
@ -1880,26 +1880,24 @@ use_macports_zlib() {
|
||||
|
||||
use_homebrew_tcltk() {
|
||||
can_use_homebrew || return 1
|
||||
local tcltk_formula
|
||||
# Since https://github.com/Homebrew/homebrew-core/commit/f10e88617b41555193c22fdcba6109fe82155ee2 (10.11.2024),
|
||||
# tcl-tk is 9.0 which is not compatible with CPython as of this writing
|
||||
# but we'll keep it as backup for cases like non-updated Homebrew
|
||||
local tcltk
|
||||
for tcltk in ${PYTHON_BUILD_TCLTK_FORMULA:-tcl-tk@8 tcl-tk}; do
|
||||
local tcltk_libdir="$(brew --prefix "${tcltk}" 2>/dev/null || true)"
|
||||
if [ -d "$tcltk_libdir" ]; then
|
||||
echo "python-build: use tcl-tk from homebrew"
|
||||
local tcltk_version="$(sh -c '. '"$tcltk_libdir"'/lib/tclConfig.sh; echo $TCL_VERSION')"
|
||||
local tcltk_includes tcltk_libs
|
||||
# tcl-tk is 9.0. It's supported in CPython since 3.14.0a1 (gh-124111) but is not officially supported as of 3.14.0
|
||||
# so we prefer 8
|
||||
for tcltk_formula in ${PYTHON_BUILD_TCLTK_FORMULA:-tcl-tk@8 tcl-tk}; do
|
||||
local tcltk_prefix="$(brew --prefix "${tcltk_formula}" 2>/dev/null || true)"
|
||||
if [ -d "$tcltk_prefix" ]; then
|
||||
echo "python-build: use ${tcltk_formula} from homebrew"
|
||||
# In Homebrew Tcl/Tk 8.6.13, headers have been moved to the 'tcl-tk' subdir.
|
||||
# We're not using tclConfig.sh here 'cuz it produces the version-specific path to <brew prefix>/Cellar
|
||||
# and we'd rather have rpath set to <brew prefix>/opt/<...> to allow micro release upgrades without rebuilding
|
||||
# XXX: do use tclConfig.sh and translate the paths if more shenanigans appear in later releases
|
||||
if [ -d "$tcltk_libdir/include/tcl-tk" ]; then
|
||||
tcltk_includes="-I$tcltk_libdir/include/tcl-tk"
|
||||
else
|
||||
tcltk_includes="-I$tcltk_libdir/include"
|
||||
local tcltk_includes="$(sh -c 'cd '"$tcltk_prefix"'/lib; . ./tclConfig.sh; . ./tkConfig.sh; echo "$TCL_INCLUDE_SPEC $TK_INCLUDE_SPEC"')"
|
||||
# Homebrew Tcl/Tk 9 is built with external libtommath. CPython's build as of 3.14.0 does not detect that and fails to link to tommath symbols
|
||||
local tcltk_cflags
|
||||
if sh -c '. '"$tcltk_prefix"'/lib/tclConfig.sh; echo "$TCL_DEFS"' | grep -qwFe '-DTCL_WITH_EXTERNAL_TOMMATH=1'; then
|
||||
tcltk_cflags="-DTCL_WITH_EXTERNAL_TOMMATH=1"
|
||||
fi
|
||||
tcltk_libs="-L$tcltk_libdir/lib -ltcl$tcltk_version -ltk$tcltk_version"
|
||||
# For some reason, keg-only tcl-tk@8 successfully links with Tkinter without specifying rpath, with `/opt' rpath
|
||||
# so no need to translate /Cellar path to /opt path
|
||||
local tcltk_libs="$(sh -c 'cd '"$tcltk_prefix"'/lib; . ./tclConfig.sh; . ./tkConfig.sh; echo "$TCL_LIB_SPEC $TK_LIB_SPEC"')"
|
||||
# Since 2.7.6, 3.3.3, 3.4.0 (Issue #1584): --with-tcltk-includes + --with-tcltk-libs Configure options
|
||||
# Since 3.11.0 (bpo-45847): `pkg-config` call, TCLTK_CFLAGS + TCLTK_LIBS override
|
||||
if [[ -n "$PYTHON_BUILD_TCLTK_USE_PKGCONFIG" ]]; then
|
||||
@ -1907,14 +1905,15 @@ use_homebrew_tcltk() {
|
||||
# There's no way to provide a fallback only if it's is not present
|
||||
# and Configure's logic of detecting if it's present is complicated.
|
||||
# So we just override it always
|
||||
export TCLTK_CFLAGS="$tcltk_includes"
|
||||
export TCLTK_CFLAGS="$tcltk_includes${tcltk_cflags:+ $tcltk_cflags}"
|
||||
export TCLTK_LIBS="$tcltk_libs"
|
||||
else
|
||||
package_option python configure --with-tcltk-includes="$tcltk_includes"
|
||||
package_option python configure --with-tcltk-libs="$tcltk_libs"
|
||||
[[ -n $tcltk_cflags ]] && export CFLAGS="${tcltk_cflags}${CFLAGS:+ $CFLAGS}"
|
||||
fi
|
||||
#set in either case as a failsafe
|
||||
export PKG_CONFIG_PATH="${tcltk_libdir}/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
|
||||
export PKG_CONFIG_PATH="${tcltk_prefix}/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
|
||||
|
||||
lock_in homebrew
|
||||
return 0
|
||||
|
||||
9
plugins/python-build/share/python-build/3.10.19
Normal file
9
plugins/python-build/share/python-build/3.10.19
Normal file
@ -0,0 +1,9 @@
|
||||
prefer_openssl3
|
||||
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
|
||||
install_package "openssl-3.2.4" "https://github.com/openssl/openssl/releases/download/openssl-3.2.4/openssl-3.2.4.tar.gz#b23ad7fd9f73e43ad1767e636040e88ba7c9e5775bfa5618436a0dd2c17c3716" mac_openssl --if has_broken_mac_openssl
|
||||
install_package "readline-8.1" "https://ftpmirror.gnu.org/readline/readline-8.1.tar.gz#f8ceb4ee131e3232226a17f51b164afc46cd0b9e6cef344be87c65962cb82b02" mac_readline --if has_broken_mac_readline
|
||||
if has_tar_xz_support; then
|
||||
install_package "Python-3.10.19" "https://www.python.org/ftp/python/3.10.19/Python-3.10.19.tar.xz#c8f4a596572201d81dd7df91f70e177e19a70f1d489968b54b5fbbf29a97c076" standard verify_py310 copy_python_gdb ensurepip
|
||||
else
|
||||
install_package "Python-3.10.19" "https://www.python.org/ftp/python/3.10.19/Python-3.10.19.tgz#a078fb2d7a216071ebbe2e34b5f5355dd6b6e9b0cd1bacc4a41c63990c5a0eec" standard verify_py310 copy_python_gdb ensurepip
|
||||
fi
|
||||
10
plugins/python-build/share/python-build/3.11.14
Normal file
10
plugins/python-build/share/python-build/3.11.14
Normal 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.2.4" "https://github.com/openssl/openssl/releases/download/openssl-3.2.4/openssl-3.2.4.tar.gz#b23ad7fd9f73e43ad1767e636040e88ba7c9e5775bfa5618436a0dd2c17c3716" 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.11.14" "https://www.python.org/ftp/python/3.11.14/Python-3.11.14.tar.xz#8d3ed8ec5c88c1c95f5e558612a725450d2452813ddad5e58fdb1a53b1209b78" standard verify_py311 copy_python_gdb ensurepip
|
||||
else
|
||||
install_package "Python-3.11.14" "https://www.python.org/ftp/python/3.11.14/Python-3.11.14.tgz#563d2a1b2a5ba5d5409b5ecd05a0e1bf9b028cf3e6a6f0c87a5dc8dc3f2d9182" standard verify_py311 copy_python_gdb ensurepip
|
||||
fi
|
||||
10
plugins/python-build/share/python-build/3.12.12
Normal file
10
plugins/python-build/share/python-build/3.12.12
Normal 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.5.1" "https://github.com/openssl/openssl/releases/download/openssl-3.5.1/openssl-3.5.1.tar.gz#529043b15cffa5f36077a4d0af83f3de399807181d607441d734196d889b641f" 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.12.12" "https://www.python.org/ftp/python/3.12.12/Python-3.12.12.tar.xz#fb85a13414b028c49ba18bbd523c2d055a30b56b18b92ce454ea2c51edc656c4" standard verify_py312 copy_python_gdb ensurepip
|
||||
else
|
||||
install_package "Python-3.12.12" "https://www.python.org/ftp/python/3.12.12/Python-3.12.12.tgz#487c908ddf4097a1b9ba859f25fe46d22ccaabfb335880faac305ac62bffb79b" standard verify_py312 copy_python_gdb ensurepip
|
||||
fi
|
||||
12
plugins/python-build/share/python-build/3.9.24
Normal file
12
plugins/python-build/share/python-build/3.9.24
Normal file
@ -0,0 +1,12 @@
|
||||
prefer_openssl3
|
||||
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
|
||||
# Avoid a compilation error when linking against OpenSSL built with SSLv3 support (fixed in 3.10.0) (#2181)
|
||||
export PYTHON_CFLAGS="-DOPENSSL_NO_SSL3${PYTHON_CFLAGS:+ $PYTHON_CFLAGS}"
|
||||
|
||||
install_package "openssl-3.0.16" "https://github.com/openssl/openssl/releases/download/openssl-3.0.16/openssl-3.0.16.tar.gz#57e03c50feab5d31b152af2b764f10379aecd8ee92f16c985983ce4a99f7ef86" mac_openssl --if has_broken_mac_openssl
|
||||
install_package "readline-8.1" "https://ftpmirror.gnu.org/readline/readline-8.1.tar.gz#f8ceb4ee131e3232226a17f51b164afc46cd0b9e6cef344be87c65962cb82b02" mac_readline --if has_broken_mac_readline
|
||||
if has_tar_xz_support; then
|
||||
install_package "Python-3.9.24" "https://www.python.org/ftp/python/3.9.24/Python-3.9.24.tar.xz#668391afabd5083faafa4543753d190f82f33ce6ba22d6e9ac728b43644b278a" standard verify_py39 copy_python_gdb ensurepip
|
||||
else
|
||||
install_package "Python-3.9.24" "https://www.python.org/ftp/python/3.9.24/Python-3.9.24.tgz#9a32cfc683aecaadbd9ed891ac2af9451ff37f48a00a2d8e1f4ecd9c2a1ffdcb" standard verify_py39 copy_python_gdb ensurepip
|
||||
fi
|
||||
@ -68,6 +68,20 @@ assert_build_log() {
|
||||
assert_output
|
||||
}
|
||||
|
||||
stub_tcltk() {
|
||||
local tcltk_prefix="${1:?}"
|
||||
mkdir -p "$tcltk_prefix/lib"
|
||||
cat >"$tcltk_prefix/lib/tclConfig.sh" <<!
|
||||
TCL_INCLUDE_SPEC='-I${tcltk_prefix}/include'
|
||||
TCL_LIB_SPEC='-L${tcltk_prefix}/lib -ltclX.Y'
|
||||
!
|
||||
cat >"$tcltk_prefix/lib/tkConfig.sh" <<!
|
||||
TK_INCLUDE_SPEC='-I${tcltk_prefix}/include'
|
||||
TK_LIB_SPEC='-L${tcltk_prefix}/lib -ltkX.Y'
|
||||
!
|
||||
|
||||
}
|
||||
|
||||
@test "yaml is installed for python" {
|
||||
cached_tarball "yaml-0.1.6"
|
||||
cached_tarball "Python-3.6.2"
|
||||
@ -216,11 +230,11 @@ install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2.
|
||||
DEF
|
||||
assert_success
|
||||
|
||||
unstub uname
|
||||
unstub sw_vers
|
||||
unstub brew
|
||||
unstub port
|
||||
unstub make
|
||||
# unstub uname
|
||||
# unstub sw_vers
|
||||
# unstub brew
|
||||
# unstub port
|
||||
# unstub make
|
||||
|
||||
assert_build_log <<OUT
|
||||
Python-3.6.2: CFLAGS="" CPPFLAGS="-I${BATS_TEST_TMPDIR}/install/include -I$BREW_PREFIX/include" LDFLAGS="-L${BATS_TEST_TMPDIR}/install/lib -Wl,-rpath,${BATS_TEST_TMPDIR}/install/lib -L$BREW_PREFIX/lib -Wl,-rpath,$BREW_PREFIX/lib" PKG_CONFIG_PATH=""
|
||||
@ -763,10 +777,7 @@ OUT
|
||||
|
||||
@test "tcl-tk is linked from Homebrew via --with-tcl-*" {
|
||||
cached_tarball "Python-3.6.2"
|
||||
tcl_tk_version=8.6
|
||||
tcl_tk_libdir="$BATS_TEST_TMPDIR/homebrew-tcl-tk"
|
||||
mkdir -p "$tcl_tk_libdir/lib"
|
||||
echo "TCL_VERSION='$tcl_tk_version'" >>"$tcl_tk_libdir/lib/tclConfig.sh"
|
||||
stub_tcltk "${tcl_tk_libdir:=$BATS_TEST_TMPDIR/homebrew-tcl-tk}"
|
||||
|
||||
stub uname '-s : echo Darwin'
|
||||
stub sw_vers '-productVersion : echo 1010'
|
||||
@ -788,7 +799,40 @@ DEF
|
||||
|
||||
assert_build_log <<OUT
|
||||
Python-3.6.2: CFLAGS="" CPPFLAGS="-I${BATS_TEST_TMPDIR}/install/include" LDFLAGS="-L${BATS_TEST_TMPDIR}/install/lib -Wl,-rpath,${BATS_TEST_TMPDIR}/install/lib" PKG_CONFIG_PATH="${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib/pkgconfig"
|
||||
Python-3.6.2: --prefix=${BATS_TEST_TMPDIR}/install --enable-shared --libdir=${BATS_TEST_TMPDIR}/install/lib --with-tcltk-includes=-I${BATS_TEST_TMPDIR}/homebrew-tcl-tk/include --with-tcltk-libs=-L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltcl$tcl_tk_version -ltk$tcl_tk_version
|
||||
Python-3.6.2: --prefix=${BATS_TEST_TMPDIR}/install --enable-shared --libdir=${BATS_TEST_TMPDIR}/install/lib --with-tcltk-includes=-I${BATS_TEST_TMPDIR}/homebrew-tcl-tk/include -I${BATS_TEST_TMPDIR}/homebrew-tcl-tk/include --with-tcltk-libs=-L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltclX.Y -L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltkX.Y
|
||||
make -j 2
|
||||
make install
|
||||
OUT
|
||||
}
|
||||
|
||||
@test "tcl-tk with external libtommath is linked from Homebrew via --with-tcl-*" {
|
||||
cached_tarball "Python-3.6.2"
|
||||
stub_tcltk "${tcl_tk_libdir:=$BATS_TEST_TMPDIR/homebrew-tcl-tk}"
|
||||
cat >>"$tcl_tk_libdir/lib/tclConfig.sh" <<!
|
||||
TCL_DEFS='-DSMTH -DTCL_WITH_EXTERNAL_TOMMATH=1 -DSMTH_ELSE'
|
||||
!
|
||||
|
||||
stub uname '-s : echo Darwin'
|
||||
stub sw_vers '-productVersion : echo 1010'
|
||||
|
||||
stub brew "--prefix tcl-tk@8 : echo '$tcl_tk_libdir'"
|
||||
for i in {1..4}; do stub brew false; done
|
||||
|
||||
stub_make_install
|
||||
|
||||
run_inline_definition <<DEF
|
||||
install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2.tar.gz"
|
||||
DEF
|
||||
assert_success
|
||||
|
||||
unstub uname
|
||||
unstub sw_vers
|
||||
unstub brew
|
||||
unstub make
|
||||
|
||||
assert_build_log <<OUT
|
||||
Python-3.6.2: CFLAGS="-DTCL_WITH_EXTERNAL_TOMMATH=1" CPPFLAGS="-I${BATS_TEST_TMPDIR}/install/include" LDFLAGS="-L${BATS_TEST_TMPDIR}/install/lib -Wl,-rpath,${BATS_TEST_TMPDIR}/install/lib" PKG_CONFIG_PATH="${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib/pkgconfig"
|
||||
Python-3.6.2: --prefix=${BATS_TEST_TMPDIR}/install --enable-shared --libdir=${BATS_TEST_TMPDIR}/install/lib --with-tcltk-includes=-I${BATS_TEST_TMPDIR}/homebrew-tcl-tk/include -I${BATS_TEST_TMPDIR}/homebrew-tcl-tk/include --with-tcltk-libs=-L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltclX.Y -L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltkX.Y
|
||||
make -j 2
|
||||
make install
|
||||
OUT
|
||||
@ -796,10 +840,7 @@ OUT
|
||||
|
||||
@test "tcl-tk is linked from Homebrew with PYTHON_BUILD_TCLTK_FORMULA" {
|
||||
cached_tarball "Python-3.6.2"
|
||||
tcl_tk_version=8.6
|
||||
tcl_tk_libdir="$BATS_TEST_TMPDIR/homebrew-tcl-tk"
|
||||
mkdir -p "$tcl_tk_libdir/lib"
|
||||
echo "TCL_VERSION='$tcl_tk_version'" >>"$tcl_tk_libdir/lib/tclConfig.sh"
|
||||
stub_tcltk "${tcl_tk_libdir:=$BATS_TEST_TMPDIR/homebrew-tcl-tk}"
|
||||
|
||||
stub uname '-s : echo Darwin'
|
||||
stub sw_vers '-productVersion : echo 1010'
|
||||
@ -822,7 +863,7 @@ DEF
|
||||
|
||||
assert_build_log <<OUT
|
||||
Python-3.6.2: CFLAGS="" CPPFLAGS="-I${BATS_TEST_TMPDIR}/install/include" LDFLAGS="-L${BATS_TEST_TMPDIR}/install/lib -Wl,-rpath,${BATS_TEST_TMPDIR}/install/lib" PKG_CONFIG_PATH="${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib/pkgconfig"
|
||||
Python-3.6.2: --prefix=${BATS_TEST_TMPDIR}/install --enable-shared --libdir=${BATS_TEST_TMPDIR}/install/lib --with-tcltk-includes=-I${BATS_TEST_TMPDIR}/homebrew-tcl-tk/include --with-tcltk-libs=-L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltcl$tcl_tk_version -ltk$tcl_tk_version
|
||||
Python-3.6.2: --prefix=${BATS_TEST_TMPDIR}/install --enable-shared --libdir=${BATS_TEST_TMPDIR}/install/lib --with-tcltk-includes=-I${BATS_TEST_TMPDIR}/homebrew-tcl-tk/include -I${BATS_TEST_TMPDIR}/homebrew-tcl-tk/include --with-tcltk-libs=-L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltclX.Y -L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltkX.Y
|
||||
make -j 2
|
||||
make install
|
||||
OUT
|
||||
@ -830,10 +871,7 @@ OUT
|
||||
|
||||
@test "tcl-tk is linked from Homebrew via pkg-config and override vars" {
|
||||
cached_tarball "Python-3.6.2" - TCLTK_CFLAGS TCLTK_LIBS
|
||||
tcl_tk_version=8.6
|
||||
tcl_tk_libdir="$BATS_TEST_TMPDIR/homebrew-tcl-tk"
|
||||
mkdir -p "$tcl_tk_libdir/lib"
|
||||
echo "TCL_VERSION='$tcl_tk_version'" >>"$tcl_tk_libdir/lib/tclConfig.sh"
|
||||
stub_tcltk "${tcl_tk_libdir:=$BATS_TEST_TMPDIR/homebrew-tcl-tk}"
|
||||
|
||||
stub uname '-s : echo Darwin'
|
||||
stub sw_vers '-productVersion : echo 1010'
|
||||
@ -857,7 +895,42 @@ DEF
|
||||
assert_build_log <<OUT
|
||||
Python-3.6.2: CFLAGS="" CPPFLAGS="-I${BATS_TEST_TMPDIR}/install/include" LDFLAGS="-L${BATS_TEST_TMPDIR}/install/lib -Wl,-rpath,${BATS_TEST_TMPDIR}/install/lib" PKG_CONFIG_PATH="${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib/pkgconfig"
|
||||
Python-3.6.2: --prefix=${BATS_TEST_TMPDIR}/install --enable-shared --libdir=${BATS_TEST_TMPDIR}/install/lib
|
||||
Python-3.6.2: TCLTK_CFLAGS=-I${BATS_TEST_TMPDIR}/homebrew-tcl-tk/include TCLTK_LIBS=-L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltcl$tcl_tk_version -ltk$tcl_tk_version
|
||||
Python-3.6.2: TCLTK_CFLAGS=-I${BATS_TEST_TMPDIR}/homebrew-tcl-tk/include -I${BATS_TEST_TMPDIR}/homebrew-tcl-tk/include TCLTK_LIBS=-L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltclX.Y -L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltkX.Y
|
||||
make -j 2
|
||||
make install
|
||||
OUT
|
||||
}
|
||||
|
||||
@test "tcl-tk with external libtommath is linked from Homebrew via pkg-config and override vars" {
|
||||
cached_tarball "Python-3.6.2" - TCLTK_CFLAGS TCLTK_LIBS
|
||||
stub_tcltk "${tcl_tk_libdir:=$BATS_TEST_TMPDIR/homebrew-tcl-tk}"
|
||||
cat >>"$tcl_tk_libdir/lib/tclConfig.sh" <<!
|
||||
TCL_DEFS='-DSMTH -DTCL_WITH_EXTERNAL_TOMMATH=1 -DSMTH_ELSE'
|
||||
!
|
||||
|
||||
stub uname '-s : echo Darwin'
|
||||
stub sw_vers '-productVersion : echo 1010'
|
||||
|
||||
stub brew "--prefix tcl-tk@8 : echo '$tcl_tk_libdir'"
|
||||
for i in {1..4}; do stub brew false; done
|
||||
|
||||
stub_make_install
|
||||
|
||||
run_inline_definition <<DEF
|
||||
PYTHON_BUILD_TCLTK_USE_PKGCONFIG=1
|
||||
install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2.tar.gz"
|
||||
DEF
|
||||
assert_success
|
||||
|
||||
unstub uname
|
||||
unstub sw_vers
|
||||
unstub brew
|
||||
unstub make
|
||||
|
||||
assert_build_log <<OUT
|
||||
Python-3.6.2: CFLAGS="" CPPFLAGS="-I${BATS_TEST_TMPDIR}/install/include" LDFLAGS="-L${BATS_TEST_TMPDIR}/install/lib -Wl,-rpath,${BATS_TEST_TMPDIR}/install/lib" PKG_CONFIG_PATH="${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib/pkgconfig"
|
||||
Python-3.6.2: --prefix=${BATS_TEST_TMPDIR}/install --enable-shared --libdir=${BATS_TEST_TMPDIR}/install/lib
|
||||
Python-3.6.2: TCLTK_CFLAGS=-I${BATS_TEST_TMPDIR}/homebrew-tcl-tk/include -I${BATS_TEST_TMPDIR}/homebrew-tcl-tk/include -DTCL_WITH_EXTERNAL_TOMMATH=1 TCLTK_LIBS=-L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltclX.Y -L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltkX.Y
|
||||
make -j 2
|
||||
make install
|
||||
OUT
|
||||
|
||||
@ -74,6 +74,19 @@ OUT
|
||||
assert_line 'pyenv init - fish | source'
|
||||
}
|
||||
|
||||
@test "setup shell completions (pwsh)" {
|
||||
root="$(cd $BATS_TEST_DIRNAME/.. && pwd)"
|
||||
run pyenv-init - pwsh
|
||||
assert_success
|
||||
assert_line "iex (gc ${root}/test/../libexec/../completions/pyenv.pwsh -Raw)"
|
||||
}
|
||||
|
||||
@test "pwsh instructions" {
|
||||
run pyenv-init pwsh
|
||||
assert [ "$status" -eq 1 ]
|
||||
assert_line 'iex ((pyenv init -) -join "`n")'
|
||||
}
|
||||
|
||||
@test "shell detection for installer" {
|
||||
run pyenv-init --detect-shell
|
||||
assert_success
|
||||
@ -100,6 +113,13 @@ OUT
|
||||
assert_line "set -gx PATH '${PYENV_ROOT}/shims' \$PATH"
|
||||
}
|
||||
|
||||
@test "adds shims to PATH (pwsh)" {
|
||||
export PATH="${BATS_TEST_DIRNAME}/../libexec:/usr/bin:/bin:/usr/local/bin"
|
||||
run pyenv-init - pwsh
|
||||
assert_success
|
||||
assert_line '$Env:PATH="'${PYENV_ROOT}'/shims:$Env:PATH"'
|
||||
}
|
||||
|
||||
@test "removes existing shims from PATH" {
|
||||
OLDPATH="$PATH"
|
||||
export PATH="${BATS_TEST_DIRNAME}/nonexistent:${PYENV_ROOT}/shims:$PATH"
|
||||
@ -124,6 +144,19 @@ echo "\$PATH"
|
||||
assert_output "${PYENV_ROOT}/shims:${BATS_TEST_DIRNAME}/nonexistent:${OLDPATH//${PYENV_ROOT}\/shims:/}"
|
||||
}
|
||||
|
||||
@test "removes existing shims from PATH (pwsh)" {
|
||||
command -v pwsh >/dev/null || skip "-- pwsh not installed"
|
||||
OLDPATH="$PATH"
|
||||
export PATH="${BATS_TEST_DIRNAME}/nonexistent:${PYENV_ROOT}/shims:$PATH"
|
||||
run pwsh -noni -c - <<!
|
||||
\$Env:PATH="$PATH"
|
||||
iex ((pyenv init -) -join "\`n")
|
||||
echo "\$Env:PATH"
|
||||
!
|
||||
assert_success
|
||||
assert_output "${PYENV_ROOT}/shims:${BATS_TEST_DIRNAME}/nonexistent:${OLDPATH//${PYENV_ROOT}\/shims:/}"
|
||||
}
|
||||
|
||||
@test "adds shims to PATH with --no-push-path if they're not on PATH" {
|
||||
export PATH="${BATS_TEST_DIRNAME}/../libexec:/usr/bin:/bin:/usr/local/bin"
|
||||
run bash -e <<!
|
||||
@ -146,6 +179,18 @@ echo "\$PATH"
|
||||
assert_output "${PYENV_ROOT}/shims:${PATH}"
|
||||
}
|
||||
|
||||
@test "adds shims to PATH with --no-push-path if they're not on PATH (pwsh)" {
|
||||
command -v pwsh >/dev/null || skip "-- pwsh not installed"
|
||||
export PATH="${BATS_TEST_DIRNAME}/../libexec:/usr/bin:/bin:/usr/local/bin"
|
||||
run pwsh -noni -c - <<!
|
||||
\$Env:PATH="$PATH"
|
||||
iex ((pyenv init - --no-push-path) -join "\`n")
|
||||
echo "\$Env:PATH"
|
||||
!
|
||||
assert_success
|
||||
assert_output "${PYENV_ROOT}/shims:${PATH}"
|
||||
}
|
||||
|
||||
@test "doesn't change PATH with --no-push-path if shims are already on PATH" {
|
||||
export PATH="${BATS_TEST_DIRNAME}/../libexec:${PYENV_ROOT}/shims:/usr/bin:/bin:/usr/local/bin"
|
||||
run bash -e <<!
|
||||
@ -168,6 +213,18 @@ echo "\$PATH"
|
||||
assert_output "${PATH}"
|
||||
}
|
||||
|
||||
@test "doesn't change PATH with --no-push-path if shims are already on PATH (pwsh)" {
|
||||
command -v pwsh >/dev/null || skip "-- pwsh not installed"
|
||||
export PATH="${BATS_TEST_DIRNAME}/../libexec:/usr/bin:${PYENV_ROOT}/shims:/bin:/usr/local/bin"
|
||||
run pwsh -noni -c - <<!
|
||||
\$Env:PATH="$PATH"
|
||||
iex ((pyenv init - --no-push-path) -join "\`n")
|
||||
echo "\$Env:PATH"
|
||||
!
|
||||
assert_success
|
||||
assert_output "${PATH}"
|
||||
}
|
||||
|
||||
@test "outputs sh-compatible syntax" {
|
||||
run pyenv-init - bash
|
||||
assert_success
|
||||
@ -202,3 +259,10 @@ echo
|
||||
assert_line ' switch "$command"'
|
||||
refute_line ' case "$command" in'
|
||||
}
|
||||
|
||||
@test "outputs pwsh-specific syntax (pwsh)" {
|
||||
run pyenv-init - pwsh
|
||||
assert_success
|
||||
refute_line ' switch "$command"'
|
||||
refute_line ' case "$command" in'
|
||||
}
|
||||
|
||||
@ -120,3 +120,10 @@ SH
|
||||
assert_success ""
|
||||
assert [ -x "${PYENV_ROOT}/shims/python" ]
|
||||
}
|
||||
|
||||
@test "sh-rehash in pwsh" {
|
||||
create_executable "3.4" "python"
|
||||
PYENV_SHELL=pwsh run pyenv-sh-rehash
|
||||
assert_success ""
|
||||
assert [ -x "${PYENV_ROOT}/shims/python" ]
|
||||
}
|
||||
|
||||
@ -31,6 +31,11 @@ load test_helper
|
||||
assert_success 'echo "$PYENV_VERSION"'
|
||||
}
|
||||
|
||||
@test "shell version (pwsh)" {
|
||||
PYENV_SHELL=pwsh PYENV_VERSION="1.2.3" run pyenv-sh-shell
|
||||
assert_success 'echo "$PYENV_VERSION"'
|
||||
}
|
||||
|
||||
@test "shell revert" {
|
||||
PYENV_SHELL=bash run pyenv-sh-shell -
|
||||
assert_success
|
||||
@ -43,6 +48,12 @@ load test_helper
|
||||
assert_line 0 'if set -q PYENV_VERSION_OLD'
|
||||
}
|
||||
|
||||
@test "shell revert (pwsh)" {
|
||||
PYENV_SHELL=pwsh run pyenv-sh-shell -
|
||||
assert_success
|
||||
assert_line 0 'if ( Get-Item -Path Env:\PYENV_VERSION* ) {'
|
||||
}
|
||||
|
||||
@test "shell unset" {
|
||||
PYENV_SHELL=bash run pyenv-sh-shell --unset
|
||||
assert_success
|
||||
@ -61,6 +72,14 @@ set -e PYENV_VERSION
|
||||
OUT
|
||||
}
|
||||
|
||||
@test "shell unset (pwsh)" {
|
||||
PYENV_SHELL=pwsh run pyenv-sh-shell --unset
|
||||
assert_success
|
||||
assert_output <<OUT
|
||||
\$Env:PYENV_VERSION, \$Env:PYENV_VERSION_OLD = \$null, \$Env:PYENV_VERSION
|
||||
OUT
|
||||
}
|
||||
|
||||
@test "shell change invalid version" {
|
||||
run pyenv-sh-shell 1.2.3
|
||||
assert_failure
|
||||
@ -89,3 +108,12 @@ set -gu PYENV_VERSION_OLD "\$PYENV_VERSION"
|
||||
set -gx PYENV_VERSION "1.2.3"
|
||||
OUT
|
||||
}
|
||||
|
||||
@test "shell change version (pwsh)" {
|
||||
mkdir -p "${PYENV_ROOT}/versions/1.2.3"
|
||||
PYENV_SHELL=pwsh run pyenv-sh-shell 1.2.3
|
||||
assert_success
|
||||
assert_output <<OUT
|
||||
\$Env:PYENV_VERSION, \$Env:PYENV_VERSION_OLD = "1.2.3", \$Env:PYENV_VERSION
|
||||
OUT
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user