diff --git a/CHANGELOG.md b/CHANGELOG.md index 70d21651..2174311a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Version History +## Release v2.7.3 +* CI: add_version enhancements by @macayu17 in https://github.com/pyenv/pyenv/pull/3475 +* Add CPython 3.15.0b3 by @pyenv-bot[bot] in https://github.com/pyenv/pyenv/pull/3479 + ## Release v2.7.2 * fix(rehash): prevent terminal hang caused by stale or sandbox-blocked lock file by @anupddas in https://github.com/pyenv/pyenv/pull/3469 * 3.6.x: Fix verify_* calls by @native-api in https://github.com/pyenv/pyenv/commit/6c0c5cfa9619e4a7a90102d8bee6c771c4739836 diff --git a/README.md b/README.md index 942f3e09..2872e7e0 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,7 @@ This project was forked from [rbenv](https://github.com/rbenv/rbenv) and * [Using Pyenv without shims](#using-pyenv-without-shims) * [Running nested shells from Python-based programs](#running-nested-shells-from-python-based-programs) * [Environment variables](#environment-variables) + * [Manual shell setup](#manual-shell-setup) * **[Development](#development)** * [Contributing](#contributing) * [Version History](#version-history) @@ -177,134 +178,29 @@ which does install native Windows Python versions. ---- The below setup should work for the vast majority of users for common use cases. -See [Advanced configuration](#advanced-configuration) for details and more configuration options. +See [Advanced configuration](#advanced-configuration) +and specifically [Manual shell setup](#manual-shell-setup) for details and more configuration options. -If `pyenv` is already on `PATH`, you can configure the relevant shell startup -files automatically: +To add the suggested setup code to the startup files of the running shell, +run ` --install`. +Specifically: + +* If you installed Pyenv with the installer script: + +```sh +~/.pyenv/bin/pyenv init --install +``` + +* If you installed Pyenv with Homebrew: ```sh pyenv init --install ``` -If `pyenv` is not on `PATH` yet, run the same command through the `pyenv` -executable in your chosen installation directory. - -This uses the same shell detection as `pyenv init`. If a startup file already -contains Pyenv-related configuration, the command refuses to edit it; review the -file manually and run `pyenv init ` to see the suggested setup. - For Bash, avoid the automatic `--install` path if your `BASH_ENV` points to `.bashrc`; use the manual Bash instructions below so the `eval "$(pyenv init - bash)"` line only goes in your login startup file. -#### Bash -
- - Stock Bash startup files vary widely between distributions in which of them source - which, under what circumstances, in what order and what additional configuration they perform. - As such, the most reliable way to get Pyenv in all environments is to append Pyenv - configuration commands to both `.bashrc` (for interactive shells) - and the profile file that Bash would use (for login shells). - - 1. First, add the commands to `~/.bashrc` by running the following in your terminal: - - ```bash - echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc - echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc - echo 'eval "$(pyenv init - bash)"' >> ~/.bashrc - ``` - 2. Then, if you have `~/.profile`, `~/.bash_profile` or `~/.bash_login`, add the commands there as well. - If you have none of these, create a `~/.profile` and add the commands there. - - * to add to `~/.profile`: - ``` bash - echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile - echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile - echo 'eval "$(pyenv init - bash)"' >> ~/.profile - ``` - * to add to `~/.bash_profile`: - ```bash - echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile - echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile - echo 'eval "$(pyenv init - bash)"' >> ~/.bash_profile - ``` - - **Bash warning**: There are some systems where the `BASH_ENV` variable is configured - to point to `.bashrc`. On such systems, you should almost certainly put the - `eval "$(pyenv init - bash)"` line into `.bash_profile`, and **not** into `.bashrc`. Otherwise, you - may observe strange behaviour, such as `pyenv` getting into an infinite loop. - See [#264](https://github.com/pyenv/pyenv/issues/264) for details. - -
- -#### Zsh - -
- Add Pyenv startup commands to `~/.zshrc` by running the following in your terminal: - - ```zsh - echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc - echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc - echo 'eval "$(pyenv init - zsh)"' >> ~/.zshrc - ``` - - If you wish to get Pyenv in noninteractive login shells as well, also add the commands to `~/.zprofile` or `~/.zlogin`. -
- -#### Fish - -
- - 1. If you have Fish 3.2.0 or newer, execute this interactively: - ```fish - set -Ux PYENV_ROOT $HOME/.pyenv - test -d $PYENV_ROOT/bin; and fish_add_path $PYENV_ROOT/bin - ``` - - 2. Otherwise, execute the snippet below: - ```fish - set -Ux PYENV_ROOT $HOME/.pyenv - test -d $PYENV_ROOT/bin; and set -U fish_user_paths $PYENV_ROOT/bin $fish_user_paths - ``` - - 3. Now, add this to `~/.config/fish/config.fish`: - ```fish - pyenv init - fish | source - ``` -
- -#### Nushell - -
- - Add the following lines to your `config.nu` to add Pyenv and its shims to your `PATH`. - Shell integration (completions and subcommands changing the shell's state) - isn't currently supported. - - ~~~ nu - $env.PYENV_ROOT = "~/.pyenv" | path expand - if (( $"($env.PYENV_ROOT)/bin" | path type ) == "dir") { - $env.PATH = $env.PATH | prepend $"($env.PYENV_ROOT)/bin" } - $env.PATH = $env.PATH | prepend $"(pyenv root)/shims" - ~~~ - -
- -#### Microsoft PowerShell - -
- - Add the commands to `$profile.CurrentUserAllHosts` by running the following in your terminal: - - ~~~ pwsh - echo '$Env:PYENV_ROOT="$Env:HOME/.pyenv"' >> $profile.CurrentUserAllHosts - echo 'if (Test-Path -LP "$Env:PYENV_ROOT/bin" -PathType Container) { - $Env:PATH="$Env:PYENV_ROOT/bin:$Env:PATH" }' >> $profile.CurrentUserAllHosts - echo 'iex ((pyenv init -) -join "`n")' >> $profile.CurrentUserAllHosts - ~~~ - -
- ### C. Restart your shell ---- @@ -815,6 +711,127 @@ name | default | description See also [_Special environment variables_ in Python-Build's README](plugins/python-build/README.md#special-environment-variables) for environment variables that can be used to customize the build. + +### Manual shell setup + +Below is the suggested shell setup added to shell startup files by `pyenv init --install`. + +* To automatically install Pyenv for a shell different than the running shell, run + +```sh +path/to/pyenv --install +``` + +e.g. `~/.pyenv --install bash`. + +#### Bash +
+ + Stock Bash startup files vary widely between distributions in which of them source + which, under what circumstances, in what order and what additional configuration they perform. + As such, the most reliable way to get Pyenv in all environments is to append Pyenv + configuration commands to both `.bashrc` (for interactive shells) + and the profile file that Bash would use (for login shells). + + 1. First, add the commands to `~/.bashrc` by running the following in your terminal: + + ```bash + echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc + echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc + echo 'eval "$(pyenv init - bash)"' >> ~/.bashrc + ``` + 2. Then, if you have `~/.profile`, `~/.bash_profile` or `~/.bash_login`, add the commands there as well. + If you have none of these, create a `~/.profile` and add the commands there. + + * to add to `~/.profile`: + ``` bash + echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile + echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile + echo 'eval "$(pyenv init - bash)"' >> ~/.profile + ``` + * to add to `~/.bash_profile`: + ```bash + echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile + echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile + echo 'eval "$(pyenv init - bash)"' >> ~/.bash_profile + ``` + + **Bash warning**: There are some systems where the `BASH_ENV` variable is configured + to point to `.bashrc`. On such systems, you should almost certainly put the + `eval "$(pyenv init - bash)"` line into `.bash_profile`, and **not** into `.bashrc`. Otherwise, you + may observe strange behaviour, such as `pyenv` getting into an infinite loop. + See [#264](https://github.com/pyenv/pyenv/issues/264) for details. + +
+ +#### Zsh + +
+ Add Pyenv startup commands to `~/.zshrc` by running the following in your terminal: + + ```zsh + echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc + echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc + echo 'eval "$(pyenv init - zsh)"' >> ~/.zshrc + ``` + + If you wish to get Pyenv in noninteractive login shells as well, also add the commands to `~/.zprofile` or `~/.zlogin`. +
+ +#### Fish + +
+ + 1. If you have Fish 3.2.0 or newer, execute this interactively: + ```fish + set -Ux PYENV_ROOT $HOME/.pyenv + test -d $PYENV_ROOT/bin; and fish_add_path $PYENV_ROOT/bin + ``` + + 2. Otherwise, execute the snippet below: + ```fish + set -Ux PYENV_ROOT $HOME/.pyenv + test -d $PYENV_ROOT/bin; and set -U fish_user_paths $PYENV_ROOT/bin $fish_user_paths + ``` + + 3. Now, add this to `~/.config/fish/config.fish`: + ```fish + pyenv init - fish | source + ``` +
+ +#### Nushell + +
+ + Add the following lines to your `config.nu` to add Pyenv and its shims to your `PATH`. + Shell integration (completions and subcommands changing the shell's state) + isn't currently supported. + + ~~~ nu + $env.PYENV_ROOT = "~/.pyenv" | path expand + if (( $"($env.PYENV_ROOT)/bin" | path type ) == "dir") { + $env.PATH = $env.PATH | prepend $"($env.PYENV_ROOT)/bin" } + $env.PATH = $env.PATH | prepend $"(pyenv root)/shims" + ~~~ + +
+ +#### Microsoft PowerShell + +
+ + Add the commands to `$profile.CurrentUserAllHosts` by running the following in your terminal: + + ~~~ pwsh + echo '$Env:PYENV_ROOT="$Env:HOME/.pyenv"' >> $profile.CurrentUserAllHosts + echo 'if (Test-Path -LP "$Env:PYENV_ROOT/bin" -PathType Container) { + $Env:PATH="$Env:PYENV_ROOT/bin:$Env:PATH" }' >> $profile.CurrentUserAllHosts + echo 'iex ((pyenv init -) -join "`n")' >> $profile.CurrentUserAllHosts + ~~~ + +
+ ---- ## Development diff --git a/libexec/pyenv---version b/libexec/pyenv---version index 80259dec..f9c0a363 100755 --- a/libexec/pyenv---version +++ b/libexec/pyenv---version @@ -12,7 +12,7 @@ set -e [ -n "$PYENV_DEBUG" ] && set -x -version="2.7.2" +version="2.7.3" git_revision="" if cd "${BASH_SOURCE%/*}" 2>/dev/null && git remote -v 2>/dev/null | grep -q pyenv; then diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index e80602c2..35d1c099 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -14,7 +14,7 @@ # -g/--debug Build a debug version # -PYTHON_BUILD_VERSION="2.7.2" +PYTHON_BUILD_VERSION="2.7.3" OLDIFS="$IFS" diff --git a/plugins/python-build/scripts/add_cpython.py b/plugins/python-build/scripts/add_cpython.py index 406cc6fe..34d5fbaa 100755 --- a/plugins/python-build/scripts/add_cpython.py +++ b/plugins/python-build/scripts/add_cpython.py @@ -87,7 +87,7 @@ def adapt_script(version: packaging.version.Version, elif m:=re.match(r'\s*install_package\s+' r'"(?Popenssl-(?P\d+)\.\S+)"\s+' - r'"(?P\S+)"\s.*$', + r'"(?P\S+)"\s.*$', line): item = VersionDirectory.openssl.get_store_latest_release( int(m.group('openssl_major')) @@ -743,7 +743,7 @@ class Url: if __name__ == "__main__": #sys.excepthook seems to have no effect in Github Actions try: - sys.exit(main()) + sys.exit(main()) except Exception: logging.exception("Unhandled exception occured") sys.exit(2) diff --git a/plugins/python-build/scripts/requirements.txt b/plugins/python-build/scripts/requirements.txt index c79b3e29..07d4f730 100644 --- a/plugins/python-build/scripts/requirements.txt +++ b/plugins/python-build/scripts/requirements.txt @@ -6,4 +6,4 @@ packaging requests sortedcontainers tqdm -jc @ git+https://github.com/native-api/jc@haslib_mode +jc diff --git a/plugins/python-build/share/python-build/3.15.0b2 b/plugins/python-build/share/python-build/3.15.0b2 deleted file mode 100644 index c52bae07..00000000 --- a/plugins/python-build/share/python-build/3.15.0b2 +++ /dev/null @@ -1,11 +0,0 @@ -prefer_openssl3 -export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1 -export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL_RPATH=1 -export PYTHON_BUILD_TCLTK_USE_PKGCONFIG=1 -install_package "openssl-4.0.0" "https://github.com/openssl/openssl/releases/download/openssl-4.0.0/openssl-4.0.0.tar.gz#c32cf49a959c4f345f9606982dd36e7d28f7c58b19c2e25d75624d2b3d2f79ac" 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.0b2" "https://www.python.org/ftp/python/3.15.0/Python-3.15.0b2.tar.xz#d14f474ab679e90bc734b02ff58447b6ec99a821af61d6ff0c1da0f86e341a71" standard verify_py315 copy_python_gdb ensurepip -else - install_package "Python-3.15.0b2" "https://www.python.org/ftp/python/3.15.0/Python-3.15.0b2.tgz#781f4bcdef48d1d38b335fdc7a156b4e5fe9738b14456121f949257ff5cce77c" standard verify_py315 copy_python_gdb ensurepip -fi diff --git a/plugins/python-build/share/python-build/3.15.0b3 b/plugins/python-build/share/python-build/3.15.0b3 new file mode 100644 index 00000000..d70951d1 --- /dev/null +++ b/plugins/python-build/share/python-build/3.15.0b3 @@ -0,0 +1,11 @@ +prefer_openssl3 +export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1 +export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL_RPATH=1 +export PYTHON_BUILD_TCLTK_USE_PKGCONFIG=1 +install_package "openssl-4.0.1" "https://github.com/openssl/openssl/releases/download/openssl-4.0.1/openssl-4.0.1.tar.gz#2db3f3a0d6ea4b59e1f094ace2c8cd536dffb87cdc39084c5afa1e6f7f37dd09" 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.0b3" "https://www.python.org/ftp/python/3.15.0/Python-3.15.0b3.tar.xz#6a935ae234a67e6549894373b0cfeb8361182d03b21442328ae9598ab7422127" standard verify_py315 copy_python_gdb ensurepip +else + install_package "Python-3.15.0b3" "https://www.python.org/ftp/python/3.15.0/Python-3.15.0b3.tgz#e5a18806817f912f2c9a1091ac77703f9a969b129c878d436f0f7025bf2f9e97" standard verify_py315 copy_python_gdb ensurepip +fi diff --git a/plugins/python-build/share/python-build/3.15.0b2t b/plugins/python-build/share/python-build/3.15.0b3t similarity index 100% rename from plugins/python-build/share/python-build/3.15.0b2t rename to plugins/python-build/share/python-build/3.15.0b3t