Compare commits

...

432 Commits

Author SHA1 Message Date
Anupam Mediratta
8f70d418bb
add_cpython: refactor extra Requests logic (#3507)
---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
2026-08-04 13:12:42 +03:00
dependabot[bot]
bdf8d254fe
Bump actions/setup-python from 6 to 7 in the github-actions group (#3505)
Bumps the github-actions group with 1 update: [actions/setup-python](https://github.com/actions/setup-python).


Updates `actions/setup-python` from 6 to 7
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: '7'
  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-08-01 16:38:32 +03:00
Michael Šimáček
f5915fc866
Add graalpy3.12-25.2.4 (#3502) 2026-07-29 05:53:27 +03:00
Michael Newman
84e0f3a887
Fix typos 2026-07-29 05:49:46 +03:00
Ayush
7126870320
pyenv-binary: add the package subcommand; add pyenv install --list --bare (#3498)
Co-authored-by: native-api <vano@mail.mipt.ru>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2026-07-28 14:31:20 +03:00
Michael Newman
26dd5d9dda
Fix typo 2026-07-27 21:57:58 +03:00
Michael Newman
bac39a0ef8
Fix typo 2026-07-27 08:30:33 +03:00
Ivan Pozdeev
bec9a562a5 2.8.1 2026-07-18 22:02:09 +03:00
pyenv-bot[bot]
ae9e6594d6
Add CPython 3.15.0b4 (#3495)
Co-authored-by: native-api <2670332+native-api@users.noreply.github.com>
2026-07-18 21:59:23 +03:00
native-api
16c7cc6de4
Merge pull request #3488 from macayu17/feat/2334-pyenv-binary-installer
pyenv-binary: add the `generate-installer` subcommand
2026-07-16 10:51:36 +03:00
Ivan Pozdeev
017ad4a573 Add pyenv-binary tests to CI
* README: fix tests instructions
* test/README: -duplicating and unnecessary stuff
* Makefile: Build Docker images and replace bats link conditionally
* Makefile: fix indent irregularity
2026-07-16 10:39:55 +03:00
macayu17
6188e9efa9 pyenv-binary: add the generate-installer subcommand
* Relocation only implemented for Linux (requires patchelf + ldconfig -p)
* Shell-completing file name is not possible with current Pyenv completion logic:
  `pyenv-complete` does not pass info about the word being completed
* Fix `save`-produced tarball to be compatible with Python-Build fetch_tarball()
* Reuse test_helper from core

--

Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
2026-07-16 10:39:50 +03:00
Ivan Pozdeev
286a167cf0 gitignore Vim swap files 2026-07-16 10:22:39 +03:00
Ivan Pozdeev
135adbb192 2.8.0 2026-07-13 21:01:27 +03:00
native-api
b3a3e702f1
version-name: skip redundant checks (#3492) 2026-07-11 08:24:01 +03:00
native-api
958e3aca95
Add miniconda3 26.5.3-1 (#3491) 2026-07-11 08:23:42 +03:00
Ivan Pozdeev
74c6efe2f4 Adapt tests involving current directory for Docker
In Docker CI tests, the default current dir is read-only
2026-07-11 08:02:53 +03:00
native-api
95df7dbc7b
Merge commit from fork 2026-07-11 07:22:46 +03:00
max
e4c462dc70
Fix typos in docs, scripts, and tests (#3490) 2026-07-08 18:03:00 +03:00
OrbisAI Security
790bedd821
CI: fix: package_managers.dependabot.dependabot-missing-cooldown.dependabot-missing-cooldown security vulnerability (#3489)
Automated security fix generated by OrbisAI Security
2026-07-05 13:40:15 +03:00
Ayush
19f4c7cf20
Add an experimental pyenv-binary plugin with a save command (#3487)
* pyenv-binary: add experimental plugin skeleton

Adds a new plugin, decoupled from `pyenv install`, for packaging and installing
relocatable Python binaries. This commit is just the command dispatcher; the
individual subcommands follow.

`pyenv binary <command>` dispatches to the matching script under the plugin's
libexec, so subcommands stay out of the top-level `pyenv commands` list.

Groundwork for the binary distribution support discussed in #2334.

* pyenv-binary: add the `save` subcommand

`pyenv binary save <version> [<output-dir>]` packs an installed version into a
relocatable .tar.gz with relative paths and writes a metadata file recording the
build platform, distro, libc version and the external system libraries the
build links against (via `ldd` on Linux, `otool -L` on macOS).

* pyenv-binary: reject invalid version names and drop readlink -f in save

A version is a single directory name under versions/, so refuse names with a
slash or a dot-dot component before building the prefix path.

Also emit the python paths directly instead of `readlink -f`, which BSD
readlink on macOS does not support; ldd/otool follow the symlinks anyway, so
the resolved paths were never needed.

* pyenv-binary: test the `save` subcommand

Cover argument validation, the version-name guard, and packaging an
installed version into an archive with matching metadata.

* pyenv-binary: test dependency parsing and tighten the version guard

Add tests that feed realistic ldd and otool listings through save and
check only the libraries resolving outside the prefix end up in the
metadata, since that filtering is the fiddliest part of the command.

Narrow the version guard to reject `.' and `..' rather than any name
containing a dot-dot, now that a slash is already refused, and note why
the find still matches *.so.* even though CPython does not produce them.
2026-07-03 09:08:54 +03:00
dependabot[bot]
46cc3e552b
Bump actions/checkout from 6 to 7 in the github-actions group (#3486)
Bumps the github-actions group with 1 update: [actions/checkout](https://github.com/actions/checkout).


Updates `actions/checkout` from 6 to 7
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  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-07-01 10:27:40 +03:00
Michael Šimáček
8f68aab443
Add graalpy-3.12-25.1.3 (#3485)
* Add graalpy-3.12-25.1.3

* Adjust GraalPy version detection with the new naming scheme

---------

Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
2026-06-30 21:25:03 +03:00
Ivan Pozdeev
a27d2723d6 install: reflect the new alias syntax in reference 2026-06-30 04:17:58 +03:00
Ayush
4c78a0dd50
pyenv-install: install a version under a custom name with <version>:<alias> (#3484) 2026-06-30 04:12:16 +03:00
Ayush
91aacc5dbf
Add script to generate sponsors section for release notes (#3478)
* OpenCollectrive API is blocked by a Cloudflare challenge page in some locations so allow to specify the OpenCollective API data manually

---------

Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
2026-06-28 20:06:38 +03:00
Yo Takezawa
3974647f0f
rehash: fix race condition in landlock writability check (#3483) 2026-06-26 21:04:33 +03:00
native-api
ebd788d08c
Add miniforge3-26.3.2-2, 26.3.2-3 (#3481) 2026-06-25 09:52:54 +03:00
native-api
4b77d83d9d
CI: add_version enhancements (#3480)
* Default 30 seems enough for our needs
* comments on critical knowledge
* Cleaner handling of t thunk patches
* Fix an error when adding a release for which there's also a prerelease
* Workaround excepthook not working in Github Actions
* requirements.txt workaround is only needed for old Python
2026-06-25 09:48:57 +03:00
Ivan Pozdeev
933d0aaf1d 2.7.3 2026-06-24 05:14:13 +03:00
pyenv-bot[bot]
09dce106a4
Add CPython 3.15.0b3 (#3479)
Co-authored-by: native-api <2670332+native-api@users.noreply.github.com>
2026-06-24 04:27:01 +03:00
Ivan Pozdeev
b52a8e3f52 python-build scripts: Switch to jc release
They finally made a release with our fix
2026-06-19 08:36:53 +03:00
Ayush
f122a9d764
CI: add_version enhancements (#3475)
- Prevent OpenSSL from bumping across major versions
- Skip adding versions that already have pending PRs
- Copy/move patches when adding new releases in the same series
2026-06-14 21:46:48 +03:00
native-api
3323ba3ed9
README: clarify shell setup instructions using the new --install option 2026-06-12 15:34:14 +03:00
Ivan Pozdeev
b43c9e5d42 2.7.2 2026-06-10 23:16:50 +03:00
pyenv-bot[bot]
532b659ca2
Add CPython 3.13.14 (#3473)
---------

Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
2026-06-10 23:12:21 +03:00
pyenv-bot[bot]
7565df6eab
Add CPython 3.14.6 (#3472)
---------

Co-authored-by: native-api <2670332+native-api@users.noreply.github.com>
Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
2026-06-10 23:11:56 +03:00
Ivan Pozdeev
e55613a267 CI: Don't trigger push checks on a pull request 2026-06-10 22:03:22 +03:00
Ivan Pozdeev
6c0c5cfa96 Fix verify_* calls in 3.6.x
Fixes #3470
2026-06-10 21:56:41 +03:00
Anup Das
cf6f3c3200
fix(rehash): prevent terminal hang caused by stale or sandbox-blocked lock file (#3469)
* reduce stale lock TTL to 2 min, check for stale lock before acquiring and each time -- to hold up new shell sessions for as little as possible

---------

Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
2026-06-04 22:36:11 +03:00
Ivan Pozdeev
45180928d3
2.7.1 2026-06-03 09:09:54 +03:00
native-api
c12fd3ae6b
realpath.c: fix obsolete syntax warning (#3468) 2026-06-03 08:42:53 +03:00
Ayush
455d1a31db
init: add --install for shell setup (#3454) 2026-06-03 01:13:07 +03:00
pyenv-bot[bot]
efc77132f7
Add CPython 3.15.0b2 (#3467)
Co-authored-by: native-api <2670332+native-api@users.noreply.github.com>
2026-06-03 00:55:40 +03:00
native-api
c425c9ec3a
Update URLs for PyPy nightly; Remove pypy3.5 and pypy3.7 nightly (#3466)
pypy3.5-c-jit-latest and pypy3.7-c-jit-latest are no longer available
2026-06-02 13:16:51 +03:00
native-api
95ddd7d479
Support 3.9 EOL Pip URL, consolidate tests (#3465) 2026-06-02 10:29:59 +03:00
Ivan Pozdeev
29057a6c69
2.6.32 2026-05-31 06:20:35 +03:00
native-api
23eb9a9ee3
Merge pull request #3463 from native-api/3.14_openssl_4_r2
3.14.0-5: Support building against OpenSSL 4
2026-05-31 05:59:43 +03:00
Ivan Pozdeev
bfc595b0a0
CI: trigger rebuilds for <v>t, too, if a patch for <v> is changed 2026-05-30 22:00:44 +03:00
Ivan Pozdeev
034e15b810
3.14.0-5: Support building against OpenSSL 4 2026-05-30 22:00:43 +03:00
native-api
4c6d4c9be7
Add missing CPython 3.14.2t (#3464) 2026-05-30 17:58:36 +03:00
native-api
549a644688
Fix linking against a keg_only Homebrew OpenSSL when a a non-keg_only one is also installed (#3462) 2026-05-30 16:53:57 +03:00
native-api
7f1139ebe6
Add micropython 1.22.0 to 1.28.0; add downstream patches to fix compilation errors (#3460) 2026-05-30 16:36:04 +03:00
Ivan Pozdeev
874b27c749
CI: move no-response and add-version to ubuntu-slim
Supposedly lightweight tasks, we'll see
2026-05-30 16:28:31 +03:00
native-api
08a015100e
python_build: Make verify_python verify `pythonX.Y' suffix (#3459)
* Fix erroneous use in tests that didn't show until now
2026-05-30 12:47:16 +03:00
native-api
8decb512b4
Merge pull request #3458 from native-api/with_openssl_rpath
3.11.0+: Use the `--with-openssl-rpath' Configure option when possible
2026-05-30 05:46:13 +03:00
Ivan Pozdeev
84414c0121
3.11.5: Add missing patch 2026-05-30 05:38:46 +03:00
Ivan Pozdeev
9ea5bd3005
3.11.0+: Use the `--with-openssl-rpath' Configure option
The options is available since 3.10.0+ (https://github.com/python/cpython/pull/24820)
but has no effect until 3.11.0 (cpython b9e9292d75fdea621e05e39b8629e6935d282d0d)
and broken in MacOS until 3.12.2 (cpython cc13eabc7ce08accf49656e258ba500f74a1dae8),
we add downstream patches to fix that except for 3.11-dev where we disabled it
2026-05-30 05:38:32 +03:00
native-api
0a12a9cce2
Add GraalPy 25.0.3 (#3452)
* Add graalpy-25.0.3

* CI: modified_scripts_build : fix GraalPy version detection

---------

Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
2026-05-22 09:55:55 +03:00
Ivan Pozdeev
e52da606ff
CI: modified_scripts_build : fix GraalPy version detection 2026-05-22 09:48:52 +03:00
Michael Simacek
4f47143108 Add graalpy-25.0.3 2026-05-22 08:36:54 +02:00
native-api
70f096a95c
rehash: detect and remove a stale lockfile (#3450)
fixes stalling for 60s and failing if some past fault
has resulting in a stale lockfile being present

---------

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2026-05-17 09:38:23 +03:00
native-api
06fd1ce788
2.7, 3.4: force C99 standard; 2.7.14-18: force OpenSSL 1 formula (#3448)
GCC 15+ uses C23 by default
(https://www.phoronix.com/news/GCC-15-Default-C23)

fixes "error: static declaration of ‘sinpi’ follows non-static declaration"
fixes "error: cannot use keyword ‘false’ as enumeration constant"

* use OpenSSL 1.0 and 1.1 only from formulae
2026-05-14 06:41:47 +03:00
native-api
0864daa5ea
miniconda 26, CI: switch check to 3.13 (#3447) 2026-05-12 01:32:56 +03:00
native-api
522164fbd5
miniforge3 26.1, 26.3, add_miniforge: exclude .pkg installers (#3446)
According to Miniforge README, they are only meant for interactive installation
2026-05-12 01:06:24 +03:00
native-api
8c59c44902
Add miniconda3 26.3.2-2, miniforge3 26.3.2-0, 26.3.2-1 (#3445) 2026-05-11 23:47:34 +03:00
Ivan Pozdeev
c639152ac7
2.6.31 2026-05-11 01:39:26 +03:00
pyenv-bot[bot]
331ff66e2d
Add CPython 3.14.5 (#3444)
* Keep bundled OpenSSL 3
There's no support for OpenSSL 4 yet

---------

Co-authored-by: native-api <2670332+native-api@users.noreply.github.com>
Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
2026-05-11 01:36:03 +03:00
native-api
f6a5b409e9
CI: add_cpython: Support prereleases for non-initial CPython releases (#3443)
* CI: add_version: correctly handle exceptions

exit code 1 is used as a signal that no new version is found -- so have to use a different exit code for unhandled exceptions

* CI: add_version: support prereleases for non-initial releases

They unexpectedly made a prerelease 3.14.5rc1

* clarify confusing error message
2026-05-08 20:20:32 +03:00
Ivan Pozdeev
3399b2e2e5
clarify confusing error message 2026-05-08 20:10:35 +03:00
Ivan Pozdeev
5bb6b27d61
CI: add_version: support prereleases for non-initial releases
They unexpectedly made a prerelease 3.14.5rc1
2026-05-08 20:10:35 +03:00
Ivan Pozdeev
97573e156e
CI: add_version: correctly handle exceptions
exit code 1 is used as a signal that no new version is found -- so have to use a different exit code for unhandled exceptions
2026-05-08 17:48:39 +03:00
Ivan Pozdeev
40dba8256f
2.6.30 2026-05-08 17:37:31 +03:00
Ned Batchelder
e30c23eac2
Add CPython 3.16-dev, switch 3.15-dev to maintenance branch (#3442)
3.15.0b1 released means we need 3.16 support
2026-05-08 17:10:22 +03:00
Ivan Pozdeev
a7cc776274
2.6.29 2026-05-08 03:54:43 +03:00
native-api
e08497a2b7
Add CPython 3.14.5rc1 (#3441) 2026-05-08 03:53:13 +03:00
John Sirois
709f42cc08
Add CPython 3.15.0b1 (#3440) 2026-05-08 03:22:11 +03:00
Ivan Pozdeev
966819a10f
Merge branch 'master' of https://github.com/pyenv/pyenv 2026-05-06 18:19:08 +03:00
Ivan Pozdeev
a736e6af27
CI: add_version: move off the start of the hour
Due to load peak at 0 minutes, it may fail to get a runner.
Github tries to allocate a runner for ~15 minutes.
2026-05-06 18:18:58 +03:00
orbisai0security
6bdb85d8b7
CI: add-version: Add timeouts to CPython release metadata fetches (#3439)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-06 06:35:23 +03:00
Ivan Pozdeev
36f37e96ea
CI: no-response: fix 2026-05-06 01:26:56 +03:00
Ivan Pozdeev
3f62ee82b5
CI: add_version: Fix commit message 2026-05-06 01:25:17 +03:00
Ivan Pozdeev
27b4b4dc84
CI: no-response: half the frequency
getting "no runner found" errors
2026-05-06 01:24:27 +03:00
native-api
0b0335a378
Add PyPy v7.3.22 (#3438)
* Add PyPy v7.3.22

The release blog entry is here:
https://pypy.org/posts/2026/04/pypy-v7322-release.html

* CI: Don't require openssl@1.1

Missing in macos-26 Homebrew, causing an error,
no longer required for any supported Pythons

---------

Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
2026-04-30 10:43:25 +03:00
Ivan Pozdeev
b8a6e9c33c
CI: Don't require openssl@1.1
Missing in macos-26 Homebrew, causing an error,
no longer required for any supported Pythons
2026-04-30 07:01:27 +03:00
John Sirois
3966e507ba
Add PyPy v7.3.22
The release blog entry is here:
https://pypy.org/posts/2026/04/pypy-v7322-release.html
2026-04-29 19:39:23 -07:00
Ivan Pozdeev
485090e713
2.6.28 2026-04-29 08:26:10 +03:00
native-api
6481d1451d
pyenv-latest: fast path for when there is an exact match (#3437)
Avoids O(N^2) complexity when `pyenv-latest` is called in a loop
for existing entries
2026-04-24 00:34:40 +03:00
Ivan Pozdeev
dfb1a96c3e
CI: use macos-26
the Github runner is out of beta
2026-04-17 22:53:42 +03:00
Ivan Pozdeev
ae1bb9c061
CI: add_python: 3.9 is EOL 2026-04-17 22:30:54 +03:00
Ivan Pozdeev
46e4e6ab07
-dead code
[no ci]
2026-04-15 15:18:16 +03:00
Ivan Pozdeev
914ff80062
2.6.27 2026-04-08 18:26:46 +03:00
native-api
840f3ff7fd
Add miniforge3 26.1.1-2, 26.1.1-3 (#3433) 2026-04-08 18:24:54 +03:00
pyenv-bot[bot]
bfec0e43f5
Add CPython 3.13.13, 3.14.4, 3.15.0a8 (#3432)
Co-authored-by: native-api <2670332+native-api@users.noreply.github.com>
2026-04-08 18:08:59 +03:00
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
Ivan Pozdeev
6d8c0e4021
2.6.21 2026-02-03 23:46:41 +03:00
github-actions[bot]
fbc7067e3f
Add CPython 3.14.3 (#3400) 2026-02-03 23:44:14 +03:00
Ivan Pozdeev
82f4de5593
CI: reflect GraalPy 25.0.2 dropping MacOS x64 support 2026-01-20 18:52:39 +03:00
Michael Šimáček
968cd11daa
Add GraalPy 25.0.2 (#3395) 2026-01-20 18:12:44 +03:00
Ivan Pozdeev
5447f1f859
CI: add_script: make more frequent
practice shows a long enough delay that contributors step in
2026-01-15 16:09:57 +03:00
Ivan Pozdeev
3441980e83
2.6.20 2026-01-15 07:05:06 +03:00
Ned Batchelder
bd2f32dd7d
Add CPython 3.15.0a5 (#3393) 2026-01-15 07:00:46 +03:00
native-api
94faa168cb
CI: adjust CPython PR generation logic (#3392)
* For files retrieved through the GNU mirror load balancer, specify the load balancer URL
* Explicitly `git mv` files on prerelease upgrade in case Git doesn't detect it
* Add a trailing newline to a thunk
2026-01-14 07:03:58 +03:00
Ivan Pozdeev
92c9ab5273
2.6.19 2026-01-14 04:11:02 +03:00
Ned Batchelder
37bf92af84
Add CPython 3.15.0a4 (#3390) 2026-01-14 04:00:41 +03:00
Ivan Pozdeev
05ba9388a7
Fix schedule 2026-01-11 23:45:25 +03:00
Ivan Pozdeev
c62be31e8c
2.6.18 2026-01-10 06:16:21 +03:00
Ivan Pozdeev
c8129ceee6
fix schedule syntax 2026-01-09 12:04:52 +03:00
native-api
d9182d6edc
CI: automatically check for CPython releases (#3388)
* .gitignore local venv
* Add alt GNU mirror support with <table>
* Fix UnboundLocalError when no micro 0 releases
* Cutoff for existing vetsions as well
* add missing dependency more_itertools
* workaround fake_useragent 2.0.0 falsely declaring 3.8 compatibility
2026-01-09 09:52:09 +03:00
native-api
4cf95be5ee
Merge pull request #3387 from native-api/anaconda-2025.12-1
Add anaconda-2025.12-1
2026-01-08 14:09:29 +03:00
Ivan Pozdeev
8c50260ba2
Anaconda 2025.12 dropped MacOS x64 support 2026-01-08 14:00:56 +03:00
Ivan Pozdeev
f614e5caa5
Fix hang in Ubuntu build for Anaconda-2025.12 2026-01-08 14:00:55 +03:00
native-api
3c539aa0bc
Merge pull request #3386 from native-api/miniconda-25-accept-tos
Auto-accept TOS for miniconda3-25+
2026-01-08 13:07:40 +03:00
Ivan Pozdeev
935e1a68cd
Add anaconda3-2025.12-1 2026-01-08 11:22:55 +03:00
Ivan Pozdeev
98a7a6809c
Fix verify_py prefix in anaconda3-2025.06 2026-01-08 11:20:20 +03:00
Ivan Pozdeev
45ef1677c4
Auto-accept TOS in miniconda3-25+
Required for installation since this version
2026-01-08 11:20:20 +03:00
binbjz
c35f26af3e
CI: exclude unsupported MacOS-x64 for recent Miniconda versions (#3385)
* split macOS Intel build and filter unsupported Miniconda

* Generate exclusions instead

---------

Co-authored-by: binbjz <binbjz@gmail.com>
Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
2026-01-08 09:08:08 +03:00
binbjz
967ed2c367
Add miniconda3-25.11.1-1 (#3382)
Co-authored-by: binbjz <binbjz@gmail.com>
2026-01-08 00:27:49 +03:00
Ivan Pozdeev
1d8240a641 set executable bit for add_cpython.py 2026-01-07 22:53:57 +03:00
Ivan Pozdeev
e5a6b49e02
scripts: remove unused 2026-01-07 07:32:00 +03:00
Ivan Pozdeev
4a3aaf4327
scripts: relax version requirements
Latest version are okay.
Freezing them causes Dependabot alerts
about vulnerabilities in old versions
2026-01-03 13:32:53 +03:00
native-api
2c27f44612
Merge pull request #3358 from native-api/cpython_generate
CI: add a script to autogenerate CPython build scripts
2025-12-27 08:20:00 +03:00
Ivan Pozdeev
ff94d498db
(refactor) 2025-12-27 08:18:41 +03:00
Ivan Pozdeev
99faf7f217
Add a script to generate CPython installation scripts
[no ci]
2025-12-27 08:18:41 +03:00
native-api
bf37e78693
Merge pull request #3379 from native-api/make_j_argument
Recognize an argument to -j in MAKEFLAGS when building extensions in 3.10-3.11 and latest 3.5-3.9
2025-12-27 06:23:19 +03:00
Ivan Pozdeev
956f78df42
Recognize an argument to -j in MAKEFLAGS when building extensions in 3.10-3.11 and latest 3.5-3.9
Upstream issue fixed in 3.12 (https://github.com/python/cpython/issues/87800)
2025-12-27 02:56:23 +03:00
Ivan Pozdeev
56bc05d5d6
python-build: Use no-tests only for OpenSSL 1.1.1+
Introduced in 1.1.1-pre1
2025-12-27 02:56:15 +03:00
Ivan Pozdeev
8ef33165b8
CI: fix CPython-only checks 2025-12-27 02:56:14 +03:00
native-api
48743aa8f3
README: Document how to change Python version in a shell spawned from a Python-based program (e.g. Jupyter) (#3380) 2025-12-26 17:19:10 +03:00
rockandska
2c38423a98
pyenv launcher: introduce and export _PYENV_INSTALL_PREFIX (#3334)
provides a reliable way for Pyenv code to locate other parts of Pyenv code that are not under `PYENV_ROOT`

* tests: Work with Git entirely in a test repo

Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
2025-12-24 10:00:09 +03:00
native-api
aa6c9b9694
init: don't silence automatic rehash; rehash: report final error but not provisional ones (#3377) 2025-12-21 07:21:30 +03:00
native-api
a944da76c0
rehash: support BSD mktemp (#3376)
macOS 12 `mktemp' doesn't support `-p`
2025-12-21 06:38:46 +03:00
Florian Blanchet
aeea3ac825
Add PowerShell support (#2749)
Co-authored-by: Ivan Pozdeev <ivan_pozdeev@mail.ru>
Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
2025-12-21 05:33:19 +03:00
Ivan Pozdeev
7998159daa
tests: fix integration tests for Bash and Fish 2025-12-21 02:11:02 +03:00
native-api
5855d9dfca
Merge pull request #3372 from native-api/ci_update_cleanup
CI: Update and cleanup workflow scripts
2025-12-20 19:37:04 +03:00
native-api
22993a239e
Merge pull request #3375 from native-api/fix_inf_loop_shim_different_location
Fix an infinite loop if a shim is symlinked to and called from a different location
2025-12-20 11:24:41 +03:00
Ivan Pozdeev
6113214f65
tests: refactor: migrate to newly-added create_stub() 2025-12-20 11:05:27 +03:00
Ivan Pozdeev
7418835908
Prevent infinite loop if a shim is linked and called from a nonstandard location with "system" active 2025-12-20 11:05:27 +03:00
Ivan Pozdeev
b259813357
tests: refactor: rename and consolidate create_executable() functions 2025-12-20 08:34:20 +03:00
Ivan Pozdeev
22b192913e
2.6.17 2025-12-16 23:30:42 +03:00
Edgar Ramírez Mondragón
b50afe69a8
Add CPython 3.15.0a3 (#3374)
Signed-off-by: Edgar Ramírez-Mondragón <edgarrm358@gmail.com>
2025-12-16 23:28:46 +03:00
native-api
91931a4dd9
miniconda3-latest: auto accept TOS (#3373)
Since 14.07.2025, Anaconda requires accepting the new TOS upon installation
that limit eligibility for free use
2025-12-14 22:48:46 +03:00
Ivan Pozdeev
dabaa901e9
CI: - Ubuntu 18.04 workaround 2025-12-13 18:07:37 +03:00
Ivan Pozdeev
4b33cb68b6
CI: - Micropython-specific code from CPython-only branches 2025-12-13 18:04:15 +03:00
Ivan Pozdeev
9b85239875
CI: - commented-out code 2025-12-13 17:52:53 +03:00
Ivan Pozdeev
f19fe0f2be
CI: tests: + macos-15 2025-12-13 17:51:51 +03:00
Ivan Pozdeev
293798582a
CI: build: - EOL 3.9, + 3.13 2025-12-13 17:51:26 +03:00
Ivan Pozdeev
4b36ddf5c6
Merge branch 'master' of https://github.com/pyenv/pyenv 2025-12-13 17:26:59 +03:00
Ivan Pozdeev
4e7626721a
Delete the old issue template
[no ci]
2025-12-13 17:22:12 +03:00
native-api
3b25462407
Merge pull request #3371 from 13steinj/new-miniforge-miniconda-versions
Adds latest miniforge releases 25.9.1-0, 25.11.0-1
2025-12-09 22:25:34 +03:00
Jonathan Stein
70294ef6f1 Add miniforge3 25.9.1-0, 25.11.0-1
Adds latest miniforge releases 25.9.1-0, 25.11.0-1.

Skips 25.11.0-0 due to a regression reported in the release notes of
miniforge3-25.11.0-1.

Ref: https://github.com/conda-forge/miniforge/releases/tag/25.11.0-1
2025-12-09 12:27:18 -06:00
Jonathan Stein
bdb0508220 Update requirements for the add_miniconda script
At least under Python 3.14, this quickly fails without lxml[html_clean]
installed explicitly.
2025-12-09 12:18:23 -06:00
Ivan Pozdeev
e805257c1f
2.6.16 2025-12-06 00:58:03 +03:00
César Román
6cbce8616e
Add CPython 3.13.11, 3.14.2 (#3370) 2025-12-06 00:56:17 +03:00
Ivan Pozdeev
a6ea5b3179 Fix rehash 2025-12-05 20:57:07 +03:00
native-api
0f7b8fa8ee
sh-rehash: Fix erroneously executing rather than printing a command (#3369) 2025-12-05 20:42:25 +03:00
binbjz
59204a6c89
Add Miniconda3-25.9.1-3 (#3368)
Co-authored-by: binbjz <binbjz@gmail.com>
2025-12-05 17:26:32 +03:00
native-api
6f0e2d3458
rehash: Fix hanging for 60 seconds when shims directory is not writable due to Linux Landlock (#3367) 2025-12-05 16:19:17 +03:00
Ivan Pozdeev
61d869f67e
2.6.15 2025-12-03 03:23:17 +03:00
John Sirois
a63e48cf75
Add CPython 3.13.10. (#3364) 2025-12-03 03:21:46 +03:00
Ivan Pozdeev
d1ae7fd65d
2.6.14 2025-12-02 21:00:00 +03:00
Ned Batchelder
b230a338df
Add CPython 3.14.1 (#3363) 2025-12-02 20:52:30 +03:00
native-api
94e4bf0ae8
Fix "ld: symbol(s) not found" for some C system calls in MacOS if XCode is for a newer major MacOS version (#3362)
Citing https://www.postgrespro.ru/list/id/E1kfzRR-0001EH-Ph@gemulon.postgresql.org
fixing the same problem:
We previously put the -isysroot switch only into CPPFLAGS, theorizing
that it was only needed to find the right copies of include files.
However, it seems that we also need to use it while linking programs,
to find the right stub ".tbd" files for libraries.  We got away
without that up to now, but apparently that was mostly luck.  It may
also be that failures are only observed when the Xcode version is
noticeably out of sync with the host macOS version; the case that's
prompting action right now is that builds fail when using latest Xcode
(12.2) on macOS Catalina, even though it's fine on Big Sur.

Specifically, the problem arises for `preadv' and `pwritev' (new in MacOS 11 Big Sur) when building with XCode 12.4 (supporting Big Sur) in MacOS 10.15 Catalina.
2025-12-01 22:01:15 +03:00
dependabot[bot]
a30c26ddf5
Bump actions/checkout from 5 to 6 in the github-actions group (#3360)
Bumps the github-actions group with 1 update: [actions/checkout](https://github.com/actions/checkout).


Updates `actions/checkout` from 5 to 6
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  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>
2025-12-01 15:59:31 +03:00
Ivan Pozdeev
fdde91269b
2.6.13 2025-11-19 14:30:40 +03:00
Ned Batchelder
fa741b861a
Add CPython 3.15.0a2 (#3359) 2025-11-19 14:28:31 +03:00
binbjz
2afd1733a4
Add Miniconda3-25.9.1-1 (#3357) 2025-11-08 14:35:44 +03:00
Edgar Ramírez Mondragón
032022dace
Replace macos-13 with macos-15-intel (#3356)
> The macOS 13 Ventura based runner images will begin deprecation on September 22nd and will be fully unsupported by December 4th for GitHub and ADO.

https://github.com/actions/runner-images/issues/13046

Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
2025-11-05 22:10:29 +03:00
Ivan Pozdeev
c6ea700cdf 2.6.12 2025-10-31 23:27:18 +03:00
Ned Batchelder
97fd8f436d
Add CPython 3.9.25 (#3355) 2025-10-31 23:24:35 +03:00
Michael Šimáček
1b7d2f08fd
Add graalpy-25.0.1 (#3350) 2025-10-22 02:28:06 +03:00
Ivan Pozdeev
74fea7edc6 Fix leftover commented-out test code 2025-10-15 15:00:43 +03:00
Ivan Pozdeev
94071a9374 2.6.11 2025-10-15 14:40:44 +03:00
Edgar Ramírez Mondragón
7661437864
Add CPython 3.15.0a1 (#3347) 2025-10-15 14:38:53 +03:00
native-api
ea3a9fe895
Merge pull request #3346 from nedbat/nedbat/3.13.9 2025-10-15 14:08:11 +03:00
Ivan Pozdeev
c1c8646d75 Fix Readline 8.3 URLs
https://www.gnu.org/server/mirror.html advises
to use http://ftpmirror.gnu.org/
for automatic mirror selection
2025-10-15 13:10:13 +03:00
Ned Batchelder
fc28287273 Add CPython 3.13.9 2025-10-14 16:18:13 -04:00
native-api
8d3bba2f92
Support building against Homebrew Tcl/Tk 9 (#3343)
Use tclConfig.sh/tkConfig.sh for future-proofing
3.14.0 doesn't detect Tcl/Tk with external libtommath, have to do it ourselves
2025-10-11 00:19:06 +03:00
Ivan Pozdeev
a419b003b4 2.6.10 2025-10-10 04:14:38 +03:00
Ned Batchelder
1c05252dfc
Add CPython 3.12.12, 3.11.14, 3.10.19, 3.9.24 (#3344) 2025-10-10 04:12:44 +03:00
Ivan Pozdeev
8087e811cd 2.6.9 2025-10-07 22:33:22 +03:00
John Sirois
faddc0d3fe
Add CPython 3.13.8 (#3341) 2025-10-07 22:28:30 +03:00
James
ce9d396ccc
Add CPython 3.14.0 (#3339)
---------

Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
2025-10-07 22:26:47 +03:00
native-api
ba968fda2d
CI: Fix output variable for CPython-specific workflows (#3340) 2025-10-07 21:31:45 +03:00
tuzi3040
8e34326347
CI: modified-scripts-build: fix CPython-specific jobs never firing (#3338) 2025-10-07 21:00:59 +03:00
Ivan Pozdeev
519ce9dbf0 2.6.8 2025-09-19 07:14:28 +03:00
native-api
3e51bae343
Merge pull request #3327 from native-api/use_pkgconfig_3.12plus
Use TCLTK_* and pkg-config for 3.11+ linking with Homebrew Tcl/Tk; add PYTHON_BUILD_TCLTK_FORMULA envvar
2025-09-19 07:11:26 +03:00
Ivan Pozdeev
ca551b3a55 Add PYTHON_BUILD_TCLTK_FORMULA to allow building against Tcl/Tk 9
Tcl/Tk 9.0 support was added in 3.13.0b3 and is not official as of 3.14.0;
the build with Homebrew version fails as of this writing
2025-09-19 06:20:41 +03:00
Ivan Pozdeev
bbe6301f01 Use TCLTK_* and pkg-config for 3.11+ instead of --with-tcl-* and pkg-config
Fixes warnings "configure: WARNING: unrecognized options: --with-tcltk-libs, --with-tcltk-includes"

fix script
2025-09-19 06:20:41 +03:00
Ivan Pozdeev
8c3b705f04 CI: modified-scripts-build: print config.log on build failure 2025-09-19 01:26:06 +03:00
native-api
90b1c28fa6
Merge pull request #3333 from nedbat/nedbat/314rc3
Add CPython 3.14.0rc3
2025-09-18 19:17:29 +03:00
Ivan Pozdeev
0052372fa3 Explicitly include Homebrew at /usr/local/include if passing -isysroot
Apple CLang excludes it if -isysroot is passed
2025-09-18 19:02:46 +03:00
Ned Batchelder
1068875cc6 Add CPython 3.14.0rc3 2025-09-18 08:15:02 -04:00
rockandska
22a7c46d54
upgrade pip detetcion in pip-rehash to accept multiple variations: (#3330)
- pip
- pipX
- pipX.Y
- * -m pip

Co-authored-by: Christian Fredrik Johnsen <christian@johnsen.no>
2025-09-17 03:53:37 +03:00
Michael Šimáček
7881c26b5a
Add GraalPy 25.0 (#3331) 2025-09-16 17:57:02 +03:00
native-api
4033a0a260
Merge pull request #3324 from rockandska/bats_in_docker
Bats test suite in docker
2025-09-15 22:37:01 +03:00
rockandska
dee36c348d add test README 2025-09-15 20:16:31 +02:00
rockandska
d275391f65 add possibility to filter tests with make 2025-09-15 20:16:18 +02:00
rockandska
a7897ca0f6 add bats test under docker 2025-09-15 20:16:11 +02:00
rockandska
92a28e531b use BATS_FILE_TMPDIR in test/plugin test
use global setup with bats with possibility to add specific test file _setup
use readlink in helper if realpath is not working as expected
2025-09-15 19:48:34 +02:00
rockandska
8990110dcf upgrade bats to v1.10.0
fix bats warnings
2025-09-15 16:45:02 +02:00
rockandska
68edd564cf update parent shell detection in pyenv-init to be more portable 2025-09-15 15:00:18 +02:00
rockandska
0d987b0e4b fix test isolation
Make sur that PYENV_TEST_DIR is created if mktemp failed
mock python3 usage by updating create_executable function
fix test by adding the right PATH
update path in plugin test
replace for loop with while read
don't use symlink for stub
2025-09-15 15:00:14 +02:00
Ivan Pozdeev
857806e6ca Apple Silicon is now supported by Github 2025-09-14 23:25:49 +03:00
Ivan Pozdeev
85561398ea -unused Dockerfile 2025-09-14 22:21:31 +03:00
native-api
17fb66cd8b
Support curl from a snap (#3329) 2025-09-14 07:23:41 +03:00
native-api
2ecd676a2a
Add miniconda 25.7.0-2 (#3323) 2025-09-08 21:47:20 +03:00
rockandska
b57bdef584
Fix rehash hook for pipx/pipx.x/pipx.xx (#3320) 2025-09-04 18:56:53 +03:00
dependabot[bot]
cd78412b80
Bump actions/checkout from 4 to 5 in the github-actions group (#3318)
Bumps the github-actions group with 1 update: [actions/checkout](https://github.com/actions/checkout).


Updates `actions/checkout` from 4 to 5
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  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>
2025-09-01 13:33:28 +03:00
native-api
692ac77559
Fix specifying XCode SDK for distutils; Revert to preferring XCode Zlib (#3316)
* Fix specifying XCode SDK for distutils

* Revert to preferring XCode Zlib

It turns out, everything since 2.7.12 and 3.5.2
can use libs from modern XCode SDK
which is always available unless we're using an alternate compiler
2025-09-01 01:09:57 +03:00
native-api
97eda4403f
Fix Readline and OpenSSL detection for MacPorts without the corresponding package (#3317) 2025-08-31 21:48:24 +03:00
native-api
ab1331d3c0
Merge pull request #3311 from native-api/fiz_zlib_homebrew
Prefer ZLib from Homebrew/MacPorts if present; Fix using Zlib from Homebrew
2025-08-28 10:54:50 +03:00
Ivan Pozdeev
7d3854b64d CI: use ZLib from XCode SDK
Everything since 3.5.2 (see #3301) can use it;
it's now present in all non-EOL MacOS XCode versions
2025-08-28 10:49:32 +03:00
Ivan Pozdeev
11c1898abb Fix using Zlib from Homebrew 2025-08-28 09:52:24 +03:00
Ivan Pozdeev
25e5989261 Prefer ZLib from Homebrew/MacPorts if present
Zlib from XCode is virtually always present now so it only makes sense to use it from elsewhere if it's preferred.
Works around build failure for 2.7 that's incapable of using Zlib from XCode 7+ (see #3301)
2025-08-28 09:36:13 +03:00
Ivan Pozdeev
cd2f410f75 Clean up, skip looking for mambaforge after it's retired 2025-08-23 21:53:51 +03:00
native-api
89b8e5f8da
Add miniforge 25.3.0-1, 25.3.0-2, 25.3.0-3, 25.3.1-0, skip miniforge 25.3.0-0 (#3306)
miniforge-25.3.0-0 is marked as prerelease, there's no Linux version. Probably recalled.
2025-08-23 19:40:17 +03:00
Jared Stever
71a8d47b81
Use Zlib from XCode SDK in a way compatible with XCode 16 and CLT (#3301)
* use `xcrun` instead of `xcodebuild` which is absent in CLT
* use an alternative way that's compatible with CPython's setup.py since 3.5.2

---------

Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
2025-08-16 20:17:53 +03:00
Ivan Pozdeev
bc44cb8fc0 CI: run modified scripts in MacOS 15, too
It turns out, macos-14 has XCode 15 rather than 16 as advertised in Github docs
2025-08-16 20:04:40 +03:00
Ivan Pozdeev
3dbdfdf39a 2.6.7 2025-08-15 21:49:48 +03:00
Ned Batchelder
43da49d6df
Add CPython 3.14.0rc2 and 3.13.7 (#3303) 2025-08-15 21:13:33 +03:00
native-api
10675af5a6
Don't fail the build if xcodebuild fails (#3302) 2025-08-14 22:40:54 +03:00
native-api
685f281526
Skip Zlib from XCode for XCode 16+ (#3298)
It breaks the build due to yet unknown structural changes from XCode 15
2025-08-08 23:05:49 +03:00
Ivan Pozdeev
d56241330c 2.6.6 2025-08-07 23:17:54 +03:00
César Román
73b7420b3d
Add CPython 3.13.6 (#3297) 2025-08-07 23:15:37 +03:00
native-api
bd9d13b9fe
Add anaconda3-2025.06-0, anaconda3-2025.06-1, miniconda3-25.3.1-1, miniconda3-25.5.1-0, miniconda3-25.5.1-1 (#3295) 2025-08-03 09:29:54 +03:00
Ivan Pozdeev
05cc41d273 CI: change macos_build to -latest 2025-08-03 09:29:21 +03:00
Ivan Pozdeev
df84c42653 2.6.5 2025-07-23 21:20:39 +03:00
Ivan Pozdeev
23fe500a33 Push version in Python-Build as well 2025-07-23 21:20:29 +03:00
Michael Šimáček
609daca27c
Add GraalPy 24.2.2 (#3291) 2025-07-23 21:17:19 +03:00
Ned Batchelder
40f46083db
Add CPython 3.14.0rc1 (#3293) 2025-07-23 21:11:40 +03:00
native-api
418a61b7b8
Update README.md
Explicitly specify how to use the Zsh shell snippet
It turns out to be unclear to some users
2025-07-19 18:34:11 +03:00
César Román
16508177fb
Add Jython 2.7.4 (#3290) 2025-07-17 21:40:12 +03:00
Edgar Ramírez Mondragón
945f4b216d
Bump OpenSSL to 3.5.1 in the latest releases and branch tips in CPython 3.12 - 3.15 (#3287) 2025-07-10 19:49:03 +03:00
Ivan Pozdeev
0c680e8ede 2.6.4 2025-07-08 21:12:30 +03:00
Edgar Ramírez Mondragón
20296fc53a
Add CPython 3.14.0b4 (#3285)
* Bump CPython 3.14 OpenSSL to 3.4.2
2025-07-08 21:10:52 +03:00
native-api
7725fe2cf2
Install feature request templates
[no ci]
2025-07-06 23:46:48 +03:00
native-api
d8384fcc05
Install issue templates
It looks like Github have dropped support for https://github.com/pyenv/pyenv/edit/master/.github/ISSUE_TEMPLATE.md entirely.
2025-07-06 23:29:49 +03:00
John Sirois
e150257413
Add PyPy v7.3.20 (#3284)
The release blog entry is here:
  https://pypy.org/posts/2025/07/pypy-v7320-release.html
2025-07-06 09:22:51 +03:00
native-api
798d21e0ca
(regression) Use Zlib from XCode SDK in MacOS without Homebrew or Macports (#3282) 2025-06-29 19:51:25 +03:00
native-api
9114929e4f
Backport bpo_36106 to 3.5.10 and 3.6.15 (#3280)
Fixes "error: static declaration of ‘sinpi’ follows non-static declaration"
with newer libm
2025-06-22 14:22:17 +03:00
Ivan Pozdeev
f1c5371752 2.6.3 2025-06-18 22:05:08 +03:00
Ned Batchelder
907cd78f35
Add CPython 3.14.0b3 (#3278)
* remove the need for explicit versions in the python-build free-threading files
2025-06-18 22:02:01 +03:00
Danny Kim
e13b5848be
Support linking to MacPorts ports installed from binary archives (#3272) 2025-06-14 09:38:35 +03:00
native-api
bf19366669
Re-promote "Python versions with extended support" to a section (#3276)
It's a valuable asset of Pyenv and https://github.com/pyenv/pyenv/issues/3275 showed it has stoppped being discoverable

[no ci]
2025-06-13 22:19:06 +03:00
Ivan Pozdeev
a71a378dac 2.6.2 2025-06-12 13:19:45 +03:00
Ned Batchelder
807a4e0cac
Add CPython 3.13.5 (#3269) 2025-06-12 12:47:09 +03:00
Ivan Pozdeev
b9ede4ae0e 2.6.1 2025-06-04 20:22:49 +03:00
Ned Batchelder
0e05ee8694
Add CPython 3.9.23, 3.10.18, 3.11.13, 3.12.11, 3.13.4 (#3266) 2025-06-04 09:15:55 +03:00
Ivan Pozdeev
bfbe76e6a9 2.6.0 2025-05-26 22:59:51 +03:00
Ned Batchelder
d88de11543
Add CPython 3.14.0b2 (#3259) 2025-05-26 22:15:12 +03:00
Pedro Fonini
70b973fdd4
Fix python-build's has_broken_mac_readline when Readline is explicitly configured (#3254) 2025-05-22 07:58:25 +03:00
Alexander Studnitskiy
f24ff8d152
Add MacPorts support for python-build (#3186)
Did not implement customizable priority due to unclear use feedback and more compilation in the code, can decide and do that separately

Tcl/Tk from MacPorts support is omitted due to CPython's only being compatible with 
Tcl/Tk 9 since 3.12.5 and 3.13.0.

Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
2025-05-18 18:24:38 +03:00
Ivan Pozdeev
5e82f5cf81 Merge branch 'master' of https://github.com/pyenv/pyenv 2025-05-18 12:27:06 +03:00
Ivan Pozdeev
6c86ae4175 README: fix erroneous extra indents in code blocks 2025-05-18 12:26:50 +03:00
Jordan Stewart
da3fcb7eb7
README: Add shell setup instructions for nushell (#2916) 2025-05-18 12:20:30 +03:00
Jesse Wattenbarger
018ca73444
Add --bare option to pyenv version (#2783) 2025-05-17 18:23:25 +03:00
Tom Godkin
90fa430eca
README: make fish PATH add conditional on the directory existing (#2786) 2025-05-17 16:13:12 +03:00
native-api
2d8bd15ccd
Add CODEOWNERS file (#3247)
to get notifications of pull requests ready for review

[no ci]
2025-05-17 15:38:33 +03:00
native-api
9656bcf0b9
python-build: Support patch paths with spaces/special characters (#3251)
This is now possible because all non-EOL MacOS versions now support
`find -print0`/`sort -z`/`xargs -0`
2025-05-17 08:58:06 +03:00
Ivan Pozdeev
f216b4bfb1 2.5.7 2025-05-09 00:52:54 +03:00
Edgar Ramírez Mondragón
54fd0106f8
Point 3.14-dev to 3.14 branch (#3246) 2025-05-09 00:51:24 +03:00
Ivan Pozdeev
6fff3d29d4 2.5.6 2025-05-08 17:12:28 +03:00
native-api
b70fb9c07b
Merge pull request #3245 from edgarrmondragon/cpython-3.14.0b1-3.15-dev
Add CPython 3.14.0b1 and 3.15-dev
2025-05-08 17:06:01 +03:00
Edgar Ramírez-Mondragón
f4b94c14a6
Add CPython 3.15-dev 2025-05-07 13:53:53 -06:00
Edgar Ramírez-Mondragón
e95941c9fe
Add CPython 3.14.0b1 2025-05-07 13:26:50 -06:00
native-api
bc7b6cb6b5
Cache uname and sw_vers output (#3244)
Mainly for tests, to avoid having to adjust call counts for stubs when the logic changes
2025-05-06 19:17:36 +03:00
David Lawson
ee40ad2253
Fix get-pip URLs for 3.7, 3.8 and Pyston (#3242)
Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
2025-04-29 20:58:49 +03:00
Michael Šimáček
323af282db
Add GraalPy 24.2.1 (#3238) 2025-04-16 21:08:46 +03:00
Ivan Pozdeev
97993fcc26 2.5.5 2025-04-09 23:00:35 +03:00
native-api
323bd16fbf
Add CPython 3.9.22, 3.10.17, 3.11.12, 3.12.10, 3.13.3, 3.14.0a7 (#3233)
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
2025-04-09 21:56:48 +03:00
native-api
67f474d3e3
Add miniforge3-24.11.3-1, miniforge3-24.11.3-2, miniforge3-25.1.1 (#3224) 2025-03-28 00:03:17 +03:00
native-api
004f6706a1
Switch 3.9+ to OpenSSL 3 (#3223) 2025-03-27 23:35:50 +03:00
Michael Šimáček
c579b63696
Add graalpy 24.2 (#3215) 2025-03-18 19:18:33 +03:00
Ivan Pozdeev
abf1376487 2.5.4 2025-03-15 02:06:16 +03:00
Ned Batchelder
44172d69f2
Add CPython 3.14.0a6 (#3213) 2025-03-14 20:26:03 +03:00
John Sirois
2f4bdcdb43
Add PyPy v7.3.19. (#3205)
The release blog entry is here:
  https://pypy.org/posts/2025/02/pypy-v7319-release.html
2025-02-28 22:05:57 +03:00
binbjz
47eef10ce1
Add anaconda3-2025.1.1-2 (#3198)
Co-authored-by: binbjz <binbjz@gmail.com>
2025-02-14 09:48:24 +03:00
Ivan Pozdeev
5051a42b2c 2.5.3 2025-02-13 09:17:25 +03:00
native-api
1c2a7658f0
Merge pull request #3151 from ChristianFredrikJohnsen/fix/conda-rehash
Do not execute conda-specific code if conda is not installed
2025-02-13 08:48:57 +03:00
Christian Fredrik Johnsen
8e5379ebe3 perf: faster execution of build_conda_exclusion_list
1) Got rid of useless call to `cat`, much better to simply use sed with
   file as argument.

2) Got rid of `sort -u`. There is no need to sort the list.
   Additionally, the list `pyenv.d/rehash/conda.d/default.list` only has
   unique entries, and even if you have duplicate entries, the function
   will still work. --> No need for sort nor unique.

3) Further improvement is simple, save a cached
cleaned-list-v1.0 in `conda.d` and simple read from that file instead of
doing `sed`, which must be a more expensive operation than simply
reading from file.
2025-02-13 08:31:48 +03:00
Christian Fredrik Johnsen
ab2a5ad030 style: place greadlink in coreutils section
Applies to the conda blacklist in `pyenv.d/rehash/conda.d/default.list`
No practical difference, but it looks misplaced when it sits at the end
of the file.
2025-02-13 08:31:48 +03:00
Christian Fredrik Johnsen
09fbed1d4f fix: pyenv-rehash | do NOT create conda_exclusion_list if conda is not installed.
I was doing some debugging with PYENV_DEBUG=1 and noticed that a lot of
work was being done in conda.bash, even though I had not installed any
conda versions like `mambaforge`.

The solution is pretty simple, put all the code inside an if-block.
This aligns with what @varikin found in his pull request #3037

Additionally, I have refactored the code slightly for readability
(created function `build_conda_exclusion_list`), and added comments
which should make it easier to understand what's going on.

This commit simplifies debugging and should reduce the execution time of

```bash
eval "$(pyenv init -)"
```

slightly.
2025-02-13 08:31:48 +03:00
John Sirois
496dcfc384
Update hashes for Python 3.14.0a5 tarballs (#3196)
Source tarballs were changed to fix a human error: https://discuss.python.org/t/python-3-14-0-alpha-5/80364/3
2025-02-13 07:56:34 +03:00
binbjz
a7de2004eb
Add Miniconda3 25.1.1-1 (#3192)
Co-authored-by: binbjz <zhaobin@avenir.hk>
Co-authored-by: binbjz <binbjz@gmail.com>
2025-02-12 23:03:05 +03:00
Edgar Ramírez Mondragón
f37a5a80d3
Add CPython 3.14.0a5 (#3194) 2025-02-12 23:02:24 +03:00
Ivan Pozdeev
ddeb3facf0 CI: remove ubuntu-20.04; move tar_gz to -latest
ubuntu-20.04 is being retired by Github
tar_gz is mainly to verify URLs, OS version doesn't matter
2025-02-12 22:53:37 +03:00
native-api
519f90a67a
Add miniforge3-25.1.1-0, miniforge3-24.11.3-0 (#3191) 2025-02-12 21:49:27 +03:00
binbjz
fee6057680
Add Miniconda3 25.1.1 0 (#3190)
* Add miniconda3-25.1.1-0

Co-authored-by: binbjz <zhaobin@avenir.hk>
Co-authored-by: binbjz <binbjz@gmail.com>
2025-02-10 21:41:22 +03:00
dand-oss
1c7fe36c55
Add PyPy v7.3.18 (#3184)
Co-authored-by: Dan Dees <dand@appsmiths.com>
2025-02-08 04:46:04 +03:00
Ivan Pozdeev
d327702c4d Fix OpenSSL 1.x version parsing 2025-02-05 20:57:20 +03:00
Ivan Pozdeev
b3dad5887e 2.5.2 2025-02-05 19:54:06 +03:00
Edgar Ramírez Mondragón
8775ffe76c
Add CPython 3.12.9 and 3.13.2 (#3183) 2025-02-05 19:52:09 +03:00
Michael Šimáček
823dd3cef9
Add GraalPy 24.1.2 (#3176) 2025-02-02 18:57:19 +03:00
threadflow
8d93ccae39
Fix OpenSSL version parsing in python-build script (#3181) 2025-02-02 04:50:48 +03:00
Ivan Pozdeev
734d6323d8 2.5.1 2025-01-19 17:47:51 +03:00
Ned Batchelder
c9514d8e8e
Add CPython 3.14.0a4 (#3168) 2025-01-19 16:22:10 +03:00
native-api
e98a0b489f
Fix "Unsupported options" error building bundled OpenSSL <3.2.0 (#3164) 2025-01-09 02:16:06 +03:00
native-api
0173299078
Add miniforge3-24.11.2-0, miniforge3-24.11.2-1 (#3163) 2025-01-08 23:51:11 +03:00
Jay Bazuzi
850a74c5cd
README: Add recommended curl arguments to suggested installer invocation (#3155) 2025-01-04 19:43:09 +03:00
Christian Fredrik Johnsen
4c6b0e9c3b
Fix: mistake in configuration hints in pyenv init and manpage. (#3145) 2024-12-23 20:58:54 +03:00
native-api
330e3fc130
CI: use Ubuntu 24.04; use ubuntu-latest for the ubuntu_build check (#3144)
Now that ubuntu-24 is out of beta at Github

Since for ubuntu_build, we only use one OS version
and the changes between versions are not as drastic as with MacOS,
it seems safe to have it upgrade automatically.
2024-12-22 23:38:58 +03:00
Ivan Pozdeev
2aff0df76d 2.5.0 2024-12-22 23:22:20 +03:00
native-api
2acb2296e5
Exclude broken miniforge3/mambaforge3 22.11.0-0, 22.11.0-1, 22.11.0-2 from generation [no ci] (#3143) 2024-12-22 23:10:42 +03:00
native-api
04b440df0b
Add miniforge3 and mambaforge3 24.1.2-0, 24.3.0-0, 24.5.0-0, 24.7.1-0, 24.7.1-1, 24.7.1-2, 24.9.0-0, 24.9.2-0, 24.11.0-0, 24.11.0-1 (#3142) 2024-12-22 23:06:33 +03:00
native-api
5d80be09cb
CI: only run macos_build_bundled_dependencies and ubuntu_build_tar_gz for CPython (#3141)
Only CPython scripts use bundled dependencies for MacOS and two alternative tarballs
2024-12-22 22:19:24 +03:00
Ivan Pozdeev
e0504fc2f8 add_miniforge.py: Support different Python version lines, improvements
* report more progress
* don't download SHA files for unsupported architectures
2024-12-22 21:31:28 +03:00
native-api
51937ccc19
Add miniconda3-24.3.0-0 (#3139) 2024-12-22 17:04:32 +03:00
Ivan Pozdeev
ac2f882aab Fix scripts not getting a Python version for verify_pyXXX 2024-12-22 16:19:59 +03:00
Ivan Pozdeev
25c966eb4f add_miniconda.py: future-proof, update defaults, change -v
* future-proof PyVersion
* fix handling "-latest"
* Update default versions
* change -v argument to bool
2024-12-22 15:59:52 +03:00
Christian Fredrik Johnsen
c6973391f3
pyenv-init | performance improvements (#3136)
* perf: replace a series of if statements with a case block. Add error
handling for case where unknown option is provided.
Same setup as rbenv-init for reading arguments.

* perf, docs: Recommend users to specify the shell for `pyenv init -`
Speeds up the startup by about 40% (in local testing, from ~50ms to ~30ms).
Reflect this in `pyenv init` hint text.

* style: remove unnecessary `root` variable in pyenv-init
* style: remove unnecessary variable declarations at the top of file in pyenv-init.

* perf: replace `cat <<` calls with `echo`
The builtin `echo` is about 100x faster. In tests, saves about 2-3ms.

* docs: document the `pyenv init - <shell>` performance boost in the Advanced Configuration section.

* style: test_helper.bash: avoid unnecessary ".." in produced PATH

* docs: fix a false statement about completions location in the Advanced Configuration section.
2024-12-22 15:23:51 +03:00
binbjz
38421ba6aa
Add miniconda3-24.11.1-0 (#3138)
Co-authored-by: binbjz <zhaobin@avenir.hk>
2024-12-21 16:48:25 +03:00
Ivan Pozdeev
a1edb81e8e 2.4.23 2024-12-18 10:13:13 +03:00
Ned Batchelder
5f7892f728
Add CPython 3.14.0a3 (#3135) 2024-12-18 10:11:11 +03:00
Ivan Pozdeev
86be59a6d5 Tolerate nonexistent versions from pyenv-version-name in pyenv-which
Addendum to #3134 as per https://github.com/pyenv/pyenv/pull/3134#issuecomment-2545710044
2024-12-16 21:36:14 +03:00
native-api
dc873cf568
Support missing versions being present and set in a local .python-version (#3134)
Requested in https://github.com/pyenv/pyenv/issues/2680
for deployments with a stock `.pyenv-version` that can use any
of a number of Python versions
and for compatibility with `uv`.

* Support `pyenv local --force`
* Support `pyenv-version-file-write --force`
* Support `pyenv version-name --force`
* Ignore missing versions when searching for executables
* Display "commmand not found" even when there are nonexistent versions

* exec.bats: replace `python` and `rspec` with something that doesn't exist globally, either
in Ubuntu Github CI, `python` exists globally
2024-12-16 02:32:45 +03:00
Ivan Pozdeev
aef6a2a6d0 Remove incorrect statement about resolution behavior
`shell` does not fall through to `local`, and `local to `global`.
2024-12-15 21:20:49 +03:00
native-api
527d8fab3e
Adjust suggested shell startup code to support Pyenv with Pyenv-Win in WSL (#3132)
There's a complaint that this results in duplicate PATH entries in nested shells, will deal with that separately
2024-12-15 17:22:51 +03:00
native-api
fc0e27c24b
Support PACKAGE_CPPFLAGS and PACKAGE_LDFLAGS (#3130)
add test to test all the flag types
2024-12-13 23:06:03 +03:00
Oluf Lorenzen
a2ad48aa40
README: explain using multiple versions (#3126)
Co-authored-by: native-api <vano@mail.mipt.ru>
2024-12-12 06:58:02 +03:00
Ivan Pozdeev
d04a081dcb 2.4.22 2024-12-07 14:29:09 +03:00
Ivan Pozdeev
cb83169098 fix CL: + test modified scripts with tar.gz source
missed some of the changes
2024-12-07 14:27:29 +03:00
Daniel Lamblin
3bdb9bd1e7
Fix 404 for bundled openssl-3.4.0 release in 3.13.1 (#3122) 2024-12-07 14:20:33 +03:00
native-api
cc40a3f965
CL: + test modified scripts with tar.gz source (#3125) 2024-12-07 14:19:50 +03:00
native-api
25e70b2c80
CI: + build with bundled MacOS dependencies (#3123) 2024-12-07 13:58:35 +03:00
native-api
4c90a3147f
Speed up building bundled OpenSSL (#3124)
* Skip building bundled OpneSSL unnecessary parts
* Remove bundled OpneSSL build hack: no longer needed
2024-12-07 13:54:33 +03:00
Ivan Pozdeev
ee84e89ef1 2.4.21 2024-12-06 02:57:27 +03:00
native-api
a39449bc50
Prefer tcl-tk@8 from Homebrew due to release of Tcl/Tk 9 with which only 3.12+ are compatible (#3118) 2024-12-06 02:55:53 +03:00
Michael Makukha
3bc0d858cc
Add 3.13.1t (#3120) 2024-12-06 01:53:45 +03:00
Ivan Pozdeev
0f8b2b2b84 2.4.20 2024-12-04 02:08:51 +03:00
native-api
c424717a39
Merge pull request #3117 from edgarrmondragon/cpython-3.13.1
Add CPython 3.9.21, 3.10.16, 3.11.11, 3.12.8 and 3.13.1
2024-12-04 02:07:07 +03:00
Edgar Ramírez-Mondragón
81632f0ab4
Remove EOL Python 3.8 from CI 2024-12-03 16:25:19 -06:00
Edgar Ramírez-Mondragón
a79440470e
Run ubuntu_build on Python 3.13 2024-12-03 16:17:03 -06:00
Edgar Ramírez-Mondragón
84037dff4e
Run macos_build on Python 3.13 2024-12-03 16:11:00 -06:00
Edgar Ramírez-Mondragón
a7a0354da9
Add CPython 3.9.21, 3.10.16, 3.11.11, 3.12.8 and 3.13.1 2024-12-03 16:09:02 -06:00
Clément Vannicatte
6140619301
README: correct link to shell setup instructions (#3113) 2024-11-27 23:30:12 +03:00
Noelle Leigh
61c0f25ef5
README: Fix Markdown in "Notes about python releases" (#3112)
HTML and Markdown need to be separated by an empty line to co-exist, otherwise the Markdown isn't parsed correctly.
2024-11-23 16:35:06 +03:00
Ivan Pozdeev
1e8e96b8a2 2.4.19 2024-11-20 22:11:32 +03:00
Madhu Gururajan
707e8d1ef8
Add quick start section and gif demo to accompany it. (#3044)
* Reorganize readme, add gif

1. Details in 'Getting Pyenv' and 'Setup for your shell' are collapsed. User can expand relevant
   sections depending on their platform and shell.

2. 'How It Works' and 'Advanced Configuration' are moved to the bottom of the README.md
   just before 'Contributing' section at the end.

3. Added a GIF in the 'Usage' section to showcase
   - Listing python versions available for install.
   - Installing a specific python version.
   - Listing installed python versions.
   - Switching to another python version for a directory.
   - Testing by moving terminal into the directory and moving back.

* Update GIF to show prefix resolution

* Collapse upgrade notes

* Cross-mention Linux and MacOS instlalation scenarios

---------

Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
2024-11-20 22:08:35 +03:00
Ned Batchelder
04b32e2d46
Add CPython 3.14.0a2 (#3110) 2024-11-20 21:26:18 +03:00
Ivan Pozdeev
6393a4dfce 2.4.18 2024-11-17 23:49:36 +03:00
Michael Goerz
b0d6a67881
Add miniforge3-24.9.2-0 (#3106) 2024-11-13 23:57:14 +03:00
Ivan Pozdeev
d64d1aa1e0 MAINTENANCE.md: easier way to make a release 2024-10-28 02:53:18 +03:00
Ivan Pozdeev
96b3fb2fc3 2.4.17 2024-10-28 02:43:30 +03:00
native-api
7f60ef0b54
Merge pull request #3097 from binbjz/anaconda3-2024.10-1
Add Anaconda3-2024.10-1
2024-10-27 10:43:38 +03:00
binbjz
37ad06f7ce
Add miniconda3-24.9.2-0 (#3096)
Co-authored-by: binbjz <zhaobin@avenir.hk>
2024-10-27 10:35:24 +03:00
binbjz
6711e9a21d Add anaconda3-2024.10-1 2024-10-27 15:33:17 +08:00
binbjz
f3e288c6ad Add miniconda3-24.9.2-0 2024-10-27 15:24:35 +08:00
Ivan Pozdeev
770eb66ec8 2.4.16 2024-10-17 18:47:39 +03:00
Edgar Ramírez Mondragón
630b3700ad
Add CPython 3.14.0a1 (#3093) 2024-10-17 18:45:38 +03:00
Michael Šimáček
fb9880e460
Add GraalPy 24.1.1 (#3092) 2024-10-16 20:14:36 +03:00
Ivan Pozdeev
050f88c78b 2.4.15 2024-10-11 16:31:00 +03:00
native-api
3ced1c4751
Support free-threaded CPython flavor in prefix resolution (#3090)
Since 3.13, CPython is provided in 2 flavors: regular and
free-threaded, with the 't' suffix.

An incomplete prefix ending with '[0-9]t'
resolves only among versions that also end with '[0-9]t'
2024-10-11 16:28:10 +03:00
Antoine Arbouin
03b60aafec
Support virtualenvs with names starting with "python-" (#3086) 2024-10-10 20:43:13 +03:00
Edgar Ramírez Mondragón
6a7ecfe409
Add CPython 3.13.0 (#3081) 2024-10-08 01:16:53 +03:00
David Poznik
d201daeb33
Make "y/N" prompt consistent with others (#3080) 2024-10-05 02:17:45 +03:00
tuzi3040
468dc81107
CI: replace set-output with GITHUB_OUTPUT (#3079)
`::set-output` is deprecated as per https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
2024-10-02 16:37:31 +03:00
Ivan Pozdeev
5180c3cfb5 2.4.14 2024-10-02 15:13:21 +03:00
Edgar Ramírez Mondragón
95917cb753
Add CPython 3.13.0rc3 (#3077) 2024-10-02 14:50:59 +03:00
Edgar Ramírez Mondragón
55134ea1a1
Add CPython 3.12.7 (#3078) 2024-10-02 14:50:30 +03:00
Ivan Pozdeev
3f2ef9e00a README: Clarify Zsh configuration
Closes #3069
2024-09-28 21:04:59 +03:00
Ivan Pozdeev
62fc392515 2.4.13 2024-09-18 07:38:48 +03:00
Michael Šimáček
d8f5b583bd
Add GraalPy 24.1.0 (#3066) 2024-09-18 07:33:27 +03:00
Edgar Ramírez Mondragón
6517caf583
Fix OpenSSL 3.3.2 download URLs (#3059) 2024-09-12 07:43:03 +03:00
native-api
9c40f0b67e
Fix tgz checksum for 3.9.20; fallback OpenSSL URLs checksums for 3.11.10, 3.12.6, 3.13.0rc2 (#3060)
changed OpenSSL URLs to permalinks so that they keep working
2024-09-12 01:44:05 +03:00
Ed Morley
d60d1c5cdc
Fix latest version resolution when using python- prefix (#3056)
Fixes use of version specifiers like `python-3.12`, which:
- have an explicit `python-` prefix
- are using a major version alias that has to be resolved
  to an exact version.

Also simplified the conditional for the already
working case, since it had two branches that were virtually identical.
2024-09-10 18:51:55 +03:00
Andrew Linzie
1cabb6e02b
docs: Use --verbose with performance CPython build instructions (#3053) 2024-09-08 22:13:47 +03:00
Ivan Pozdeev
2e658d3e35 2.4.12 2024-09-07 18:50:46 +03:00
Edgar Ramírez Mondragón
d8c8338cd8
Add CPython 3.8.20, 3.9.20, 3.10.15, 3.11.10 and 3.12.6 (#3050) 2024-09-07 18:47:51 +03:00
Edgar Ramírez Mondragón
ac5c87e044
Add CPython 3.13.0rc2 (#3049) 2024-09-07 18:46:46 +03:00
Ivan Pozdeev
b123520826 2.4.11 2024-09-04 22:52:25 +03:00
John Sirois
5fcd9d7a4f
Add PyPy v7.3.17. (#3045)
N.B.: 7.3.17 frops Python 3.9 support as well as s390x platform
releases. See: https://pypy.org/posts/2024/08/pypy-v7317-release.html
2024-09-04 22:15:59 +03:00
binbjz
669d1f1038
Add miniconda3-24.7.1-0 support (#3040)
Co-authored-by: binbjz <binbjz@skiff.com>
2024-08-24 12:42:23 +03:00
Tom Schraitle
57a6772451
Add /usr/etc/pyenv.d to hooks path (#3039)
The directory /usr/etc is an optional directory and used by
Fedora, RHEL 9, and openSUSE. The purpose of /usr/etc is to store
distribution-provided configuration files that can be overridden
by user-modified files in /etc.

/usr/etc is not in FHS. However, as Torsten stated in his comment
(https://github.com/thkukuk/atomic-updates_and_etc/issues/2#issuecomment-524848666)
"[FHS] is currently nearly as dead as LSB, we can only ignore it
if we don't want to stop and kill all innovation."
2024-08-24 12:38:54 +03:00
Ivan Pozdeev
9ecd803bff 2.4.10 2024-08-07 20:16:29 +03:00
Edgar Ramírez Mondragón
11efbdce46
Add CPython 3.12.5 (#3030) 2024-08-07 19:40:19 +03:00
Ivan Pozdeev
9e7010b72f 2.4.9 2024-08-05 01:54:31 +03:00
Edgar Ramírez Mondragón
6511ce26cd
Add CPython 3.13.0rc1 (#3029) 2024-08-03 14:11:56 +03:00
Michael Goerz
9b09a7efc9
Add miniforge3-24.3.0-0 (#3028) 2024-07-31 12:41:59 +03:00
Ivan Pozdeev
f17809c4b9 2.4.8 2024-07-21 07:02:45 +03:00
native-api
ae5ee4de26
Merge pull request #3021 from native-api/pyenv_latest_b_f
pyenv-latest: replace -q with -b and -f, document as internal
2024-07-21 06:58:00 +03:00
native-api
e9611beffe
Fix tests failing if plugins are installed (#3022)
Drop the failing test in favor of a better-written test
that also tests the same
2024-07-21 06:57:39 +03:00
Ivan Pozdeev
e44b12c2dc Remove nop tests
Easy syncing with Rbenv is not as important now
2024-07-21 06:36:06 +03:00
Ivan Pozdeev
9373970678 pyenv-latest: replace -q with -b and -f, document as internal
More tailored for the emergent internal use cases
2024-07-21 06:31:42 +03:00
ThomasHaz
88f76ee787
README: Remove reference to Fig [https://fig.io] (#3018)
[Fig](https://fig.io) has been sunlit for new users, with access being removed in September
2024-07-20 21:32:57 +03:00
Edgar Ramírez Mondragón
e396561661
Add CPython 3.13.0b4 and 3.13.0b4t (#3019) 2024-07-20 21:29:18 +03:00
native-api
cdd97d8c30
Fix pyenv-uninstall not having the debug tracing invocation (#3020) 2024-07-20 21:22:50 +03:00
Ivan Pozdeev
adf3c2bccf 2.4.7 2024-07-06 04:44:35 +03:00
native-api
50e726ac41
Fix debug build for X.Yy-dev (#3011)
also just use extglob everywhere
2024-07-06 04:04:46 +03:00
native-api
662b5ddd13
Merge pull request #3009 from binbjz/add-new-anaconda3
Add support for anaconda3-2024.06-1
2024-07-06 03:43:27 +03:00
binbjz
d81eebf8d1 Add support for anaconda3-2024.06-1 2024-07-05 19:37:22 +08:00
binbjz
b11728c284
Merge branch 'pyenv:master' into master 2024-07-05 19:28:02 +08:00
Ivan Pozdeev
ca90363d73 2.4.6 2024-07-05 06:57:48 +03:00
Jon Crall
672eef1561
Speed up pyenv prefix by not constructing advice text when it would be discarded (#3005)
by adding an internal flag
2024-07-04 03:49:12 +03:00
Sam Gross
384361167a
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 <vano@mail.mipt.ru>
2024-07-01 22:50:03 +03:00
native-api
1bcaab05b7
CI: push MacOS jobs to MacOS 13 and 14 (#3002)
Github has finally released those as free and retired macos-11
2024-07-01 22:38:06 +03:00
binbjz
bc6a0db677
Merge branch 'pyenv:master' into master 2024-06-27 20:39:59 +08:00
zhaobin
4b60ddd06d Add support for miniconda3 24.4.0-0 with py3.12, py3.11, py3.10, py3.9 2024-06-10 15:36:21 +08:00
558 changed files with 85688 additions and 1891 deletions

1
.github/CODEOWNERS vendored Normal file
View File

@ -0,0 +1 @@
* @pyenv/pyenv-core-maintainers @pyenv/pyenv-core-committers

View File

@ -1,26 +0,0 @@
Too many issues will kill our team's development velocity, drastically.
Make sure you have checked all steps below.
### Prerequisite
* [ ] Make sure your problem is not listed in [the common build problems](https://github.com/pyenv/pyenv/wiki/Common-build-problems).
* [ ] Make sure no duplicated issue has already been reported in [the pyenv issues](https://github.com/pyenv/pyenv/issues). You should look for closed issues, too.
* [ ] Make sure you are not asking us to help solving your specific issue.
* GitHub issues is opened mainly for development purposes. If you want to ask someone to help solving your problem, go to some community site like [Gitter](https://gitter.im/yyuu/pyenv), [StackOverflow](https://stackoverflow.com/questions/tagged/pyenv), etc.
* [ ] Make sure your problem is not derived from packaging (e.g. [Homebrew](https://brew.sh)).
* Please refer to the package documentation for the installation issues, etc.
* [ ] Make sure your problem is not derived from plugins.
* This repository is maintaining `pyenv` and the default `python-build` plugin only. Please refrain from reporting issues of other plugins here.
### Description
- [ ] Platform information (e.g. Ubuntu Linux 16.04):
- [ ] OS architecture (e.g. amd64):
- [ ] pyenv version:
- [ ] Python version:
- [ ] C Compiler information (e.g. gcc 7.3):
- [ ] Please attach the debug trace of the failing command as a gist:
* Run `env PYENV_DEBUG=1 <faulty command> 2>&1 | tee trace.log` and attach `trace.log`. E.g. if you have a problem with installing Python, run `env PYENV_DEBUG=1 pyenv install -v <version> 2>&1 | tee trace.log` (note the `-v` option to `pyenv install`).
- [ ] If you have a problem with installing Python, please also attach `config.log` from the build directory
* The build directory is reported after the "BUILD FAILED" message and is usually under `/tmp`.
- [ ] If the build succeeds but the problem is still with the build process (e.g. the resulting Python is missing a feature), please attach
* the debug trace from reinstalling the faulty version with `env PYENV_DEBUG=1 pyenv install -f -k -v <version> 2>&1 | tee trace.log`
* `config.log` from the build directory. When using `pyenv install` with `-k` as per above, the build directory will be under `$PYENV_ROOT/sources`.

54
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,54 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
### Prerequisites
* [ ] Make sure your problem is not listed in [the common build problems](https://github.com/pyenv/pyenv/wiki/Common-build-problems).
* [ ] Make sure no duplicated issue has already been reported in [the pyenv issues](https://github.com/pyenv/pyenv/issues?q=is%3Aissue). For build errors, a reported issue typically mentions a key error message. This key error message is often not in the 10 last build log lines reported to the console but is rather earlier in the build log -- typically, it's the first error message encountered in the log.
* [ ] Make sure you are reporting a problem in Pyenv and not seeking consultation with Pyenv usage.
* GitHub issues are intended mainly for Pyenv development purposes. If you are seeking help with Pyenv usage, check [Pyenv documentation](https://github.com/pyenv/pyenv?tab=readme-ov-file#simple-python-version-management-pyenv), go to a user community site like [Gitter](https://gitter.im/yyuu/pyenv), [StackOverflow](https://stackoverflow.com/questions/tagged/pyenv), etc, or to [Discussions](https://github.com/orgs/pyenv/discussions).
* [ ] Make sure your problem is not derived from packaging (e.g. [Homebrew](https://brew.sh)).
* Please refer to the package documentation for the installation issues, etc.
* [ ] Make sure your problem is not derived from plugins.
* This repository is maintaining `pyenv` and the default `python-build` plugin only. Please refrain from reporting issues of other plugins here.
### Describe the bug
A clear and concise description of what the bug is.
Do specify what the expected behaviour is if that's not obvious from the bug's nature.
#### Reproduction steps
Listing the commands to run in a new console session and their output is usually sufficient.
Please use a Markdown code block (three backticks on a line by themselves before and after the text) to denote a console output excerpt.
Usually not needed for build errors (since the arguments can already be seen in the debug trace) unless you are using an unusual invocation (e.g. setting environment variables that affect the build).
#### Diagnostic details
- [ ] Platform information (e.g. Ubuntu Linux 24.04):
- [ ] OS architecture (e.g. amd64):
- [ ] pyenv version:
- [ ] Python version:
- [ ] C Compiler information (e.g. gcc 7.3):
- [ ] Please attach the debug trace of the failing command as a [gist](https://gist.github.com/):
* Run `env PYENV_DEBUG=1 <faulty command> 2>&1 | tee trace.log` and attach `trace.log`. E.g. if you have a problem with installing Python, run `env PYENV_DEBUG=1 pyenv install -v <version> 2>&1 | tee trace.log` (note the `-v` option to `pyenv install`).
- [ ] If you have a problem with installing Python, please also attach `config.log` from the build directory
* The build directory is reported after the "BUILD FAILED" message and is usually under `/tmp`.
- [ ] If the build succeeds but the problem is still with the build process (e.g. the resulting Python is missing a feature), please attach
* the debug trace from reinstalling the faulty version with `env PYENV_DEBUG=1 pyenv install -f -k -v <version> 2>&1 | tee trace.log`
* `config.log` from the build directory. When using `pyenv install` with `-k` as per above, the build directory will be under `$PYENV_ROOT/sources`.
- [ ] If the problem happens in another Pyenv invocation, turn on debug logging by setting `PYENV_DEBUG=1`, e.g. `env PYENV_DEBUG=1 pyenv local 3.6.4`, and attach the resulting trace as a gist
- [ ] If the problem happens outside of a Pyenv invocation, get the debug trace like this:
```
export PYENV_DEBUG=1
# for Bash
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
# for Zsh
export PS4='+(%x:%I): %N(%i): '
set -x
<reproduce the problem>
set +x
```

View File

@ -0,0 +1,24 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Describe the intended use case**
* What your general environment is if it's relevant to the feature request and is not a generic console with a typical Pyenv installation (CI, server with a custom setup, cloud environment, IDE)
* What you are trying to achieve
* What specifically you are doing for that regarding Pyenv
* Where you are stuck
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
[ ] In particular, did you consider [writing a plugin](https://github.com/pyenv/pyenv/blob/master/README.md#pyenv-plugins)? Note that if your plugin has general applicability, you can publish it in the 3rd-party plugin catalog on the Pyenv Wiki as per the link above.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@ -4,6 +4,8 @@ updates:
directory: "/" directory: "/"
schedule: schedule:
interval: "monthly" interval: "monthly"
cooldown:
default-days: 7
groups: groups:
github-actions: github-actions:
patterns: patterns:

View File

@ -0,0 +1,364 @@
#!/usr/bin/env python3
"""Generate a "Sponsors since <date>" section for release notes.
Queries GitHub Sponsors and OpenCollective for new sponsors since the latest
pyenv release or one month ago, whichever is longer. The output is Markdown
suitable for GitHub Releases.
Requirements:
* Python 3.8+
* The ``gh`` CLI authenticated with the ``read:user`` scope.
* Network access to https://opencollective.com.
"""
import argparse
import calendar
import datetime
import json
import pathlib
import subprocess
import sys
import typing
import urllib.error
import urllib.request
GITHUB_ORG = "pyenv"
OPENCOLLECTIVE_MEMBERS_URL = "https://opencollective.com/pyenv/members.json"
class SponsorDataError(RuntimeError):
"""Raised when a sponsors data source cannot be queried or parsed."""
def parse_date(value: str) -> datetime.date:
return datetime.datetime.fromisoformat(value).date()
def one_month_ago(today: typing.Optional[datetime.date] = None) -> datetime.date:
today = today or datetime.date.today()
year = today.year
month = today.month - 1
if month == 0:
year -= 1
month = 12
try:
return datetime.date(year, month, today.day)
except ValueError:
last_day = calendar.monthrange(year, month)[1]
return datetime.date(year, month, last_day)
def latest_release_date() -> datetime.date:
"""Return the publish date of the latest GitHub release."""
latest_release_error = None
try:
result = subprocess.run(
["gh", "api", f"repos/{GITHUB_ORG}/{GITHUB_ORG}/releases/latest"],
capture_output=True,
text=True,
check=True,
)
data = json.loads(result.stdout)
published = data["published_at"].replace("Z", "+00:00")
return datetime.datetime.fromisoformat(published).date()
except (
subprocess.CalledProcessError,
OSError,
json.JSONDecodeError,
KeyError,
) as exc:
latest_release_error = exc
try:
tag = subprocess.run(
["git", "describe", "--tags", "--abbrev=0"],
capture_output=True,
text=True,
check=True,
).stdout.strip()
date_str = subprocess.run(
["git", "log", "-1", "--format=%cI", tag],
capture_output=True,
text=True,
check=True,
).stdout.strip()
return datetime.datetime.fromisoformat(date_str).date()
except (subprocess.CalledProcessError, OSError) as exc:
detail = ""
if latest_release_error is not None:
detail = f" GitHub release lookup failed first: {latest_release_error}."
raise SponsorDataError(
"Could not determine the latest release date. "
"Pass --since explicitly or run from a clone with release tags."
f"{detail}"
) from exc
def compute_since_date(explicit_since: typing.Optional[datetime.date]) -> datetime.date:
if explicit_since is not None:
return explicit_since
return min(latest_release_date(), one_month_ago())
def github_sponsors(since: datetime.date) -> typing.List[typing.Dict]:
"""Return GitHub Sponsors created on or after *since*."""
query = """
query($org: String!, $after: String) {
organization(login: $org) {
sponsorshipsAsMaintainer(
first: 100,
after: $after,
activeOnly: false,
orderBy: {field: CREATED_AT, direction: DESC}
) {
pageInfo {
hasNextPage
endCursor
}
nodes {
createdAt
sponsorEntity {
... on User { login, name }
... on Organization { login, name }
}
}
}
}
}
"""
since_dt = datetime.datetime.combine(
since, datetime.time.min, tzinfo=datetime.timezone.utc
)
sponsors = []
cursor = None
while True:
command = [
"gh",
"api",
"graphql",
"-F",
f"org={GITHUB_ORG}",
"-f",
f"query={query}",
]
if cursor is not None:
command.extend(["-F", f"after={cursor}"])
result = subprocess.run(
command,
capture_output=True,
text=True,
)
if result.returncode != 0:
detail = result.stderr.strip() or result.stdout.strip() or "no output"
raise SponsorDataError(
"GitHub Sponsors query failed. "
"Check that `gh auth status` shows access to the pyenv org "
"and that the token has the scopes required to read sponsorships. "
f"`gh api graphql` exited {result.returncode}: {detail}"
)
try:
data = json.loads(result.stdout)
except json.JSONDecodeError as exc:
raise SponsorDataError(
"GitHub Sponsors query returned invalid JSON."
) from exc
if "errors" in data:
raise SponsorDataError(
f"GitHub Sponsors query returned errors: {data['errors']}"
)
try:
sponsorships = data["data"]["organization"]["sponsorshipsAsMaintainer"]
except (TypeError, KeyError) as exc:
raise SponsorDataError(
"GitHub Sponsors query returned an unexpected response shape."
) from exc
try:
nodes = sponsorships["nodes"]
page_info = sponsorships["pageInfo"]
except (TypeError, KeyError) as exc:
raise SponsorDataError(
"GitHub Sponsors query returned incomplete pagination data."
) from exc
for node in nodes:
try:
created = datetime.datetime.fromisoformat(
node["createdAt"].replace("Z", "+00:00")
)
entity = node["sponsorEntity"]
login = entity["login"]
except (AttributeError, KeyError, TypeError, ValueError) as exc:
raise SponsorDataError(
"GitHub Sponsors query returned an unexpected sponsor record."
) from exc
if created < since_dt:
return sponsors
sponsors.append({
"login": login,
"name": entity.get("name") or login,
})
try:
has_next_page = page_info["hasNextPage"]
cursor = page_info["endCursor"]
except (TypeError, KeyError) as exc:
raise SponsorDataError(
"GitHub Sponsors query returned incomplete pagination data."
) from exc
if not has_next_page:
return sponsors
def opencollective_sponsors(since: datetime.date, data: typing.Union[str, None]) -> typing.List[typing.Dict]:
"""Return OpenCollective backers active on or after *since*."""
if data is None:
req = urllib.request.Request(
f"{OPENCOLLECTIVE_MEMBERS_URL}?limit=1000",
headers={"User-Agent": f"{GITHUB_ORG}/release-notes-sponsors"},
)
try:
with urllib.request.urlopen(req, timeout=30) as resp:
data = resp.read()
except urllib.error.HTTPError as exc:
raise SponsorDataError(
f"OpenCollective sponsors query failed for {OPENCOLLECTIVE_MEMBERS_URL}: "
f"HTTP {exc.code} {exc.reason}"
) from exc
except urllib.error.URLError as exc:
raise SponsorDataError(
f"OpenCollective sponsors query failed for {OPENCOLLECTIVE_MEMBERS_URL}: "
f"{exc.reason}"
) from exc
try:
members = json.loads(data)
except json.JSONDecodeError as exc:
raise SponsorDataError(
"OpenCollective sponsors query returned invalid JSON."
) from exc
since_dt = datetime.datetime.combine(since, datetime.time.min)
sponsors = []
for member in members:
if member.get("role") != "BACKER":
continue
try:
last_transaction_at = datetime.datetime.strptime(member["lastTransactionAt"], "%Y-%m-%d %H:%M")
profile = member["profile"].rstrip("/")
except (KeyError, TypeError, ValueError) as exc:
raise SponsorDataError(
"OpenCollective sponsors query returned an unexpected member record."
) from exc
if last_transaction_at < since_dt:
continue
slug = profile.split("/")[-1]
if slug == "github-sponsors":
# Listed separately under GitHub Sponsors.
continue
sponsors.append({
"name": member.get("name") or slug,
"profile": profile,
})
return sponsors
def render(
since: datetime.date,
gh_sponsors: typing.List[typing.Dict],
oc_sponsors: typing.List[typing.Dict],
) -> str:
lines = [f"## Sponsors since {since.isoformat()}", ""]
if gh_sponsors:
lines.append("### GitHub Sponsors")
for sponsor in gh_sponsors:
lines.append(
markdown_link(
sponsor["name"],
f"https://github.com/{sponsor['login']}",
)
)
lines.append("")
if oc_sponsors:
lines.append("### Open Collective")
for sponsor in oc_sponsors:
lines.append(markdown_link(sponsor["name"], sponsor["profile"]))
lines.append("")
if not gh_sponsors and not oc_sponsors:
lines.append("*No new sponsors in this period.*")
lines.append("")
return "\n".join(lines)
def markdown_link(text: str, url: str) -> str:
escaped_text = escape_markdown_text(text)
escaped_url = url.replace(")", "%29")
return f"- [{escaped_text}]({escaped_url})"
def escape_markdown_text(text: str) -> str:
escaped = text.replace("\\", "\\\\")
for char in r"`*_{}[]()#+-.!|>":
escaped = escaped.replace(char, f"\\{char}")
return escaped
def main() -> int:
parser = argparse.ArgumentParser(
description="Generate a sponsors section for GitHub release notes."
)
parser.add_argument(
"--since",
type=parse_date,
metavar="YYYY-MM-DD",
help="Include sponsors created on or after this date.",
)
parser.add_argument(
"--output",
metavar="FILE",
help="Write the section to FILE instead of stdout.",
)
parser.add_argument(
"--skip-opencollective",
action="store_true",
help="Skip OpenCollective backers if the members endpoint is unavailable.",
)
parser.add_argument(
"--opencollective-data",
metavar="FILE",
help="Take OpenCollective API reply from FILE.",
)
args = parser.parse_args()
try:
since = compute_since_date(args.since)
oc_sponsors = []
if not args.skip_opencollective:
manual_data = (
pathlib.Path(args.opencollective_data).read_text()) \
if args.opencollective_data \
else None
oc_sponsors = opencollective_sponsors(since, manual_data)
section = render(since, github_sponsors(since), oc_sponsors)
except SponsorDataError as exc:
print(f"error: {exc}", file=sys.stderr)
return 1
if args.output:
with open(args.output, "w", encoding="utf-8") as f:
f.write(section)
else:
print(section, end="")
return 0
if __name__ == "__main__":
sys.exit(main())

58
.github/workflows/add_version.yml vendored Normal file
View File

@ -0,0 +1,58 @@
name: Add versions
on:
workflow_dispatch: {}
schedule:
# Every N hours
- cron: '25 */4 * * *'
permissions:
contents: write
pull-requests: write
jobs:
add_cpython:
runs-on: ubuntu-slim
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: 3
cache: 'pip'
cache-dependency-path: plugins/python-build/scripts/requirements.txt
- run: pip install -r plugins/python-build/scripts/requirements.txt
- name: check for a release
run: |
python plugins/python-build/scripts/add_cpython.py --verbose >added_versions.lst && rc=$? || rc=$?
#0 means new version found, 1 not found, 2 another error
[[ $rc -gt 1 ]] && false
echo "rc=$rc" >> $GITHUB_ENV
- name: set PR properties
if: env.rc == 0
shell: python
run: |
import os
import sys
versions=[l.rstrip() for l in open("added_versions.lst")]
with open(os.environ['GITHUB_ENV'],'a') as f:
f.write(f'branch_name=auto_add_version/{"_".join(versions)}\n')
f.write(f'pr_name=Add CPython {", ".join(versions)}\n')
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
uses: peter-evans/create-pull-request@v8
if: env.rc == 0
with:
branch: ${{ env.branch_name }}
title: ${{ env.pr_name }}
commit-message: ${{ env.pr_name }}
token: ${{ steps.generate-token.outputs.token }}

View File

@ -1,5 +1,8 @@
name: macos_build name: macos_build
on: [pull_request, push] on:
push:
branches: [master]
pull_request: {}
permissions: permissions:
contents: read # to fetch code (actions/checkout) contents: read # to fetch code (actions/checkout)
@ -10,33 +13,30 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
python-version: python-version:
- "3.8"
- "3.9"
- "3.10" - "3.10"
- "3.11" - "3.11"
- "3.12" - "3.12"
runs-on: macos-11 - "3.13"
- "3.14"
runs-on: macos-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
# Normally, we would use the superbly maintained...
# - uses: actions/setup-python@v2
# with:
# python-version: ${{ matrix.python-version }}
# ... but in the repo, we want to test pyenv builds on macOS
- run: | - run: |
brew install openssl readline sqlite3 xz zlib brew install openssl readline sqlite3 xz tcl-tk@8 libb2 zstd
# https://github.com/pyenv/pyenv#installation - run: |
- run: pwd #envvars
- env: export PYENV_ROOT="$GITHUB_WORKSPACE"
PYENV_ROOT: /Users/runner/work/pyenv/pyenv echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV
run: |
echo $PYENV_ROOT
echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH
bin/pyenv --debug install ${{ matrix.python-version }} - run: |
bin/pyenv global ${{ matrix.python-version }} #build
bin/pyenv rehash pyenv --debug install ${{ matrix.python-version }} && rc=$? || rc=$?
- run: python --version if [[ $rc -ne 0 ]]; then echo config.log:; cat $TMPDIR/python-build*/*/config.log; false; fi
- run: python -m pip --version pyenv global ${{ matrix.python-version }}
- run: |
#print version
python --version
python -m pip --version
- shell: python # Prove that actual Python == expected Python - shell: python # Prove that actual Python == expected Python
env: env:
EXPECTED_PYTHON: ${{ matrix.python-version }} EXPECTED_PYTHON: ${{ matrix.python-version }}

View File

@ -5,24 +5,80 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
versions: ${{steps.modified-versions.outputs.versions}} versions: ${{steps.modified-versions.outputs.versions}}
versions_cpython_only: ${{steps.modified-versions.outputs.versions_cpython_only}}
versions_macos_build_exclude: ${{steps.modified-versions.outputs.versions_macos_build_exclude}}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
- run: git fetch origin "$GITHUB_BASE_REF" - run: git fetch origin "$GITHUB_BASE_REF"
- shell: bash - shell: bash
run: > run: >
versions=$(git diff "origin/$GITHUB_BASE_REF" --name-only -z versions=$(git diff "origin/$GITHUB_BASE_REF" --name-only -z
| perl -ne 'BEGIN {$\="\n";$/="\0";} chomp; | perl -ne 'BEGIN {$\="\n";$/="\0";} chomp;
if (/^plugins\/python-build\/share\/python-build\/(?:([^\/]+)|patches\/([^\/]+)\/.*)$/ and -e $& ) if (/^(plugins\/python-build\/share\/python-build\/)(?:([^\/]+)|patches\/([^\/]+)\/.*)$/ and -e $& )
{ print $1.$2; }' \ {
print $2.$3;
if ( -e $1.$2.$3.t ) { print $2.$3.t; }
}' \
| sort -u); | sort -u);
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64); EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64);
echo "versions<<$EOF" >> $GITHUB_ENV; echo "versions<<$EOF" >> $GITHUB_ENV;
echo "$versions" >> $GITHUB_ENV; echo "$versions" >> $GITHUB_ENV;
echo "$EOF" >> $GITHUB_ENV; echo "$EOF" >> $GITHUB_ENV;
versions_cpython_only=$(grep -Ee '^[[:digit:]]' <<<"$versions")
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64);
echo "versions_cpython_only<<$EOF" >> $GITHUB_ENV;
echo "$versions_cpython_only" >> $GITHUB_ENV;
echo "$EOF" >> $GITHUB_ENV;
- run: pip install packaging
- name: Build exclusions JSON
shell: python
run: |
import os
import json
import random
import re
import subprocess
import packaging.version
result=[]
for line in os.environ['versions'].splitlines():
if m:=re.match(r'([^-]+)-(\d+\.\d+)-(\d+\.\d+.\d+)', line):
name, version = m.group(1), packaging.version.Version(m.group(3))
# Miniconda dropped MacOS x64 support
if (name == 'miniconda3' and version >= packaging.version.Version('25.9.1')):
result.append({'os':'macos-15-intel','python-version':line})
if m:=re.match(r'([^-]+)-(\d+\.\d+)', line):
name, version = m.group(1), packaging.version.Version(m.group(2))
# Anaconda dropped MacOS x64 support
if name == 'anaconda3' and version >= packaging.version.Version('2025.12'):
result.append({'os':'macos-15-intel','python-version':line})
if m:=re.match(r'graalpy[^-]*-(community-)?(\d+\.\d+.\d+)', line):
version = packaging.version.Version(m.group(2))
# GraalPy dropped MacOS x64 support
if version >= packaging.version.Version('25.0.2'):
result.append({'os':'macos-15-intel','python-version':line})
EOF = str(random.getrandbits(15*8))
with open(os.environ['GITHUB_ENV'],'w') as f:
f.write(f"versions_macos_build_exclude_json<<{EOF}\n")
json.dump(result, f)
f.write(f'\n{EOF}\n')
- id: modified-versions - id: modified-versions
run: | run: |
echo -n "::set-output name=versions::" echo "versions=`echo "${{ env.versions }}" | jq -R . | jq -sc .`" >> $GITHUB_OUTPUT
echo "${{ env.versions }}" | jq -R . | jq -sc . echo "versions_cpython_only=`echo "${{ env.versions_cpython_only }}" | jq -R . | jq -sc .`" >> $GITHUB_OUTPUT
echo 'versions_macos_build_exclude=${{ env.versions_macos_build_exclude_json }}' >> $GITHUB_OUTPUT
macos_build: macos_build:
needs: discover_modified_scripts needs: discover_modified_scripts
if: needs.discover_modified_scripts.outputs.versions != '[""]' if: needs.discover_modified_scripts.outputs.versions != '[""]'
@ -30,10 +86,15 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
python-version: ${{fromJson(needs.discover_modified_scripts.outputs.versions)}} python-version: ${{fromJson(needs.discover_modified_scripts.outputs.versions)}}
os: ["macos-11", "macos-12"] os:
- macos-14
- macos-15
- macos-15-intel
- macos-26
exclude: ${{fromJson(needs.discover_modified_scripts.outputs.versions_macos_build_exclude)}}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
- run: | - run: |
#envvars #envvars
export PYENV_ROOT="$GITHUB_WORKSPACE" export PYENV_ROOT="$GITHUB_WORKSPACE"
@ -41,7 +102,7 @@ jobs:
echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH
- run: | - run: |
#prerequisites #prerequisites
brew install openssl openssl@1.1 readline sqlite3 xz zlib brew install openssl readline sqlite3 xz tcl-tk@8 libb2 zstd
if [[ "${{ matrix.python-version }}" =~ pypy.*-(src|dev) ]]; then if [[ "${{ matrix.python-version }}" =~ pypy.*-(src|dev) ]]; then
export PYENV_BOOTSTRAP_VERSION=pypy2.7-7 export PYENV_BOOTSTRAP_VERSION=pypy2.7-7
echo "PYENV_BOOTSTRAP_VERSION=$PYENV_BOOTSTRAP_VERSION" >> $GITHUB_ENV echo "PYENV_BOOTSTRAP_VERSION=$PYENV_BOOTSTRAP_VERSION" >> $GITHUB_ENV
@ -49,7 +110,8 @@ jobs:
fi fi
- run: | - run: |
#build #build
pyenv --debug install ${{ matrix.python-version }} pyenv --debug install ${{ matrix.python-version }} && rc=$? || rc=$?
if [[ $rc -ne 0 ]]; then echo config.log:; cat $TMPDIR/python-build*/*/config.log; false; fi
pyenv global ${{ matrix.python-version }} pyenv global ${{ matrix.python-version }}
# Micropython doesn't support --version # Micropython doesn't support --version
- run: | - run: |
@ -83,6 +145,54 @@ jobs:
pyenv global system pyenv global system
rm -f "$(pyenv root)"/shims/* rm -f "$(pyenv root)"/shims/*
macos_build_bundled_dependencies:
needs: discover_modified_scripts
if: needs.discover_modified_scripts.outputs.versions_cpython_only != '[""]'
strategy:
fail-fast: false
matrix:
python-version: ${{fromJson(needs.discover_modified_scripts.outputs.versions_cpython_only)}}
os: ["macos-14", "macos-15", "macos-15-intel"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- run: |
#envvars
export PYENV_ROOT="$GITHUB_WORKSPACE"
echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV
echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH
- run: |
#prerequisites
brew install sqlite3 xz tcl-tk@8 libb2 zstd
"$GITHUB_WORKSPACE/.github/workflows/scripts/brew-uninstall-cascade.sh" openssl@3 openssl@1.1 readline
if [[ "${{ matrix.python-version }}" =~ pypy.*-(src|dev) ]]; then
export PYENV_BOOTSTRAP_VERSION=pypy2.7-7
echo "PYENV_BOOTSTRAP_VERSION=$PYENV_BOOTSTRAP_VERSION" >> $GITHUB_ENV
pyenv install $PYENV_BOOTSTRAP_VERSION
fi
- run: |
#build
pyenv --debug install ${{ matrix.python-version }} && rc=$? || rc=$?
if [[ $rc -ne 0 ]]; then echo config.log:; cat $TMPDIR/python-build*/*/config.log; false; fi
pyenv global ${{ matrix.python-version }}
- run: |
#print version
python --version
python -m pip --version
- env:
EXPECTED_PYTHON: ${{ matrix.python-version }}
run: |
#check
python -c '
import os, sys, os.path
correct_dir = os.path.join(
os.environ["PYENV_ROOT"],
"versions",
os.environ["EXPECTED_PYTHON"],
"bin")
assert os.path.dirname(sys.executable) == correct_dir'
ubuntu_build: ubuntu_build:
needs: discover_modified_scripts needs: discover_modified_scripts
if: needs.discover_modified_scripts.outputs.versions != '[""]' if: needs.discover_modified_scripts.outputs.versions != '[""]'
@ -90,10 +200,12 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
python-version: ${{fromJson(needs.discover_modified_scripts.outputs.versions)}} python-version: ${{fromJson(needs.discover_modified_scripts.outputs.versions)}}
os: ["ubuntu-20.04", "ubuntu-22.04"] os:
- ubuntu-22.04
- ubuntu-24.04
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
- run: | - run: |
#envvars #envvars
export PYENV_ROOT="$GITHUB_WORKSPACE" export PYENV_ROOT="$GITHUB_WORKSPACE"
@ -112,7 +224,8 @@ jobs:
fi fi
- run: | - run: |
#build #build
pyenv install -v ${{ matrix.python-version }} pyenv --debug install ${{ matrix.python-version }} && rc=$? || rc=$?
if [[ $rc -ne 0 ]]; then echo config.log:; cat $TMPDIR/python-build*/*/config.log; false; fi
pyenv global ${{ matrix.python-version }} pyenv global ${{ matrix.python-version }}
# Micropython doesn't support --version # Micropython doesn't support --version
- run: | - run: |
@ -141,3 +254,56 @@ jobs:
"bin") "bin")
assert os.path.dirname(sys.executable) == correct_dir' assert os.path.dirname(sys.executable) == correct_dir'
fi fi
# bundled executables in some Anaconda releases cause the post-run step to break
- run: |
pyenv global system
rm -f "$(pyenv root)"/shims/*
ubuntu_build_tar_gz:
needs: discover_modified_scripts
if: needs.discover_modified_scripts.outputs.versions_cpython_only != '[""]'
strategy:
fail-fast: false
matrix:
python-version: ${{fromJson(needs.discover_modified_scripts.outputs.versions_cpython_only)}}
os: ["ubuntu-latest"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- run: |
#envvars
export PYENV_ROOT="$GITHUB_WORKSPACE"
echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV
echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH
echo "_PYTHON_BUILD_FORCE_SKIP_XZ=1" >> $GITHUB_PATH
- run: |
#prerequisites
sudo apt-get update -q; sudo apt-get install -yq make build-essential \
libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \
curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev
if [[ "${{ matrix.python-version }}" =~ pypy.*-(src|dev) ]]; then
export PYENV_BOOTSTRAP_VERSION=pypy2.7-7
echo "PYENV_BOOTSTRAP_VERSION=$PYENV_BOOTSTRAP_VERSION" >> $GITHUB_ENV
pyenv install $PYENV_BOOTSTRAP_VERSION
fi
- run: |
#build
pyenv --debug install ${{ matrix.python-version }} && rc=$? || rc=$?
if [[ $rc -ne 0 ]]; then echo config.log:; cat $TMPDIR/python-build*/*/config.log; false; fi
pyenv global ${{ matrix.python-version }}
- run: |
#print version
python --version
python -m pip --version
- env:
EXPECTED_PYTHON: ${{ matrix.python-version }}
run: |
#check
python -c '
import os, sys, os.path
correct_dir = os.path.join(
os.environ["PYENV_ROOT"],
"versions",
os.environ["EXPECTED_PYTHON"],
"bin")
assert os.path.dirname(sys.executable) == correct_dir'

View File

@ -6,8 +6,8 @@ on:
issue_comment: issue_comment:
types: [created] types: [created]
schedule: schedule:
# Schedule for ten minutes after the hour, every hour # Schedule for ten minutes after the hour, every 2 hours
- cron: '10 * * * *' - cron: '10 */2 * * *'
permissions: {} permissions: {}
jobs: jobs:
@ -15,7 +15,7 @@ jobs:
permissions: permissions:
issues: write # to update issues (lee-dohm/no-response) issues: write # to update issues (lee-dohm/no-response)
runs-on: ubuntu-latest runs-on: ubuntu-slim
steps: steps:
- uses: lee-dohm/no-response@v0.5.0 - uses: lee-dohm/no-response@v0.5.0
with: with:

View File

@ -1,5 +1,8 @@
name: pyenv_tests name: pyenv_tests
on: [pull_request, push] on:
push:
branches: [master]
pull_request: {}
permissions: permissions:
contents: read # to fetch code (actions/checkout) contents: read # to fetch code (actions/checkout)
@ -11,28 +14,17 @@ jobs:
matrix: matrix:
os: os:
- ubuntu-22.04 - ubuntu-22.04
- ubuntu-20.04 - ubuntu-24.04
- macos-12 - macos-14
- macos-11 - macos-15
- macos-15-intel
- macos-26
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
# Normally, we would use the superbly maintained...
# - uses: actions/setup-python@v2
# with:
# python-version: ${{ matrix.python-version }}
# ... but in the repo, we want to test pyenv builds on Ubuntu
# - run: |
# sudo apt-get install -y build-essential libssl-dev zlib1g-dev libbz2-dev \
# libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
# xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
# https://github.com/pyenv/pyenv#installation
- run: | - run: |
if test "$RUNNER_OS" == "macOS"; then if test "$RUNNER_OS" == "macOS"; then
brew install coreutils fish brew install coreutils fish
elif [[ $(lsb_release -sr | awk -F. '{print $1}') -ge 20 ]]; then
# Ubuntu 18 has fish 2 which lacks many features that facilitate testing
sudo apt install fish -yq
fi fi
- run: pwd - run: pwd
- env: - env:
@ -40,8 +32,13 @@ jobs:
run: | run: |
echo $PYENV_ROOT echo $PYENV_ROOT
echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH
- run: | - name: Run test on the host
run: |
make test make test
- name: Run test with docker
if: ${{ ! contains(matrix.os, 'macos') }}
run: |
make test-docker
- env: - env:
PYENV_NATIVE_EXT: 1 PYENV_NATIVE_EXT: 1
run: | run: |

View File

@ -0,0 +1,11 @@
#!/bin/bash
declare -a packages rdepends
packages=("$@")
# have to try one by one, otherwise `brew uses` would only print
# packages that require them all rather than any of them
for package in "${packages[@]}"; do
rdepends+=($(brew uses --installed --include-build --include-test --include-optional --recursive "$package"))
done
brew uninstall "${packages[@]}" "${rdepends[@]}"

View File

@ -1,5 +1,8 @@
name: ubuntu_build name: ubuntu_build
on: [pull_request, push] on:
push:
branches: [master]
pull_request: {}
permissions: permissions:
contents: read # to fetch code (actions/checkout) contents: read # to fetch code (actions/checkout)
@ -10,19 +13,14 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
python-version: python-version:
- "3.8"
- "3.9"
- "3.10" - "3.10"
- "3.11" - "3.11"
- "3.12" - "3.12"
runs-on: ubuntu-22.04 - "3.13"
- "3.14"
runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
# Normally, we would use the superbly maintained...
# - uses: actions/setup-python@v2
# with:
# python-version: ${{ matrix.python-version }}
# ... but in the repo, we want to test pyenv builds on Ubuntu
- run: | - run: |
sudo apt-get update -q; sudo apt install -yq make build-essential libssl-dev zlib1g-dev \ sudo apt-get update -q; sudo apt install -yq make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev curl \ libbz2-dev libreadline-dev libsqlite3-dev curl \

4
.gitignore vendored
View File

@ -6,7 +6,9 @@
/libexec/*.dylib /libexec/*.dylib
/src/Makefile /src/Makefile
/src/*.o /src/*.o
/bats/ /bats
/bats-*/
/default-packages /default-packages
.idea .idea
*.un~ *.un~
*.swp

View File

@ -1,5 +1,363 @@
# Version History # Version History
## Release v2.8.1
* pyenv-binary: add the `generate-installer` subcommand by @macayu17 in https://github.com/pyenv/pyenv/pull/3488
* Add CPython 3.15.0b4 by @pyenv-bot[bot] in https://github.com/pyenv/pyenv/pull/3495
## Release v2.8.0
* CI: add_version enhancements by @native-api in https://github.com/pyenv/pyenv/pull/3480
* Add miniforge3-26.3.2-2, 26.3.2-3 by @native-api in https://github.com/pyenv/pyenv/pull/3481
* rehash: fix race condition in landlock writability check by @Sheile in https://github.com/pyenv/pyenv/pull/3483
* Add script to generate sponsors section for release notes by @macayu17 in https://github.com/pyenv/pyenv/pull/3478
* install: Add an ability to install a version under an alias by @macayu17 in https://github.com/pyenv/pyenv/pull/3484
* Add graalpy-3.12-25.1.3 by @msimacek in https://github.com/pyenv/pyenv/pull/3485
* Bump actions/checkout from 6 to 7 in the github-actions group by @dependabot[bot] in https://github.com/pyenv/pyenv/pull/3486
* Add an experimental pyenv-binary plugin with a save command by @macayu17 in https://github.com/pyenv/pyenv/pull/3487
* CI: dependabot: set cooldown by @orbisai0security in https://github.com/pyenv/pyenv/pull/3489
* Fix typos in docs, scripts, and tests by @maxtaran2010 in https://github.com/pyenv/pyenv/pull/3490
* Add miniconda3 26.5.3-1 by @native-api in https://github.com/pyenv/pyenv/pull/3491
* version-name: skip redundant checks by @native-api in https://github.com/pyenv/pyenv/pull/3492
## 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
* Add CPython 3.14.6 by @pyenv-bot[bot] in https://github.com/pyenv/pyenv/pull/3472
* Add CPython 3.13.14 by @pyenv-bot[bot] in https://github.com/pyenv/pyenv/pull/3473
## Release v2.7.1
* Support 3.9 EOL Pip URL, consolidate tests by @native-api in https://github.com/pyenv/pyenv/pull/3465
* Update URLs for PyPy nightly; Remove pypy3.5 and pypy3.7 nightly by @native-api in https://github.com/pyenv/pyenv/pull/3466
* Add CPython 3.15.0b2 by @pyenv-bot[bot] in https://github.com/pyenv/pyenv/pull/3467
* init: add --install for shell setup by @macayu17 in https://github.com/pyenv/pyenv/pull/3454
* realpath.c: fix obsolete syntax warning by @native-api in https://github.com/pyenv/pyenv/pull/3468
## Release v2.6.32
* Add miniconda3 26.3.2-2, miniforge3 26.3.2-0, 26.3.2-1 by @native-api in https://github.com/pyenv/pyenv/pull/3445
* miniforge3 26.1, 26.3, add_miniforge: exclude .pkg installers by @native-api in https://github.com/pyenv/pyenv/pull/3446
* miniforge 26, CI: switch check to 3.13 by @native-api in https://github.com/pyenv/pyenv/pull/3447
* 2.7, 3.4: force C99 standard; 2.7.14-18: force OpenSSL 1 formula by @native-api in https://github.com/pyenv/pyenv/pull/3448
* rehash: detect and remove a stale lockfile by @native-api in https://github.com/pyenv/pyenv/pull/3450
* Add GraalPy 25.0.3 by @msimacek in https://github.com/pyenv/pyenv/pull/3452
* 3.11.0+: Use the `--with-openssl-rpath' Configure option when possible by @native-api in https://github.com/pyenv/pyenv/pull/3458
* python_build: Make `verify_python` verify `pythonX.Y' suffix by @native-api in https://github.com/pyenv/pyenv/pull/3459
* Add micropython 1.22.0 to 1.28.0; add downstream patches to fix compilation errors by @native-api in https://github.com/pyenv/pyenv/pull/3460
* Fix linking against a keg_only Homebrew OpenSSL when a a non-keg_only one is also installed by @native-api in https://github.com/pyenv/pyenv/pull/3462
* Add missing CPython 3.14.2t by @native-api in https://github.com/pyenv/pyenv/pull/3464
* 3.14.0-5: Support building against OpenSSL 4 by @native-api in https://github.com/pyenv/pyenv/pull/3463
## Release v2.6.31
* CI: add_cpython: Support prereleases for non-initial CPython releases by @native-api in https://github.com/pyenv/pyenv/pull/3443
* Add CPython 3.14.5 by @pyenv-bot[bot] in https://github.com/pyenv/pyenv/pull/3444
## Release v2.6.30
* Add CPython 3.16-dev, switch 3.15-dev to maintenance branch by @nedbat in https://github.com/pyenv/pyenv/pull/3442
## Release v2.6.29
* Add PyPy v7.3.22 by @jsirois in https://github.com/pyenv/pyenv/pull/3438
* CI: Add timeouts to CPython release metadata fetches by @orbisai0security in https://github.com/pyenv/pyenv/pull/3439
* Add CPython 3.15.0b1 by @jsirois in https://github.com/pyenv/pyenv/pull/3440
* Add CPython 3.14.5rc1 by @native-api in https://github.com/pyenv/pyenv/pull/3441
## Release v2.6.28
* pyenv-latest: fast path for when there is an exact match by @native-api in https://github.com/pyenv/pyenv/pull/3437
## Release v2.6.27
* commands: fast path for --sh, replace sort|uniq with sort -u by @jakelodwick in https://github.com/pyenv/pyenv/pull/3423
* which: update the `pyenv help global` tip by @native-api in https://github.com/pyenv/pyenv/pull/3424
* Bump actions/create-github-app-token from 2 to 3 in the github-actions group by @dependabot[bot] in https://github.com/pyenv/pyenv/pull/3428
* python-build: advise user with no c compiler by @exurd in https://github.com/pyenv/pyenv/pull/3294
* Add CPython 3.13.13, 3.14.4, 3.15.0a8 by @pyenv-bot[bot] in https://github.com/pyenv/pyenv/pull/3432
* Add miniforge3 26.1.1-2, 26.1.1-3 by @native-api in https://github.com/pyenv/pyenv/pull/3433
## 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
* 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
## Release v2.6.20
* CI: adjust CPython PR generation logic by @native-api in https://github.com/pyenv/pyenv/pull/3392
* Add CPython 3.15.0a5 by @nedbat in https://github.com/pyenv/pyenv/pull/3393
## Release v2.6.19
* Add CPython 3.15.0a4 by @nedbat in https://github.com/pyenv/pyenv/pull/3390
## Release v2.6.18
* Fix an infinite loop if a shim is symlinked to and called from a different location with "system" version active by @native-api in https://github.com/pyenv/pyenv/pull/3375
* CI: Update and cleanup workflow scripts by @native-api in https://github.com/pyenv/pyenv/pull/3372
* Add PowerShell support by @fblanchetNaN in https://github.com/pyenv/pyenv/pull/2749
* rehash: support older BSD `mktemp` by @native-api in https://github.com/pyenv/pyenv/pull/3376
* rehash: report final lock acquisition error while silencing provisional ones; init: don't silence automatic rehash by @native-api in https://github.com/pyenv/pyenv/pull/3377
* pyenv launcher: introduce and export _PYENV_INSTALL_PREFIX by @rockandska in https://github.com/pyenv/pyenv/pull/3334
* README: Document how to change Python version in a shell spawned from a Python-based program (e.g. Jupyter) by @native-api in https://github.com/pyenv/pyenv/pull/3380
* Recognize an argument to -j in MAKEFLAGS when building extensions in 3.10-3.11 and latest 3.5-3.9 by @native-api in https://github.com/pyenv/pyenv/pull/3379
* CI: add a script to autogenerate CPython build scripts by @native-api in https://github.com/pyenv/pyenv/pull/3358
* Add miniconda3-25.11.1-1 by @binbjz in https://github.com/pyenv/pyenv/pull/3382
* CI: exclude unsupported MacOS-x64 for recent Miniconda versions by @binbjz in https://github.com/pyenv/pyenv/pull/3385
* Auto-accept TOS for miniconda3-25+ by @native-api in https://github.com/pyenv/pyenv/pull/3386
* Add anaconda-2025.12-1 by @native-api in https://github.com/pyenv/pyenv/pull/3387
* CI: automatically check for CPython releases and generate PRs by @native-api in https://github.com/pyenv/pyenv/pull/3388
## Release v2.6.17
* Add miniforge 25.9.1-0, 25.11.0-1 by @13steinj in https://github.com/pyenv/pyenv/pull/3371
* miniconda3-latest: auto accept TOS by @native-api in https://github.com/pyenv/pyenv/pull/3373
* Add CPython 3.15.0a3 by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/3374
## Release v2.6.16
* rehash: Fix hanging for 60 seconds when shims directory is not writable due to Linux Landlock by @native-api in https://github.com/pyenv/pyenv/pull/3367
* Add Miniconda3-25.9.1-3 by @binbjz in https://github.com/pyenv/pyenv/pull/3368
* sh-rehash: Fix erroneously executing rather than printing a command by @native-api in https://github.com/pyenv/pyenv/pull/3369
* Add CPython 3.13.11, 3.14.2 by @cesarcoatl in https://github.com/pyenv/pyenv/pull/3370
## Release v2.6.15
* Add CPython 3.13.10 by @jsirois in https://github.com/pyenv/pyenv/pull/3364
## Release v2.6.14
* CI: Bump actions/checkout from 5 to 6 in the github-actions group by @dependabot[bot] in https://github.com/pyenv/pyenv/pull/3360
* Fix "ld: symbol(s) not found" for C system calls in some MacOS versions if XCode is for a newer major MacOS version by @native-api in https://github.com/pyenv/pyenv/pull/3362
* Add CPython 3.14.1 by @nedbat in https://github.com/pyenv/pyenv/pull/3363
## Release v2.6.13
* CI: Replace macos-13 with macos-15-intel by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/3356
* Add Miniconda3-25.9.1-1 by @binbjz in https://github.com/pyenv/pyenv/pull/3357
* Add CPython 3.15.0a2 by @nedbat in https://github.com/pyenv/pyenv/pull/3359
## Release v2.6.12
* Add graalpy-25.0.1 by @msimacek in https://github.com/pyenv/pyenv/pull/3350
* Add CPython 3.9.25 by @nedbat in https://github.com/pyenv/pyenv/pull/3355
## Release v2.6.11
* Support building against Homebrew Tcl/Tk 9 by @native-api in https://github.com/pyenv/pyenv/pull/3343
* Add CPython 3.13.9 by @nedbat in https://github.com/pyenv/pyenv/pull/3346
* Add CPython 3.15.0a1 by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/3347
## 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
* Add CPython 3.14.0 by @SnoopJ in https://github.com/pyenv/pyenv/pull/3339
* Add CPython 3.13.8 by @jsirois in https://github.com/pyenv/pyenv/pull/3341
## Release v2.6.8
* Use Zlib from XCode SDK in a way compatible with XCode 16 and CLT by @JarheadStever in https://github.com/pyenv/pyenv/pull/3301
* Add miniforge 25.3.0-1, 25.3.0-2, 25.3.0-3, 25.3.1-0, skip miniforge 25.3.0-0 by @native-api in https://github.com/pyenv/pyenv/pull/3306
* Fix Readline and OpenSSL detection for MacPorts without the corresponding package by @native-api in https://github.com/pyenv/pyenv/pull/3317
* Bump actions/checkout from 4 to 5 in the github-actions group by @dependabot[bot] in https://github.com/pyenv/pyenv/pull/3318
* Fix rehash hook for pipx/pipx.x/pipx.xx by @rockandska in https://github.com/pyenv/pyenv/pull/3320
* Add miniconda 25.7.0-2 by @native-api in https://github.com/pyenv/pyenv/pull/3323
* Support curl from a snap by @native-api in https://github.com/pyenv/pyenv/pull/3329
* CI: Bats test suite in docker by @rockandska in https://github.com/pyenv/pyenv/pull/3324
* Add GraalPy 25.0.0 by @msimacek in https://github.com/pyenv/pyenv/pull/3331
* Upgrade pip detetcion in pip-rehash to accept multiple variations by @rockandska in https://github.com/pyenv/pyenv/pull/3330
* Add CPython 3.14.0rc3 by @nedbat in https://github.com/pyenv/pyenv/pull/3333
* Use TCLTK_* and pkg-config for 3.11+ linking with Homebrew Tcl/Tk; add PYTHON_BUILD_TCLTK_FORMULA envvar by @native-api in https://github.com/pyenv/pyenv/pull/3327
## Release v2.6.7
* Skip Zlib from XCode for XCode 16+ by @native-api in https://github.com/pyenv/pyenv/pull/3298
* Don't fail the build if `xcodebuild` fails by @native-api in https://github.com/pyenv/pyenv/pull/3302
* Add CPython 3.14.0rc2 and 3.13.7 by @nedbat in https://github.com/pyenv/pyenv/pull/3303
## Release v2.6.6
* Add anaconda3-2025.06-0, anaconda3-2025.06-1, miniconda3-25.3.1-1, miniconda3-25.5.1-0, miniconda3-25.5.1-1 by @native-api in https://github.com/pyenv/pyenv/pull/3295
* Add CPython 3.13.6 by @cesarcoatl in https://github.com/pyenv/pyenv/pull/3297
## Release v2.6.5
* Bump OpenSSL to 3.5.1 in the latest releases and branch tips in CPython 3.12 - 3.15 by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/3287
* Add Jython 2.7.4 by @cesarcoatl in https://github.com/pyenv/pyenv/pull/3290
* Add CPython 3.14.0rc1 by @nedbat in https://github.com/pyenv/pyenv/pull/3293
* Add GraalPy 24.2.2 by @msimacek in https://github.com/pyenv/pyenv/pull/3291
## Release v2.6.4
* Backport bpo_36106 to 3.5.10 and 3.6.15 by @native-api in https://github.com/pyenv/pyenv/pull/3280
* (regression) Use Zlib from XCode SDK in MacOS without Homebrew or Macports by @native-api in https://github.com/pyenv/pyenv/pull/3282
* Add PyPy v7.3.20 by @jsirois in https://github.com/pyenv/pyenv/pull/3284
* Add CPython 3.14.0b4 by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/3285
## Release v2.6.3
* README: Re-promote "Python versions with extended support" to a section by @native-api in https://github.com/pyenv/pyenv/pull/3276
* Support linking to MacPorts ports installed from binary archives by @0916dhkim in https://github.com/pyenv/pyenv/pull/3272
* Add CPython 3.14.0b3 by @nedbat in https://github.com/pyenv/pyenv/pull/3278
## Release v2.6.2
* Add CPython 3.13.5 by @nedbat in https://github.com/pyenv/pyenv/pull/3269
## Release v2.6.1
* Add CPython 3.9.23, 3.10.18, 3.11.13, 3.12.11, 3.13.4 by @nedbat in https://github.com/pyenv/pyenv/pull/3266
## Release v2.6.0
* python-build: Support patch paths with spaces/special characters by @native-api in https://github.com/pyenv/pyenv/pull/3251
* Add CODEOWNERS file by @native-api in https://github.com/pyenv/pyenv/pull/3247
* README: make fish PATH add conditional on the directory existing by @BooleanCat in https://github.com/pyenv/pyenv/pull/2786
* Add --bare option to `pyenv version` by @jjwatt in https://github.com/pyenv/pyenv/pull/2783
* README: Add shell setup instructions for nushell by @jordanst3wart in https://github.com/pyenv/pyenv/pull/2916
* Add MacPorts support for python-build by @studnitskiy in https://github.com/pyenv/pyenv/pull/3186
* python-build: fix `has_broken_mac_readline` when Readline is explicitly configured by @fofoni in https://github.com/pyenv/pyenv/pull/3254
* Add CPython 3.14.0b2 by @nedbat in https://github.com/pyenv/pyenv/pull/3259
## Release v2.5.7
* Point 3.14-dev to `3.14` branch by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/3246
## Release v2.5.6
* Add GraalPy 24.2.1 by @msimacek in https://github.com/pyenv/pyenv/pull/3238
* Fix get-pip URLs for 3.7, 3.8 and Pyston by @dmrlawson in https://github.com/pyenv/pyenv/pull/3242
* [CI] Cache `uname` and `sw_vers` output in Python-Build for easier mocking in tests by @native-api in https://github.com/pyenv/pyenv/pull/3244
* Add CPython 3.14.0b1 and 3.15-dev by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/3245
## Release v2.5.5
* Add graalpy 24.2 by @msimacek in https://github.com/pyenv/pyenv/pull/3215
* Switch 3.9+ to OpenSSL 3 by @native-api in https://github.com/pyenv/pyenv/pull/3223
* Add miniforge3-24.11.3-1, miniforge3-24.11.3-2, miniforge3-25.1.1 by @native-api in https://github.com/pyenv/pyenv/pull/3224
* Add CPython 3.9.22, 3.10.17, 3.11.12, 3.12.10, 3.13.3, 3.14.0a7 by @native-api in https://github.com/pyenv/pyenv/pull/3233
## Release v2.5.4
* Add anaconda3-2025.1.1-2 by @binbjz in https://github.com/pyenv/pyenv/pull/3198
* Add PyPy v7.3.19 by @jsirois in https://github.com/pyenv/pyenv/pull/3205
* Add CPython 3.14.0a6 by @nedbat in https://github.com/pyenv/pyenv/pull/3213
## Release v2.5.3
* Add PyPy v7.3.18 by @dand-oss in https://github.com/pyenv/pyenv/pull/3184
* Add Miniconda3 25.1.1-0 by @binbjz in https://github.com/pyenv/pyenv/pull/3190
* Add miniforge3-25.1.1-0, miniforge3-24.11.3-0 by @native-api in https://github.com/pyenv/pyenv/pull/3191
* Add CPython 3.14.0a5 by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/3194
* Add Miniconda3 25.1.1-1 by @binbjz in https://github.com/pyenv/pyenv/pull/3192
* Update hashes for Python 3.14.0a5 tarballs by @jsirois in https://github.com/pyenv/pyenv/pull/3196
* rehash: Do not execute conda-specific code if conda is not installed by @ChristianFredrikJohnsen in https://github.com/pyenv/pyenv/pull/3151
## Release v2.5.2
* Fix OpenSSL version parsing in python-build script by @threadflow in https://github.com/pyenv/pyenv/pull/3181
* Add GraalPy 24.1.2 by @msimacek in https://github.com/pyenv/pyenv/pull/3176
* Add CPython 3.12.9 and 3.13.2 by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/3183
## Release v2.5.1
* CI: use Ubuntu 24.04; use ubuntu-latest for the ubuntu_build check by @native-api in https://github.com/pyenv/pyenv/pull/3144
* Fix: mistake in configuration hints in `pyenv init` and manpage by @ChristianFredrikJohnsen in https://github.com/pyenv/pyenv/pull/3145
* README: Add recommended curl arguments to suggested installer invocation by @JayBazuzi in https://github.com/pyenv/pyenv/pull/3155
* Add miniforge3-24.11.2-0, miniforge3-24.11.2-1 by @native-api in https://github.com/pyenv/pyenv/pull/3163
* Fix "Unsupported options" error building bundled OpenSSL <3.2.0 by @native-api in https://github.com/pyenv/pyenv/pull/3164
* Add CPython 3.14.0a4 by @nedbat in https://github.com/pyenv/pyenv/pull/3168
## Release v2.5.0
* `pyenv init -` performance improvements; recommend using `pyenv init - <shell>` by @ChristianFredrikJohnsen in https://github.com/pyenv/pyenv/pull/3136
* Add miniconda3-24.11.1-0 by @binbjz in https://github.com/pyenv/pyenv/pull/3138
* Add miniconda3-24.3.0-0 by @native-api in https://github.com/pyenv/pyenv/pull/3139
* CI: only run macos_build_bundled_dependencies and ubuntu_build_tar_gz for CPython by @native-api in https://github.com/pyenv/pyenv/pull/3141
* Add miniforge3 and mambaforge3 24.1.2-0, 24.3.0-0, 24.5.0-0, 24.7.1-0, 24.7.1-1, 24.7.1-2, 24.9.0-0, 24.9.2-0, 24.11.0-0, 24.11.0-1 by @native-api in https://github.com/pyenv/pyenv/pull/3142
* Skip broken miniforge3/mambaforge3 22.11.0-0, 22.11.0-1, 22.11.0-2 in the generation script by @native-api in https://github.com/pyenv/pyenv/pull/3143
## Release v2.4.23
* README: explain using multiple versions by @Finkregh in https://github.com/pyenv/pyenv/pull/3126
* Support PACKAGE_CPPFLAGS and PACKAGE_LDFLAGS by @native-api in https://github.com/pyenv/pyenv/pull/3130
* Adjust suggested shell startup code to support Pyenv with Pyenv-Win in WSL by @native-api in https://github.com/pyenv/pyenv/pull/3132
* Support nonexistent versions being present and set in a local .python-version by @native-api in https://github.com/pyenv/pyenv/pull/3134
* Add CPython 3.14.0a3 by @nedbat in https://github.com/pyenv/pyenv/pull/3135
## Release v2.4.22
* Speed up building bundled OpenSSL by @native-api in https://github.com/pyenv/pyenv/pull/3124
* CI: add building modified scripts with bundled MacOS dependencies by @native-api in https://github.com/pyenv/pyenv/pull/3123
* CL: + test modified scripts with tar.gz source by @native-api in https://github.com/pyenv/pyenv/pull/3125
* Fix 404 for openssl-3.4.0 release in build 3.13.1 by @dlamblin in https://github.com/pyenv/pyenv/pull/3122
## Release v2.4.21
* Add CPython 3.13.1t by @makukha in https://github.com/pyenv/pyenv/pull/3120
* Prefer tcl-tk@8 from Homebrew due to release of Tcl/Tk 9 with which only 3.12+ are compatible by @native-api in https://github.com/pyenv/pyenv/pull/3118
## Release v2.4.20
* README: Fix Markdown in "Notes about python releases" by @noelleleigh in https://github.com/pyenv/pyenv/pull/3112
* README: correct link to shell setup instructions by @shortcuts in https://github.com/pyenv/pyenv/pull/3113
* Add CPython 3.9.21, 3.10.16, 3.11.11, 3.12.8 and 3.13.1 by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/3117
## Release v2.4.19
* Add CPython 3.14.0a2 by @nedbat in https://github.com/pyenv/pyenv/pull/3110
* Add quick start section and gif demo to accompany it. by @madhu-GG in https://github.com/pyenv/pyenv/pull/3044
## Release v2.4.18
* Add miniforge3-24.9.2-0 by @goerz in https://github.com/pyenv/pyenv/pull/3106
## Release v2.4.17
* Add miniconda3-24.9.2-0 by @binbjz in https://github.com/pyenv/pyenv/pull/3096
* Add Anaconda3-2024.10-1 by @binbjz in https://github.com/pyenv/pyenv/pull/3097
## Release v2.4.16
* Add GraalPy 24.1.1 by @msimacek in https://github.com/pyenv/pyenv/pull/3092
* Add CPython 3.14.0a1 by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/3093
## Release v2.4.15
* CI: replace set-output with GITHUB_OUTPUT by @tuzi3040 in https://github.com/pyenv/pyenv/pull/3079
* Make uninstall yes/no prompt consistent with others by @dpoznik in https://github.com/pyenv/pyenv/pull/3080
* Add CPython 3.13.0 by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/3081
* Avoid shadowing of virtualenvs with the name starting with "python-" by @aarbouin in https://github.com/pyenv/pyenv/pull/3086
* Support free-threaded CPython flavor in prefix resolution by @native-api in https://github.com/pyenv/pyenv/pull/3090
## Release v2.4.14
* Add CPython 3.12.7 by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/3078
* Add CPython 3.13.0rc3 by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/3077
## Release v2.4.13
* docs: Use `--verbose` with performance CPython build instructions by @caerulescens in https://github.com/pyenv/pyenv/pull/3053
* Fix latest version resolution when using `python-` prefix by @edmorley in https://github.com/pyenv/pyenv/pull/3056
* Fix tgz checksum for 3.9.20; fallback OpenSSL URLs and checksums by @native-api in https://github.com/pyenv/pyenv/pull/3060
* Fix OpenSSL 3.3.2 download URLs by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/3059
* Add GraalPy 24.1.0 by @msimacek in https://github.com/pyenv/pyenv/pull/3066
## Release v2.4.12
* Add CPython 3.13.0rc2 by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/3049
* Add CPython 3.8.20, 3.9.20, 3.10.15, 3.11.10 and 3.12.6 by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/3050
## Release v2.4.11
* Add /usr/etc/pyenv.d to hooks path by @tomschr in https://github.com/pyenv/pyenv/pull/3039
* Add miniconda3-24.7.1-0 by @binbjz in https://github.com/pyenv/pyenv/pull/3040
* Add PyPy v7.3.17 by @jsirois in https://github.com/pyenv/pyenv/pull/3045
## Release v2.4.10
* Add CPython 3.12.5 by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/3030
## Release v2.4.9
* Add miniforge3-24.3.0-0 by @goerz in https://github.com/pyenv/pyenv/pull/3028
* Add CPython 3.13.0rc1 by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/3029
## Release v2.4.8
* Fix pyenv-uninstall not having the debug tracing invocation by @native-api in https://github.com/pyenv/pyenv/pull/3020
* Add CPython 3.13.0b4 and 3.13.0b4t by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/3019
* README: Remove reference to Fig by @ThomasHaz in https://github.com/pyenv/pyenv/pull/3018
* Fix tests failing if plugins are installed by @native-api in https://github.com/pyenv/pyenv/pull/3022
* pyenv-latest: replace -q with -b and -f, document as internal by @native-api in https://github.com/pyenv/pyenv/pull/3021
## Release v2.4.7
* Add support for anaconda3-2024.06-1 by @binbjz in https://github.com/pyenv/pyenv/pull/3009
* Fix debug build for X.Yt-dev by @native-api in https://github.com/pyenv/pyenv/pull/
## 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 ## Release v2.4.5
* Add CPython 3.13.0b3 by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/2996 * Add CPython 3.13.0b3 by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/2996
@ -29,7 +387,7 @@
* Add CPython 3.13.0a4 by @saaketp in https://github.com/pyenv/pyenv/pull/2903 * Add CPython 3.13.0a4 by @saaketp in https://github.com/pyenv/pyenv/pull/2903
* Handle the case where `pyenv-commands --sh` returns nothing by @aphedges in https://github.com/pyenv/pyenv/pull/2908 * Handle the case where `pyenv-commands --sh` returns nothing by @aphedges in https://github.com/pyenv/pyenv/pull/2908
* Document default build configuration customizations by @native-api in https://github.com/pyenv/pyenv/pull/2911 * Document default build configuration customizations by @native-api in https://github.com/pyenv/pyenv/pull/2911
* Use Homebrew in Linux if Pyenv is installled with Homebrew by @native-api in https://github.com/pyenv/pyenv/pull/2906 * Use Homebrew in Linux if Pyenv is installed with Homebrew by @native-api in https://github.com/pyenv/pyenv/pull/2906
* Add miniforge and mambaforge 22.11.1-3, 22.11.1-4, 23.1.0-0 to 23.11.0-0 by @aphedges in https://github.com/pyenv/pyenv/pull/2909 * Add miniforge and mambaforge 22.11.1-3, 22.11.1-4, 23.1.0-0 to 23.11.0-0 by @aphedges in https://github.com/pyenv/pyenv/pull/2909
* Add miniconda3-24.1.2 by @binbjz in https://github.com/pyenv/pyenv/pull/2915 * Add miniconda3-24.1.2 by @binbjz in https://github.com/pyenv/pyenv/pull/2915
* Minor grammar fix in libffi backport patch in 2.5.x by @cuinix in https://github.com/pyenv/pyenv/pull/2922 * Minor grammar fix in libffi backport patch in 2.5.x by @cuinix in https://github.com/pyenv/pyenv/pull/2922
@ -1165,7 +1523,7 @@
* pyenv: Prefer gawk over awk if both are available. * pyenv: Prefer gawk over awk if both are available.
* python-build: Add new PyPy release; pypy-2.3, pypy-2.3-src (#162) * python-build: Add new PyPy release; pypy-2.3, pypy-2.3-src (#162)
* python-build: Add new Anaconda release; anaconda-1.9.2 (#155) * python-build: Add new Anaconda release; anaconda-1.9.2 (#155)
* python-build: Add new Miniconda releases; miniconda-3.3.0, minoconda-3.4.2, miniconda3-3.3.0, miniconda3-3.4.2 * python-build: Add new Miniconda releases; miniconda-3.3.0, miniconda-3.4.2, miniconda3-3.3.0, miniconda3-3.4.2
* python-build: Add new Stackless releases; stackless-2.7.3, stackless-2.7.4, stackless-2.7.5, stackless-2.7.6, stackless-3.2.5, stackless-3.3.5 (#164) * python-build: Add new Stackless releases; stackless-2.7.3, stackless-2.7.4, stackless-2.7.5, stackless-2.7.6, stackless-3.2.5, stackless-3.3.5 (#164)
* python-build: Add IronPython versions (setuptools and pip will work); ironpython-2.7.4, ironpython-dev * python-build: Add IronPython versions (setuptools and pip will work); ironpython-2.7.4, ironpython-dev
* python-build: Add new Jython beta release; jython-2.7-beta2 * python-build: Add new Jython beta release; jython-2.7-beta2

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
@ -91,12 +90,15 @@ or, if you prefer 3.3.3 over 2.7.6,
Python 3.3.3 Python 3.3.3
You can use the `-f/--force` flag to force setting versions even if some aren't installed.
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
@ -200,8 +202,8 @@ or, if you prefer 3.3.3 over 2.7.6,
Install a Python version (using [`python-build`](https://github.com/pyenv/pyenv/tree/master/plugins/python-build)). Install a Python version (using [`python-build`](https://github.com/pyenv/pyenv/tree/master/plugins/python-build)).
Usage: pyenv install [-f] [-kvp] <version> Usage: pyenv install [-f] [-kvp] <version>[:<alias>]
pyenv install [-f] [-kvp] <definition-file> pyenv install [-f] [-kvp] <definition-file>[:<alias>]
pyenv install -l|--list pyenv install -l|--list
-l/--list List all available versions -l/--list List all available versions
@ -232,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.
@ -239,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`
@ -268,8 +268,15 @@ version of Python, or install a package that provides binaries.
Displays the currently active Python version, along with information on Displays the currently active Python version, along with information on
how it was set. how it was set.
Usage: pyenv version [--bare]
--bare show just the version name. An alias to `pyenv version-name'
$ pyenv version $ pyenv version
2.7.6 (set by /home/yyuu/.pyenv/version) 2.7.6 (set by /home/yyuu/.pyenv/version)
$ pyenv version --bare
2.7.6
## `pyenv versions` ## `pyenv versions`
@ -341,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.
@ -387,11 +393,15 @@ List existing pyenv shims.
Configure the shell environment for pyenv Configure the shell environment for pyenv
Usage: eval "$(pyenv init [-|--path] [--no-push-path] [--no-rehash] [<shell>])" Usage: eval "$(pyenv init [-|--path] [--no-push-path] [--no-rehash] [<shell>])"
pyenv init --install [<shell>]
pyenv init --detect-shell [<shell>]
- Initialize shims directory, print PYENV_SHELL variable, completions path - Initialize shims directory, print PYENV_SHELL variable, completions path
and shell function and shell function
--path Print shims path --path Print shims path
--install Configure detected shell startup files
--no-push-path Do not push shim to the start of PATH if they're already there --no-push-path Do not push shim to the start of PATH if they're already there
--detect-shell Print shell startup files detected for the current shell
--no-rehash Add no rehash command to output --no-rehash Add no rehash command to output
## `pyenv completions` ## `pyenv completions`

View File

@ -13,12 +13,6 @@ General guidance
You can still add performance optimizations etc that take advantage of newer Bash features You can still add performance optimizations etc that take advantage of newer Bash features
as long as there is a fallback execution route for Bash 3. as long as there is a fallback execution route for Bash 3.
* Be extra careful when submitting logic specific for the Apple Silicon platform
As of this writing, Github Actions do not support it and only one team member has the necessary hardware.
So we may be unable to test your changes and may have to take your word for it.
Formatting PRs Formatting PRs
============== ==============

View File

@ -1,35 +0,0 @@
FROM ubuntu:18.04
LABEL maintainer="Chris L. Barnes <chrislloydbarnes@gmail.com>"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y \
&& apt-get install -y \
make \
build-essential \
libssl-dev \
zlib1g-dev \
libbz2-dev \
libreadline-dev \
libsqlite3-dev \
wget \
curl \
llvm \
libncurses5-dev \
libncursesw5-dev \
xz-utils \
tk-dev \
libffi-dev \
liblzma-dev \
python-openssl \
git \
&& rm -rf /var/lib/apt/lists/*
ENV PYENV_ROOT "/pyenv"
ENV PATH "$PYENV_ROOT/bin:$PATH"
COPY . /pyenv
RUN eval "$(pyenv init -)"

View File

@ -4,12 +4,22 @@ Creating a release
The release of the new version of Pyenv is done via GitHub Releases. The release of the new version of Pyenv is done via GitHub Releases.
Release checklist: Release checklist:
* Start [drafting a new release on GitHub](https://github.com/pyenv/pyenv/releases) to generate a summary of changes. Save the summary locally. * Start [drafting a new release on GitHub](https://github.com/pyenv/pyenv/releases) to generate a summary of changes.
Type the would-be tag name in the "Choose a tag" field and press "Generate release notes"
* The summary may need editing. E.g. rephrase entries, delete/merge entries that are too minor or irrelevant to the users (e.g. typo fixes, CI) * The summary may need editing. E.g. rephrase entries, delete/merge entries that are too minor or irrelevant to the users (e.g. typo fixes, CI)
* Push the version number in `libexec/pyenv---version` * Add a sponsors section to the release notes by running:
```bash
.github/scripts/generate_release_notes_sponsors.py
```
Paste the output at the end of the release notes.
* This lists new GitHub Sponsors and OpenCollective backers since the last release or within the last month, whichever is longer.
* The GitHub Sponsors query requires the `gh` CLI with the `read:user` scope.
* If OpenCollective is unavailable, pass `--skip-opencollective` and add those backers manually.
* Update `CHANGELOG.md` with the new version number and the edited summary (only the changes section)
* Push the version number in `libexec/pyenv---version` and `plugins/python-build/bin/python-build`
* Minor version is pushed if there are significant functional changes (not e.g. bugfixes/formula adaptations/supporting niche use cases). * Minor version is pushed if there are significant functional changes (not e.g. bugfixes/formula adaptations/supporting niche use cases).
* Major version is pushed if there are breaking changes * Major version is pushed if there are breaking changes
* Update `CHANGELOG.md` with the new version number and the edited summary (only the changes section), reformatting it like the rest of the changelog sections
* Commit the changes locally into `master` * Commit the changes locally into `master`
* Create a new tag with the new version number and push the changes including the tag * Create a new tag locally with the same name as specified in the new release window
* Create a new release on GitHub based on the tag, using the saved summary * Push the changes including the tag
* In the still open new release window, press "Publish release". The now-existing tag will be used.

141
Makefile
View File

@ -1,29 +1,136 @@
.PHONY: test test-build test-unit test-plugin TEST_BATS_VERSION = v1.10.0
TEST_BASH_VERSIONS = 3.2.57 4.1.17
TEST_UNIT_DOCKER_PREFIX = test-unit-docker
TEST_UNIT_DOCKER_TARGETS = $(foreach bash,$(TEST_BASH_VERSIONS),$(addsuffix -$(bash),$(TEST_UNIT_DOCKER_PREFIX)) $(addsuffix -gnu-$(bash),$(TEST_UNIT_DOCKER_PREFIX)))
TEST_PYTHON_BUILD_DOCKER_PREFIX = test-python-build-docker
TEST_PYTHON_BUILD_DOCKER_TARGETS = $(foreach bash,$(TEST_BASH_VERSIONS),$(addsuffix -$(bash),$(TEST_PYTHON_BUILD_DOCKER_PREFIX)) $(addsuffix -gnu-$(bash),$(TEST_PYTHON_BUILD_DOCKER_PREFIX)))
TEST_BINARY_DOCKER_PREFIX = test-binary-docker
TEST_BINARY_DOCKER_TARGETS = $(foreach bash,$(TEST_BASH_VERSIONS),$(addsuffix -$(bash),$(TEST_BINARY_DOCKER_PREFIX)) $(addsuffix -gnu-$(bash),$(TEST_BINARY_DOCKER_PREFIX)))
TEST_BATS_IMAGE_PREFIX = test-pyenv-docker-image
TEST_BATS_IMAGE_TARGETS = $(foreach bash,$(TEST_BASH_VERSIONS),$(addsuffix -$(bash),$(TEST_BATS_IMAGE_PREFIX)) $(addsuffix -gnu-$(bash),$(TEST_BATS_IMAGE_PREFIX)))
.PHONY: test-docker
test-docker: $(TEST_UNIT_DOCKER_PREFIX) $(TEST_PYTHON_BUILD_DOCKER_PREFIX) $(TEST_BINARY_DOCKER_PREFIX)
.PHONY: $(TEST_UNIT_DOCKER_PREFIX)
$(TEST_UNIT_DOCKER_PREFIX): $(TEST_UNIT_DOCKER_TARGETS)
# Run each unit test under bats docker
.PHONY: $(TEST_UNIT_DOCKER_TARGETS)
$(TEST_UNIT_DOCKER_TARGETS): DOCKER_IMAGE = $(TEST_BATS_IMAGE_PREFIX)
$(TEST_UNIT_DOCKER_TARGETS): GNU = $(if $(findstring -gnu-,$@),True,False)
$(TEST_UNIT_DOCKER_TARGETS): BASH = $(filter $(TEST_BASH_VERSIONS),$(subst -, ,$@))
$(TEST_UNIT_DOCKER_TARGETS): DOCKER_TAG = bash-$(BASH)-gnu-$(GNU)
$(TEST_UNIT_DOCKER_TARGETS): INTERACTIVE = $(if $(findstring true,$(CI)),,-ti)
$(TEST_UNIT_DOCKER_TARGETS): $(TEST_UNIT_DOCKER_PREFIX)-% : $(TEST_BATS_IMAGE_PREFIX)-%
$(info Running test with docker image '$(DOCKER_IMAGE):$(DOCKER_TAG)')
docker run \
--init \
-v $(PWD):/code:ro \
-v /etc/passwd:/etc/passwd:ro \
-v /etc/group:/etc/group:ro \
-u "$$(id -u $$(whoami)):$$(id -g $$(whoami))" \
$${BATS_TEST_FILTER:+-e BATS_TEST_FILTER="$${BATS_TEST_FILTER}"} \
$${BATS_FILE_FILTER:+-e BATS_FILE_FILTER="$${BATS_FILE_FILTER}"} \
$${CI+-e CI="$${CI}"} \
$(INTERACTIVE) \
$(DOCKER_IMAGE):$(DOCKER_TAG) \
test/run
.PHONY: $(TEST_PYTHON_BUILD_DOCKER_PREFIX)
$(TEST_PYTHON_BUILD_DOCKER_PREFIX): $(TEST_PYTHON_BUILD_DOCKER_TARGETS)
# Run each plugin test under bats docker
.PHONY: $(TEST_PYTHON_BUILD_DOCKER_TARGETS)
$(TEST_PYTHON_BUILD_DOCKER_TARGETS): DOCKER_IMAGE = $(TEST_BATS_IMAGE_PREFIX)
$(TEST_PYTHON_BUILD_DOCKER_TARGETS): GNU = $(if $(findstring -gnu-,$@),True,False)
$(TEST_PYTHON_BUILD_DOCKER_TARGETS): BASH = $(filter $(TEST_BASH_VERSIONS),$(subst -, ,$@))
$(TEST_PYTHON_BUILD_DOCKER_TARGETS): DOCKER_TAG = bash-$(BASH)-gnu-$(GNU)
$(TEST_PYTHON_BUILD_DOCKER_TARGETS): INTERACTIVE = $(if $(findstring true,$(CI)),,-ti)
$(TEST_PYTHON_BUILD_DOCKER_TARGETS): $(TEST_PYTHON_BUILD_DOCKER_PREFIX)-% : $(TEST_BATS_IMAGE_PREFIX)-%
$(info Running test with docker image '$(DOCKER_IMAGE):$(DOCKER_TAG)')
docker run \
--init \
-v $(PWD):/code:ro \
-v /etc/passwd:/etc/passwd:ro \
-v /etc/group:/etc/group:ro \
-u "$$(id -u $$(whoami)):$$(id -g $$(whoami))" \
$${CI+-e CI="$${CI}"} \
$(INTERACTIVE) \
$(DOCKER_IMAGE):$(DOCKER_TAG) \
bats $${BATS_TEST_FILTER:+--filter "$${BATS_TEST_FILTER}"} plugins/python-build/test/$${BATS_FILE_FILTER}
.PHONY: $(TEST_BINARY_DOCKER_PREFIX)
$(TEST_BINARY_DOCKER_PREFIX): $(TEST_BINARY_DOCKER_TARGETS)
.PHONY: $(TEST_BINARY_DOCKER_TARGETS)
$(TEST_BINARY_DOCKER_TARGETS): DOCKER_IMAGE = $(TEST_BATS_IMAGE_PREFIX)
$(TEST_BINARY_DOCKER_TARGETS): GNU = $(if $(findstring -gnu-,$@),True,False)
$(TEST_BINARY_DOCKER_TARGETS): BASH = $(filter $(TEST_BASH_VERSIONS),$(subst -, ,$@))
$(TEST_BINARY_DOCKER_TARGETS): DOCKER_TAG = bash-$(BASH)-gnu-$(GNU)
$(TEST_BINARY_DOCKER_TARGETS): INTERACTIVE = $(if $(findstring true,$(CI)),,-ti)
$(TEST_BINARY_DOCKER_TARGETS): $(TEST_BINARY_DOCKER_PREFIX)-% : $(TEST_BATS_IMAGE_PREFIX)-%
$(info Running test with docker image '$(DOCKER_IMAGE):$(DOCKER_TAG)')
docker run \
--init \
-v $(PWD):/code:ro \
-v /etc/passwd:/etc/passwd:ro \
-v /etc/group:/etc/group:ro \
-u "$$(id -u $$(whoami)):$$(id -g $$(whoami))" \
$${CI+-e CI="$${CI}"} \
$(INTERACTIVE) \
$(DOCKER_IMAGE):$(DOCKER_TAG) \
bats $${BATS_TEST_FILTER:+--filter "$${BATS_TEST_FILTER}"} plugins/pyenv-binary/test/$${BATS_FILE_FILTER}
# Build all images needed for bats under docker
.PHONY: $(TEST_BATS_IMAGE_PREFIX)
$(TEST_BATS_IMAGE_PREFIX): $(TEST_BATS_IMAGE_TARGETS)
# Build each image needed for bats under docker
.PHONY: $(TEST_BATS_IMAGE_TARGETS)
$(TEST_BATS_IMAGE_TARGETS): DOCKER_IMAGE = $(TEST_BATS_IMAGE_PREFIX)
$(TEST_BATS_IMAGE_TARGETS): GNU = $(if $(findstring -gnu-,$@),True,False)
$(TEST_BATS_IMAGE_TARGETS): BASH = $(filter $(TEST_BASH_VERSIONS),$(subst -, ,$@))
$(TEST_BATS_IMAGE_TARGETS): DOCKER_TAG = bash-$(BASH)-gnu-$(GNU)
$(TEST_BATS_IMAGE_TARGETS):
if [ -z "$$(docker images -q '$(DOCKER_IMAGE):$(DOCKER_TAG)')" ]]; then \
docker build \
--quiet \
-f "$(PWD)/test/Dockerfile" \
--build-arg GNU="$(GNU)" \
--build-arg BASH="$(BASH)" \
--build-arg BATS_VERSION="$(TEST_BATS_VERSION)" \
-t $(DOCKER_IMAGE):$(DOCKER_TAG) \
./ ; \
fi
.PHONY: test test-unit test-python-build test-binary
# Do not pass in user flags to build tests. # Do not pass in user flags to build tests.
unexport PYTHON_CFLAGS unexport PYTHON_CFLAGS
unexport PYTHON_CONFIGURE_OPTS unexport PYTHON_CONFIGURE_OPTS
test: test-unit test-plugin test: test-unit test-python-build test-binary
test-unit: bats test-unit: bats
PATH="./bats/bin:$$PATH" test/run PATH="./bats/bin:$$PATH" test/run
test-plugin: bats test-python-build: bats
cd plugins/python-build && $(PWD)/bats/bin/bats $${CI:+--tap} test cd plugins/python-build && $(PWD)/bats/bin/bats $${CI:+--tap} $${BATS_TEST_FILTER:+--filter "$${BATS_TEST_FILTER}"} test/$${BATS_FILE_FILTER}
PYTHON_BUILD_ROOT := $(CURDIR)/plugins/python-build test-binary: bats
PYTHON_BUILD_OPTS ?= --verbose cd plugins/pyenv-binary && $(PWD)/bats/bin/bats $${CI:+--tap} $${BATS_TEST_FILTER:+--filter "$${BATS_TEST_FILTER}"} test/$${BATS_FILE_FILTER}
PYTHON_BUILD_VERSION ?= 3.8-dev
PYTHON_BUILD_TEST_PREFIX ?= $(PYTHON_BUILD_ROOT)/test/build/tmp/dist
test-build: .SECONDARY: bats-$(TEST_BATS_VERSION)
$(RM) -r $(PYTHON_BUILD_TEST_PREFIX) bats-$(TEST_BATS_VERSION):
$(PYTHON_BUILD_ROOT)/bin/python-build $(PYTHON_BUILD_OPTS) $(PYTHON_BUILD_VERSION) $(PYTHON_BUILD_TEST_PREFIX) git clone --depth 1 --branch $(TEST_BATS_VERSION) https://github.com/bats-core/bats-core.git bats-$(TEST_BATS_VERSION)
[ -e $(PYTHON_BUILD_TEST_PREFIX)/bin/python ]
$(PYTHON_BUILD_TEST_PREFIX)/bin/python -V
[ -e $(PYTHON_BUILD_TEST_PREFIX)/bin/pip ]
$(PYTHON_BUILD_TEST_PREFIX)/bin/pip -V
bats: .PHONY: bats
git clone --depth 1 --branch v1.2.0 https://github.com/bats-core/bats-core.git bats bats: bats-$(TEST_BATS_VERSION)
if [ \( ! -L bats \) -o \( "x$$(readlink bats)" != "xbats-$(TEST_BATS_VERSION)" \) ]; then \
rm -rf bats; ln -s bats-$(TEST_BATS_VERSION) bats; \
fi

993
README.md

File diff suppressed because it is too large Load Diff

17
completions/pyenv.pwsh Normal file
View 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

BIN
install_local_python.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 KiB

View File

@ -76,25 +76,29 @@ export PYENV_DIR
shopt -s nullglob shopt -s nullglob
bin_path="$(abs_dirname "$0")" _PYENV_INSTALL_PREFIX="$(abs_dirname "$0")"
for plugin_bin in "${bin_path%/*}"/plugins/*/bin; do _PYENV_INSTALL_PREFIX="${_PYENV_INSTALL_PREFIX%/*}"
export _PYENV_INSTALL_PREFIX
for plugin_bin in "${_PYENV_INSTALL_PREFIX}"/plugins/*/bin; do
PATH="${plugin_bin}:${PATH}" PATH="${plugin_bin}:${PATH}"
done done
# PYENV_ROOT can be set to anything, so it may happen to be equal to the base path above, # PYENV_ROOT can be set to anything, so it may happen to be equal to the base path above,
# resulting in duplicate PATH entries # resulting in duplicate PATH entries
if [ "${bin_path%/*}" != "$PYENV_ROOT" ]; then if [ "${_PYENV_INSTALL_PREFIX}" != "$PYENV_ROOT" ]; then
for plugin_bin in "${PYENV_ROOT}"/plugins/*/bin; do for plugin_bin in "${PYENV_ROOT}"/plugins/*/bin; do
PATH="${plugin_bin}:${PATH}" PATH="${plugin_bin}:${PATH}"
done done
fi fi
export PATH="${bin_path}:${PATH}" export PATH="${_PYENV_INSTALL_PREFIX}/libexec:${PATH}"
PYENV_HOOK_PATH="${PYENV_HOOK_PATH}:${PYENV_ROOT}/pyenv.d" PYENV_HOOK_PATH="${PYENV_HOOK_PATH}:${PYENV_ROOT}/pyenv.d"
if [ "${bin_path%/*}" != "$PYENV_ROOT" ]; then if [ "${_PYENV_INSTALL_PREFIX}" != "$PYENV_ROOT" ]; then
# Add pyenv's own `pyenv.d` unless pyenv was cloned to PYENV_ROOT # Add pyenv's own `pyenv.d` unless pyenv was cloned to PYENV_ROOT
PYENV_HOOK_PATH="${PYENV_HOOK_PATH}:${bin_path%/*}/pyenv.d" PYENV_HOOK_PATH="${PYENV_HOOK_PATH}:${_PYENV_INSTALL_PREFIX}/pyenv.d"
fi fi
PYENV_HOOK_PATH="${PYENV_HOOK_PATH}:/usr/local/etc/pyenv.d:/etc/pyenv.d:/usr/lib/pyenv/hooks" PYENV_HOOK_PATH="${PYENV_HOOK_PATH}:/usr/etc/pyenv.d:/usr/local/etc/pyenv.d:/etc/pyenv.d:/usr/lib/pyenv/hooks"
for plugin_hook in "${PYENV_ROOT}/plugins/"*/etc/pyenv.d; do for plugin_hook in "${PYENV_ROOT}/plugins/"*/etc/pyenv.d; do
PYENV_HOOK_PATH="${PYENV_HOOK_PATH}:${plugin_hook}" PYENV_HOOK_PATH="${PYENV_HOOK_PATH}:${plugin_hook}"
done done

View File

@ -12,7 +12,7 @@
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
version="2.4.5" version="2.8.1"
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 done
elif [ -n "$nosh" ]; then else
if [ "${command:0:3}" != "sh-" ]; then for path in "${paths[@]}"; do
echo "${command##sh-}" for command in "${path}"/pyenv-*; do
command="${command##*/pyenv-}"
if [[ -n $nosh ]]; then
if [[ ${command:0:3} != "sh-" ]]; then
echo "$command"
fi fi
else else
echo "${command##sh-}" echo "${command##sh-}"
fi fi
done done
done done
} | sort | uniq fi
} | sort -u

View File

@ -21,7 +21,7 @@ if [ "$1" = "--complete" ]; then
exec pyenv-shims --short exec pyenv-shims --short
fi fi
PYENV_VERSION="$(pyenv-version-name)" PYENV_VERSION="$(pyenv-version-name -f)"
PYENV_COMMAND="$1" PYENV_COMMAND="$1"
if [ -z "$PYENV_COMMAND" ]; then if [ -z "$PYENV_COMMAND" ]; then
@ -29,10 +29,19 @@ if [ -z "$PYENV_COMMAND" ]; then
exit 1 exit 1
fi fi
export PYENV_VERSION if [[ -n $_PYENV_SHIM_PATH ]]; then
PROGRAM="$(echo "$PYENV_COMMAND" | tr a-z- A-Z_ | sed 's/[^A-Z0-9_]/_/g')"
NR_PYENV_SHIM_PATHS_PROGRAM="_PYENV_SHIM_PATHS_${PROGRAM}"
export -- "$NR_PYENV_SHIM_PATHS_PROGRAM=$_PYENV_SHIM_PATH${!NR_PYENV_SHIM_PATHS_PROGRAM:+:${!NR_PYENV_SHIM_PATHS_PROGRAM}}"
unset PROGRAM NR_PYENV_SHIM_PATHS_PROGRAM
unset _PYENV_SHIM_PATH
fi
PYENV_COMMAND_PATH="$(pyenv-which "$PYENV_COMMAND")" PYENV_COMMAND_PATH="$(pyenv-which "$PYENV_COMMAND")"
PYENV_BIN_PATH="${PYENV_COMMAND_PATH%/*}" PYENV_BIN_PATH="${PYENV_COMMAND_PATH%/*}"
export PYENV_VERSION
OLDIFS="$IFS" OLDIFS="$IFS"
IFS=$'\n' scripts=(`pyenv-hooks exec`) IFS=$'\n' scripts=(`pyenv-hooks exec`)
IFS="$OLDIFS" IFS="$OLDIFS"

View File

@ -36,12 +36,16 @@ if [ -n "$versions" ]; then
pyenv-version-file-write "$PYENV_VERSION_FILE" "${versions[@]}" pyenv-version-file-write "$PYENV_VERSION_FILE" "${versions[@]}"
else else
OLDIFS="$IFS" OLDIFS="$IFS"
# VAR=() of unquoted value does glob expansion (against the current dir's contents) after IFS-splitting
# which is undesired
set -f
IFS=: versions=($( IFS=: versions=($(
pyenv-version-file-read "$PYENV_VERSION_FILE" || pyenv-version-file-read "$PYENV_VERSION_FILE" ||
pyenv-version-file-read "${PYENV_ROOT}/global" || pyenv-version-file-read "${PYENV_ROOT}/global" ||
pyenv-version-file-read "${PYENV_ROOT}/default" || pyenv-version-file-read "${PYENV_ROOT}/default" ||
echo system echo system
)) ))
set +f
IFS="$OLDIFS" IFS="$OLDIFS"
for version in "${versions[@]}"; do for version in "${versions[@]}"; do
echo "$version" echo "$version"

View File

@ -1,6 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Summary: Configure the shell environment for pyenv # Summary: Configure the shell environment for pyenv
# Usage: eval "$(pyenv init [-|--path] [--no-push-path] [--detect-shell] [--no-rehash] [<shell>])" # Usage: eval "$(pyenv init [-|--path] [--no-push-path] [--no-rehash] [<shell>])"
# pyenv init --install [<shell>]
# pyenv init --detect-shell [<shell>]
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
@ -9,50 +11,54 @@ set -e
if [ "$1" = "--complete" ]; then if [ "$1" = "--complete" ]; then
echo - echo -
echo --path echo --path
echo --install
echo --no-push-path echo --no-push-path
echo --no-rehash echo --no-rehash
echo --detect-shell echo --detect-shell
echo bash echo bash
echo fish echo fish
echo ksh echo ksh
echo pwsh
echo zsh echo zsh
exit exit
fi fi
mode="help" mode="help"
no_rehash=""
no_push_path="" while [ "$#" -gt 0 ]; do
for args in "$@" case "$1" in
do -)
if [ "$args" = "-" ]; then
mode="print" mode="print"
shift ;;
fi --path)
if [ "$args" = "--path" ]; then
mode="path" mode="path"
shift ;;
fi --install)
mode="install"
if [ "$args" = "--detect-shell" ]; then ;;
--detect-shell)
mode="detect-shell" mode="detect-shell"
shift ;;
fi --no-push-path)
if [ "$args" = "--no-push-path" ]; then
no_push_path=1 no_push_path=1
shift ;;
fi --no-rehash)
if [ "$args" = "--no-rehash" ]; then
no_rehash=1 no_rehash=1
;;
*)
shell="$1"
;;
esac
shift shift
fi
done done
shell="$1" # If shell is not provided, detect it.
if [ -z "$shell" ]; then if [ -z "$shell" ]; then
shell="$(ps -p "$PPID" -o 'args=' 2>/dev/null || true)" if shell=$(tr '\0' ' ' 2>/dev/null </proc/"$PPID"/cmdline);then
:
else
shell=$(ps p "$PPID" -o 'args=' 2>/dev/null || true)
fi
shell="${shell%% *}" shell="${shell%% *}"
shell="${shell##-}" shell="${shell##-}"
shell="${shell:-$SHELL}" shell="${shell:-$SHELL}"
@ -60,8 +66,6 @@ if [ -z "$shell" ]; then
shell="${shell%%-*}" shell="${shell%%-*}"
fi fi
root="${0%/*}/.."
function main() { function main() {
case "$mode" in case "$mode" in
"help") "help")
@ -83,21 +87,23 @@ function main() {
exit 0 exit 0
;; ;;
"detect-shell") "detect-shell")
detect_profile 1 detect_profile
print_detect_shell print_detect_shell
exit 0 exit 0
;; ;;
"install")
install_shell_startup_files
exit 0
;;
esac esac
# should never get here # should never get here
exit 2 exit 2
} }
function detect_profile() { function detect_profile() {
local detect_for_detect_shell="$1"
case "$shell" in case "$shell" in
bash ) bash )
if [ -e '~/.bash_profile' ]; then if [ -e "${HOME}/.bash_profile" ]; then
profile='~/.bash_profile' profile='~/.bash_profile'
else else
profile='~/.profile' profile='~/.profile'
@ -105,6 +111,14 @@ function detect_profile() {
profile_explain="~/.bash_profile if it exists, otherwise ~/.profile" profile_explain="~/.bash_profile if it exists, otherwise ~/.profile"
rc='~/.bashrc' rc='~/.bashrc'
;; ;;
fish )
profile='~/.config/fish/config.fish'
rc='~/.config/fish/config.fish'
;;
pwsh )
profile='~/.config/powershell/profile.ps1'
rc='~/.config/powershell/profile.ps1'
;;
zsh ) zsh )
profile='~/.zprofile' profile='~/.zprofile'
rc='~/.zshrc' rc='~/.zshrc'
@ -119,13 +133,10 @@ function detect_profile() {
rc='~/.profile' rc='~/.profile'
;; ;;
* ) * )
if [ -n "$detect_for_detect_shell" ]; then
profile= profile=
rc= rc=
else profile_explain='your shell'\''s login startup file'
profile='your shell'\''s login startup file' rc_explain='your shell'\''s interactive startup file'
rc='your shell'\''s interactive startup file'
fi
;; ;;
esac esac
} }
@ -144,29 +155,32 @@ function help_() {
echo "# Add pyenv executable to PATH by running" echo "# Add pyenv executable to PATH by running"
echo "# the following interactively:" echo "# the following interactively:"
echo echo
echo 'set -Ux PYENV_ROOT $HOME/.pyenv' print_fish_user_path_setup
echo 'set -U fish_user_paths $PYENV_ROOT/bin $fish_user_paths'
echo echo
echo "# Load pyenv automatically by appending" echo "# Load pyenv automatically by appending"
echo "# the following to ~/.config/fish/config.fish:" echo "# the following to ~/.config/fish/config.fish:"
echo echo
echo 'pyenv init - | source' print_fish_shell_setup
echo echo
;; ;;
pwsh )
echo '# Load pyenv automatically by appending'
echo "# the following to $profile :"
echo
print_pwsh_shell_setup
;;
* ) * )
echo '# Load pyenv automatically by appending' echo '# Load pyenv automatically by appending'
echo -n "# the following to " echo -n "# the following to "
if [ "$profile" == "$rc" ]; then if [[ "$profile" == "$rc" && -z $rc_explain ]]; then
echo "$profile :" echo "${profile_explain:-$profile} :"
else else
echo echo
echo "# ${profile_explain:-$profile} (for login shells)" echo "# ${profile_explain:-$profile} (for login shells)"
echo "# and $rc (for interactive shells) :" echo "# and ${rc_explain:-$rc} (for interactive shells) :"
fi fi
echo echo
echo 'export PYENV_ROOT="$HOME/.pyenv"' print_posix_shell_setup
echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"'
echo 'eval "$(pyenv init -)"'
;; ;;
esac esac
echo echo
@ -175,6 +189,154 @@ function help_() {
} >&2 } >&2
} }
function print_posix_shell_setup() {
echo 'export PYENV_ROOT="$HOME/.pyenv"'
echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"'
echo 'eval "$(pyenv init - '$shell')"'
}
function print_fish_shell_setup() {
echo 'pyenv init - fish | source'
}
function print_fish_user_path_setup() {
echo 'set -Ux PYENV_ROOT $HOME/.pyenv'
echo 'if functions -q fish_add_path'
echo ' test -d $PYENV_ROOT/bin; and fish_add_path $PYENV_ROOT/bin'
echo 'else'
echo ' test -d $PYENV_ROOT/bin; and set -U fish_user_paths $PYENV_ROOT/bin $fish_user_paths'
echo 'end'
}
function print_pwsh_shell_setup() {
echo '$Env:PYENV_ROOT="$Env:HOME/.pyenv"'
echo 'if (Test-Path -LP "$Env:PYENV_ROOT/bin" -PathType Container) {'
echo ' $Env:PATH="$Env:PYENV_ROOT/bin:$Env:PATH" }'
echo 'iex ((pyenv init -) -join "`n")'
}
function expand_home_path() {
local path="$1"
printf '%s\n' "${path/#\~/$HOME}"
}
function install_shell_startup_files() {
if [[ -z $HOME ]]; then
echo "pyenv: HOME must be set to configure shell startup files" >&2
return 1
fi
detect_profile
local files=()
local lines=()
local profile_path rc_path setup
case "$shell" in
bash | zsh | ksh | ksh93 | mksh )
rc_path="$(expand_home_path "$rc")"
profile_path="$(expand_home_path "$profile")"
setup="$(print_posix_shell_setup)"
files=("$rc_path")
lines=("$setup")
if [[ $profile_path != "$rc_path" ]]; then
files+=("$profile_path")
lines+=("$setup")
fi
;;
fish )
rc_path="$(expand_home_path "$rc")"
files=("$rc_path")
lines=("$(print_fish_shell_setup)")
;;
pwsh )
rc_path="$(expand_home_path "$rc")"
files=("$rc_path")
lines=("$(print_pwsh_shell_setup)")
;;
* )
echo "pyenv: cannot automatically configure startup files for $shell" >&2
return 1
;;
esac
local index
for ((index = 0; index < ${#files[@]}; index++)); do
check_startup_file "${files[$index]}" || return 1
done
if [[ $shell == fish ]]; then
install_fish_user_paths || return 1
fi
for ((index = 0; index < ${#files[@]}; index++)); do
append_lines "${files[$index]}" "${lines[$index]}"
done
}
function check_startup_file() {
local file="$1"
local grep_status
if [[ ! -e $file ]]; then
return 0
fi
if [[ ! -f $file || ! -r $file ]]; then
echo "pyenv: failed to inspect $file" >&2
return 1
fi
if grep -Fi pyenv "$file" >/dev/null; then
echo "pyenv: cannot automatically apply changes to $file: it appears to already contain Pyenv-related code." >&2
echo "pyenv: review the file's contents and apply changes manually if necessary." >&2
echo "pyenv: run \`pyenv init $shell\` to see the suggested setup." >&2
return 1
else
grep_status=$?
if [[ $grep_status == 1 ]]; then
return 0
fi
echo "pyenv: failed to inspect $file" >&2
return "$grep_status"
fi
}
function install_fish_user_paths() {
local fish_setup
if ! command -v fish >/dev/null; then
echo "pyenv: fish is not available to configure fish universal variables" >&2
return 1
fi
fish_setup="$(print_fish_user_path_setup)"
if ! fish -c "$fish_setup"; then
echo "pyenv: failed to configure fish universal variables" >&2
return 1
fi
}
function append_lines() {
local file="$1"
local lines="$2"
local dir last_char
dir="${file%/*}"
if [[ $dir != "$file" ]]; then
mkdir -p "$dir"
fi
if [[ -s $file ]]; then
last_char="$(tail -c 1 "$file")" || return 1
if [[ -n $last_char ]]; then
echo >> "$file"
fi
fi
printf '%s\n' "$lines" >> "$file"
}
function init_dirs() { function init_dirs() {
mkdir -p "${PYENV_ROOT}/"{shims,versions} mkdir -p "${PYENV_ROOT}/"{shims,versions}
} }
@ -189,6 +351,11 @@ function print_path() {
print_path_prepend_shims print_path_prepend_shims
echo 'end' echo 'end'
;; ;;
pwsh )
echo 'if ( $Env:PATH -notmatch "'"${PYENV_ROOT}/shims"'" ) {'
print_path_prepend_shims
echo '}'
;;
* ) * )
echo 'if [[ ":$PATH:" != *'\':"${PYENV_ROOT}"/shims:\''* ]]; then' echo 'if [[ ":$PATH:" != *'\':"${PYENV_ROOT}"/shims:\''* ]]; then'
print_path_prepend_shims print_path_prepend_shims
@ -202,6 +369,10 @@ function print_path() {
echo 'set -eg PATH[$pyenv_index]; end; set -e pyenv_index' echo 'set -eg PATH[$pyenv_index]; end; set -e pyenv_index'
print_path_prepend_shims 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 # Some distros (notably Debian-based) set Bash's SSH_SOURCE_BASHRC compilation option
# that makes it source `bashrc` under SSH even when not interactive. # that makes it source `bashrc` under SSH even when not interactive.
@ -226,6 +397,9 @@ function print_path_prepend_shims() {
fish ) fish )
echo 'set -gx PATH '\'"${PYENV_ROOT}/shims"\'' $PATH' echo 'set -gx PATH '\'"${PYENV_ROOT}/shims"\'' $PATH'
;; ;;
pwsh )
echo '$Env:PATH="'"${PYENV_ROOT}"'/shims:$Env:PATH"'
;;
* ) * )
echo 'export PATH="'"${PYENV_ROOT}"'/shims:${PATH}"' echo 'export PATH="'"${PYENV_ROOT}"'/shims:${PATH}"'
;; ;;
@ -237,6 +411,9 @@ function print_env() {
fish ) fish )
echo "set -gx PYENV_SHELL $shell" echo "set -gx PYENV_SHELL $shell"
;; ;;
pwsh )
echo '$Env:PYENV_SHELL="'"$shell"'"'
;;
* ) * )
echo "export PYENV_SHELL=$shell" echo "export PYENV_SHELL=$shell"
;; ;;
@ -244,15 +421,29 @@ function print_env() {
} }
function print_completion() { function print_completion() {
completion="${root}/completions/pyenv.${shell}" completion="${_PYENV_INSTALL_PREFIX}/completions/pyenv.${shell}"
if [ -r "$completion" ]; then if [ -r "$completion" ]; then
case "$shell" in
pwsh )
echo "iex (gc $completion -Raw)"
;;
* )
echo "source '$completion'" echo "source '$completion'"
;;
esac
fi fi
} }
function print_rehash() { function print_rehash() {
if [ -z "$no_rehash" ]; then if [ -z "$no_rehash" ]; then
echo 'command pyenv rehash 2>/dev/null' case "$shell" in
pwsh )
echo '& pyenv rehash'
;;
* )
echo 'command pyenv rehash'
;;
esac
fi fi
} }
@ -260,52 +451,63 @@ function print_shell_function() {
commands=(`pyenv-commands --sh`) commands=(`pyenv-commands --sh`)
case "$shell" in case "$shell" in
fish ) fish )
cat <<EOS echo \
function pyenv 'function pyenv
set command \$argv[1] set command $argv[1]
set -e argv[1] set -e argv[1]
switch "\$command" switch "$command"
case ${commands[*]} case '"${commands[*]}"'
source (pyenv "sh-\$command" \$argv|psub) source (pyenv "sh-$command" $argv|psub)
case '*' case "*"
command pyenv "\$command" \$argv command pyenv "$command" $argv
end end
end end'
;;
pwsh )
cat <<EOS
function pyenv {
\$command=""
if ( \$args.Count -gt 0 ) {
\$command, \$args = \$args
}
if ( ("${commands[*]}" -split ' ') -contains \$command ) {
\$shell_cmds = (& (get-command -commandtype application pyenv) sh-\$command \$args)
if ( \$shell_cmds.Count -gt 0 ) {
iex (\$shell_cmds -join "\`n")
}
} else {
& (get-command -commandtype application pyenv) \$command \$args
}
}
EOS EOS
;; ;;
ksh | ksh93 | mksh ) ksh | ksh93 | mksh )
cat <<EOS echo \
function pyenv { 'function pyenv {
typeset command typeset command=${1:-}'
EOS
;; ;;
* ) * )
cat <<EOS echo \
pyenv() { 'pyenv() {
local command local command=${1:-}'
EOS
;; ;;
esac esac
if [ "$shell" != "fish" ]; then if [ "$shell" != "fish" ] && [ "$shell" != "pwsh" ]; then
IFS="|" IFS="|"
cat <<EOS echo \
command="\${1:-}" ' [ "$#" -gt 0 ] && shift
if [ "\$#" -gt 0 ]; then case "$command" in
shift '"${commands[*]:-/}"')
fi eval "$(pyenv "sh-$command" "$@")"
case "\$command" in
${commands[*]:-/})
eval "\$(pyenv "sh-\$command" "\$@")"
;; ;;
*) *)
command pyenv "\$command" "\$@" command pyenv "$command" "$@"
;; ;;
esac esac
} }'
EOS
fi fi
} }

View File

@ -1,13 +1,16 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Summary: Print the latest installed or known version with the given prefix # Summary: Print 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 # -b/--bypass (internal) On a resolution failure, do not print an error message
# but rather print the argument unchanged
# -f/--force (internal) Same as -b but also do not return a failure exit code
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
while [[ $# -gt 0 ]] while [[ $# -gt 0 ]]
do do
case "$1" in case "$1" in
@ -15,8 +18,13 @@ do
FROM_KNOWN=1 FROM_KNOWN=1
shift shift
;; ;;
-q|--quiet) -b|--bypass)
QUIET=1 BYPASS=1
shift
;;
-f|--force)
FORCE=1
BYPASS=1
shift shift
;; ;;
*) *)
@ -31,6 +39,10 @@ exitcode=0
IFS=$'\n' IFS=$'\n'
if [[ -z $FROM_KNOWN ]]; then if [[ -z $FROM_KNOWN ]]; then
if [[ -d $PYENV_ROOT/versions/$prefix ]]; then
echo "$prefix"
exit $exitcode;
fi
DEFINITION_CANDIDATES=( $(pyenv-versions --bare --skip-envs) ) DEFINITION_CANDIDATES=( $(pyenv-versions --bare --skip-envs) )
else else
DEFINITION_CANDIDATES=( $(python-build --definitions ) ) DEFINITION_CANDIDATES=( $(python-build --definitions ) )
@ -41,16 +53,25 @@ IFS=$'\n'
exit $exitcode; exit $exitcode;
fi fi
suffix=""
if [[ $prefix =~ ^(.*[0-9])t$ ]]; then
suffix="t"
prefix="${BASH_REMATCH[1]}"
fi
# https://stackoverflow.com/questions/11856054/is-there-an-easy-way-to-pass-a-raw-string-to-grep/63483807#63483807 # https://stackoverflow.com/questions/11856054/is-there-an-easy-way-to-pass-a-raw-string-to-grep/63483807#63483807
prefix_re="$(sed 's/[^\^]/[&]/g;s/[\^]/\\&/g' <<< "$prefix")" prefix_re="$(sed 's/[^\^]/[&]/g;s/[\^]/\\&/g' <<< "$prefix")"
suffix_re="$(sed 's/[^\^]/[&]/g;s/[\^]/\\&/g' <<< "$suffix")"
# FIXME: more reliable and readable would probably be to loop over them and transform in pure Bash # FIXME: more reliable and readable would probably be to loop over them and transform in pure Bash
DEFINITION_CANDIDATES=(\ DEFINITION_CANDIDATES=(\
$(printf '%s\n' "${DEFINITION_CANDIDATES[@]}" | \ $(printf '%s\n' "${DEFINITION_CANDIDATES[@]}" | \
grep -Ee "^$prefix_re[-.]" || true)) grep -Ee "^$prefix_re[-.].*$suffix_re\$" || true))
DEFINITION_CANDIDATES=(\ DEFINITION_CANDIDATES=(\
$(printf '%s\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' \
$(if [[ -z $suffix ]]; then echo "-e /[0-9]t\$/d"; fi)
));
# Compose a sorting key, followed by | and original value # Compose a sorting key, followed by | and original value
DEFINITION_CANDIDATES=(\ DEFINITION_CANDIDATES=(\
@ -71,10 +92,14 @@ IFS=$'\n'
if [[ -n "$DEFINITION" ]]; then if [[ -n "$DEFINITION" ]]; then
echo "$DEFINITION" echo "$DEFINITION"
else else
if [[ -z $QUIET ]]; then if [[ -z $BYPASS ]]; then
echo "pyenv: no $([[ -z $FROM_KNOWN ]] && echo installed || echo known) versions match the prefix \`$prefix'" >&2 echo "pyenv: no $([[ -z $FROM_KNOWN ]] && echo installed || echo known) versions match the prefix \`$prefix'" >&2
else
echo "$prefix"
fi fi
if [[ -z $FORCE ]]; then
exitcode=1 exitcode=1
fi fi
fi
exit $exitcode exit $exitcode

View File

@ -2,9 +2,11 @@
# #
# Summary: Set or show the local application-specific Python version(s) # Summary: Set or show the local application-specific Python version(s)
# #
# Usage: pyenv local <version> <version2> <..> # Usage: pyenv local [-f|--force] [<version> [...]]
# pyenv local --unset # pyenv local --unset
# #
# -f/--force Do not verify that the versions being set exist
#
# Sets the local application-specific Python version(s) by writing the # Sets the local application-specific Python version(s) by writing the
# version name to a file named `.python-version'. # version name to a file named `.python-version'.
# #
@ -36,15 +38,32 @@ if [ "$1" = "--complete" ]; then
exec pyenv-versions --bare exec pyenv-versions --bare
fi fi
while [[ $# -gt 0 ]]
do
case "$1" in
-f|--force)
FORCE=1
shift
;;
*)
break
;;
esac
done
versions=("$@") versions=("$@")
if [ "$versions" = "--unset" ]; then if [ "$versions" = "--unset" ]; then
rm -f .python-version rm -f .python-version
elif [ -n "$versions" ]; then elif [ -n "$versions" ]; then
pyenv-version-file-write .python-version "${versions[@]}" pyenv-version-file-write ${FORCE:+-f }.python-version "${versions[@]}"
else else
if version_file="$(pyenv-version-file "$PWD")"; then if version_file="$(pyenv-version-file "$PWD")"; then
# VAR=() of unquoted value does glob expansion (against the current dir's contents) after IFS-splitting
# which is undesired
set -f
IFS=: versions=($(pyenv-version-file-read "$version_file")) IFS=: versions=($(pyenv-version-file-read "$version_file"))
set +f
for version in "${versions[@]}"; do for version in "${versions[@]}"; do
echo "$version" echo "$version"
done done

View File

@ -28,11 +28,14 @@ fi
PYENV_PREFIX_PATHS=() PYENV_PREFIX_PATHS=()
OLDIFS="$IFS" OLDIFS="$IFS"
{ IFS=: { IFS=:
# Unquoted $VAR does glob expansion (against the current dir's contents) after IFS-splitting
# which is undesired
set -f
for version in ${PYENV_VERSION}; do for version in ${PYENV_VERSION}; do
if [ "$version" = "system" ]; then if [ "$version" = "system" ]; then
if PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python 2>/dev/null)" || \ if PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python --skip-advice 2>/dev/null)" || \
PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python3 2>/dev/null)" || \ PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python3 --skip-advice 2>/dev/null)" || \
PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python2 2>/dev/null)"; then PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python2 --skip-advice 2>/dev/null)"; then
shopt -s extglob shopt -s extglob
# In some distros (Arch), Python can be found in sbin as well as bin # In some distros (Arch), Python can be found in sbin as well as bin
PYENV_PREFIX_PATH="${PYTHON_PATH%/?(s)bin/*}" PYENV_PREFIX_PATH="${PYTHON_PATH%/?(s)bin/*}"
@ -42,7 +45,7 @@ OLDIFS="$IFS"
exit 1 exit 1
fi fi
else else
version="$(pyenv-latest -q "$version" || echo "$version")" version="$(pyenv-latest -f "$version")"
PYENV_PREFIX_PATH="${PYENV_ROOT}/versions/${version}" PYENV_PREFIX_PATH="${PYENV_ROOT}/versions/${version}"
fi fi
if [ -d "$PYENV_PREFIX_PATH" ]; then if [ -d "$PYENV_PREFIX_PATH" ]; then
@ -52,6 +55,7 @@ OLDIFS="$IFS"
exit 1 exit 1
fi fi
done done
set +f
} }
IFS="$OLDIFS" IFS="$OLDIFS"

View File

@ -2,7 +2,7 @@
# Summary: Rehash pyenv shims (run this after installing executables) # Summary: Rehash pyenv shims (run this after installing executables)
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [[ -n "$PYENV_DEBUG" ]] && set -x
SHIM_PATH="${PYENV_ROOT}/shims" SHIM_PATH="${PYENV_ROOT}/shims"
PROTOTYPE_SHIM_PATH="${SHIM_PATH}/.pyenv-shim" PROTOTYPE_SHIM_PATH="${SHIM_PATH}/.pyenv-shim"
@ -10,21 +10,37 @@ PROTOTYPE_SHIM_PATH="${SHIM_PATH}/.pyenv-shim"
# Create the shims directory if it doesn't already exist. # Create the shims directory if it doesn't already exist.
mkdir -p "$SHIM_PATH" mkdir -p "$SHIM_PATH"
acquire_lock() { declare last_acquire_error
# Ensure only one instance of pyenv-rehash is running at a time by
# setting the shell's `noclobber` option and attempting to write to
# the prototype shim file. If the file already exists, print a warning
# to stderr and exit with a non-zero status.
local ret
set -o noclobber
echo > "$PROTOTYPE_SHIM_PATH" 2>| /dev/null || ret=1
set +o noclobber
[ -z "${ret}" ]
}
# If we were able to obtain a lock, register a trap to clean up the acquire_lock() {
# prototype shim when the process exits. local ret
trap release_lock EXIT # An old lock file is presumed stale. We assume no healthy rehash takes this long.
# The time is picked very small so that a killed rehash holds up new shell sessions
# for as little as possible
find "$PROTOTYPE_SHIM_PATH" -mmin +2 -exec rm -f {} \; 2>/dev/null || true
set -o noclobber
last_acquire_error="$( { ( echo -n > "$PROTOTYPE_SHIM_PATH"; ) 2>&1 1>&3 3>&1-; } 3>&1)" \
&& trap release_lock EXIT \
|| {
# Linux Landlock and MacOS Seatbelt sandbox subsystems return false information in access(),
# making -w "$SHIM_PATH" not catch the fact that the shims dir is not writable in this case.
# Bash doesn't provide access to errno to check for non-EEXIST error code in `echo >'.
# So check for writablity by trying to write to a different file,
# in a way that taxes the usual use case as little as possible.
if [[ -z $tested_for_other_write_errors ]]; then
# if lots of (50+) rehashes run concurrently, another concurrent rehash
# may delete the temporary file in remove_*_shims() before we do so
( t="$(TMPDIR="$SHIM_PATH" mktemp)" && rm -f "$t" ) \
&& tested_for_other_write_errors=1 \
|| { echo "pyenv: cannot rehash: $SHIM_PATH isn't writable" >&2
set +o noclobber
exit 1; }
fi
ret=1
}
set +o noclobber
[[ -z "${ret}" ]]
}
remove_prototype_shim() { remove_prototype_shim() {
rm -f "$PROTOTYPE_SHIM_PATH" rm -f "$PROTOTYPE_SHIM_PATH"
@ -32,17 +48,19 @@ remove_prototype_shim() {
release_lock() { release_lock() {
remove_prototype_shim remove_prototype_shim
trap - EXIT
} }
if [ ! -w "$SHIM_PATH" ]; then if [ ! -w "$SHIM_PATH" ]; then
echo "pyenv: cannot rehash: $SHIM_PATH isn't writable" echo "pyenv: cannot rehash: $SHIM_PATH isn't writable" >&2
exit 1 exit 1
fi fi
unset acquired declare acquired tested_for_other_write_errors
start=$SECONDS declare start=$SECONDS
while (( SECONDS <= start + ${PYENV_REHASH_TIMEOUT:-60} )); do PYENV_REHASH_TIMEOUT=${PYENV_REHASH_TIMEOUT:-60}
if acquire_lock 2>/dev/null; then while (( SECONDS <= start + PYENV_REHASH_TIMEOUT )); do
if acquire_lock; then
acquired=1 acquired=1
break break
else else
@ -52,9 +70,14 @@ while (( SECONDS <= start + ${PYENV_REHASH_TIMEOUT:-60} )); do
done done
if [ -z "${acquired}" ]; then if [ -z "${acquired}" ]; then
echo "pyenv: cannot rehash: $PROTOTYPE_SHIM_PATH exists" if [[ -n $tested_for_other_write_errors ]]; then
echo "pyenv: cannot rehash: couldn't acquire lock"\
"$PROTOTYPE_SHIM_PATH for $PYENV_REHASH_TIMEOUT seconds. Last error message:" >&2
echo "$last_acquire_error" >&2
fi
exit 1 exit 1
fi fi
unset tested_for_other_write_errors
# The prototype shim file is a script that re-execs itself, passing # The prototype shim file is a script that re-execs itself, passing
# its filename and any arguments to `pyenv exec`. This file is # its filename and any arguments to `pyenv exec`. This file is
@ -70,6 +93,10 @@ set -e
program="\${0##*/}" program="\${0##*/}"
export PYENV_ROOT="$PYENV_ROOT" export PYENV_ROOT="$PYENV_ROOT"
SHIM_PATH=\${0%/*}
if [[ \$SHIM_PATH != "$PYENV_ROOT/shims" ]]; then
export _PYENV_SHIM_PATH="\$SHIM_PATH"
fi
exec "$(command -v pyenv)" exec "\$program" "\$@" exec "$(command -v pyenv)" exec "\$program" "\$@"
SH SH
chmod +x "$PROTOTYPE_SHIM_PATH" chmod +x "$PROTOTYPE_SHIM_PATH"
@ -88,17 +115,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.
@ -174,7 +190,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

@ -11,11 +11,17 @@ shell="$(basename "${PYENV_SHELL:-$SHELL}")"
# When pyenv shell integration is enabled, delegate to pyenv-rehash, # When pyenv shell integration is enabled, delegate to pyenv-rehash,
# then tell the shell to empty its command lookup cache. # then tell the shell to empty its command lookup cache.
pyenv-rehash case "$shell" in
pwsh)
echo "& (get-command pyenv -commandtype application) rehash"
;;
*)
echo "command pyenv rehash"
esac
case "$shell" in case "$shell" in
fish ) fish | pwsh )
# no rehash support # no executable cache
;; ;;
* ) * )
echo "hash -r 2>/dev/null || true" echo "hash -r 2>/dev/null || true"

View File

@ -48,6 +48,9 @@ if [ "$versions" = "--unset" ]; then
echo 'set -gu PYENV_VERSION_OLD "$PYENV_VERSION"' echo 'set -gu PYENV_VERSION_OLD "$PYENV_VERSION"'
echo "set -e 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 'PYENV_VERSION_OLD="${PYENV_VERSION-}"'
echo "unset PYENV_VERSION" echo "unset PYENV_VERSION"
@ -74,6 +77,16 @@ else
echo "pyenv: PYENV_VERSION_OLD is not set" >&2 echo "pyenv: PYENV_VERSION_OLD is not set" >&2
false false
end 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 EOS
;; ;;
* ) * )
@ -109,6 +122,9 @@ if pyenv-prefix "${versions[@]}" >/dev/null; then
echo 'set -gu PYENV_VERSION_OLD "$PYENV_VERSION"' echo 'set -gu PYENV_VERSION_OLD "$PYENV_VERSION"'
echo "set -gx PYENV_VERSION \"$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 'PYENV_VERSION_OLD="${PYENV_VERSION-}"'
echo "export PYENV_VERSION=\"${version}\"" echo "export PYENV_VERSION=\"${version}\""

View File

@ -1,20 +1,40 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Summary: Show the current Python version(s) and its origin # Summary: Show the current Python version(s) and its origin
# Usage: pyenv version [--bare]
# #
# Shows the currently selected Python version(s) and how it was # --bare show just the version name. An alias to `pyenv version-name'
# selected. To obtain only the version string, use `pyenv
# version-name'.
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
exitcode=0 exitcode=0
OLDIFS="$IFS" OLDIFS="$IFS"
# VAR=() of unquoted value does glob expansion (against the current dir's contents) after IFS-splitting
# which is undesired
set -f
IFS=: PYENV_VERSION_NAMES=($(pyenv-version-name)) || exitcode=$? IFS=: PYENV_VERSION_NAMES=($(pyenv-version-name)) || exitcode=$?
set +f
IFS="$OLDIFS" IFS="$OLDIFS"
unset bare
for arg; do
case "$arg" in
--complete )
echo --bare
exit ;;
--bare ) bare=1 ;;
* )
pyenv-help --usage version >&2
exit 1
;;
esac
done
for PYENV_VERSION_NAME in "${PYENV_VERSION_NAMES[@]}"; do for PYENV_VERSION_NAME in "${PYENV_VERSION_NAMES[@]}"; do
if [[ -n $bare ]]; then
echo "$PYENV_VERSION_NAME"
else
echo "$PYENV_VERSION_NAME (set by $(pyenv-version-origin))" echo "$PYENV_VERSION_NAME (set by $(pyenv-version-origin))"
fi
done done
exit $exitcode exit $exitcode

View File

@ -1,9 +1,25 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Usage: pyenv version-file-write <file> <version> # Usage: pyenv version-file-write [-f|--force] <file> <version> [...]
#
# -f/--force Don't verify that the versions exist
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
while [[ $# -gt 0 ]]
do
case "$1" in
-f|--force)
FORCE=1
shift
;;
*)
break
;;
esac
done
PYENV_VERSION_FILE="$1" PYENV_VERSION_FILE="$1"
shift || true shift || true
versions=("$@") versions=("$@")
@ -14,7 +30,7 @@ if [ -z "$versions" ] || [ -z "$PYENV_VERSION_FILE" ]; then
fi fi
# Make sure the specified version is installed. # Make sure the specified version is installed.
pyenv-prefix "${versions[@]}" >/dev/null [[ -z $FORCE ]] && pyenv-prefix "${versions[@]}" >/dev/null
# Write the version out to disk. # Write the version out to disk.
# Create an empty file. Using "rm" might cause a permission error. # Create an empty file. Using "rm" might cause a permission error.

View File

@ -1,8 +1,25 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Summary: Show the current Python version # Summary: Show the current Python version
#
# -f/--force (Internal) If a version doesn't exist, print it as is rather than produce an error
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
while [[ $# -gt 0 ]]
do
case "$1" in
-f|--force)
FORCE=1
shift
;;
*)
break
;;
esac
done
if [ -z "$PYENV_VERSION" ]; then if [ -z "$PYENV_VERSION" ]; then
PYENV_VERSION_FILE="$(pyenv-version-file)" PYENV_VERSION_FILE="$(pyenv-version-file)"
PYENV_VERSION="$(pyenv-version-file-read "$PYENV_VERSION_FILE" || true)" PYENV_VERSION="$(pyenv-version-file-read "$PYENV_VERSION_FILE" || true)"
@ -29,18 +46,32 @@ versions=()
OLDIFS="$IFS" OLDIFS="$IFS"
{ IFS=: { IFS=:
any_not_installed=0 any_not_installed=0
normalization_done=
# Unquoted $VAR does glob expansion (against the current dir's contents) after IFS-splitting
# which is undesired
set -f
for version in ${PYENV_VERSION}; do for version in ${PYENV_VERSION}; do
if version_exists "$version" || [ "$version" = "system" ]; then # Remove the explicit 'python-' prefix from versions like 'python-3.12'.
versions=("${versions[@]}" "${version}") normalised_version="${version#python-}"
elif version_exists "${version#python-}"; then [[ $version != "${normalised_version}" ]] && normalization_done=1
versions=("${versions[@]}" "${version#python-}") if [[ $version == "system" ]] || version_exists "${normalised_version}" ; then
elif resolved_version="$(pyenv-latest -q "$version")"; then versions+=("${normalised_version}")
versions=("${versions[@]}" "${resolved_version}") elif [[ -n $normalization_done ]] && version_exists "${version}"; then
versions+=("${version}")
elif resolved_version="$(pyenv-latest -b "${normalised_version}")"; then
versions+=("${resolved_version}")
elif [[ -n $normalization_done ]] && resolved_version="$(pyenv-latest -b "${version}")"; then
versions+=("${resolved_version}")
else
if [[ -n $FORCE ]]; then
versions+=("${normalised_version}")
else else
echo "pyenv: version \`$version' is not installed (set by $(pyenv-version-origin))" >&2 echo "pyenv: version \`$version' is not installed (set by $(pyenv-version-origin))" >&2
any_not_installed=1 any_not_installed=1
fi fi
fi
done done
set +f
} }
IFS="$OLDIFS" IFS="$OLDIFS"

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
@ -77,6 +99,9 @@ else
miss_prefix=" " miss_prefix=" "
OLDIFS="$IFS" OLDIFS="$IFS"
IFS=: IFS=:
# VAR=() of unquoted value does glob expansion (against the current dir's contents) after IFS-splitting
# which is undesired
set -f
if ((${BASH_VERSINFO[0]} > 3)); then if ((${BASH_VERSINFO[0]} > 3)); then
for i in $(pyenv-version-name || true); do for i in $(pyenv-version-name || true); do
current_versions["$i"]="1" current_versions["$i"]="1"
@ -84,6 +109,7 @@ else
else else
current_versions=($(pyenv-version-name || true)) current_versions=($(pyenv-version-name || true))
fi fi
set +f
IFS="$OLDIFS" IFS="$OLDIFS"
include_system="1" include_system="1"
fi fi
@ -128,9 +154,9 @@ print_version() {
# Include "system" in the non-bare output, if it exists # Include "system" in the non-bare output, if it exists
if [ -n "$include_system" ] && \ if [ -n "$include_system" ] && \
(PYENV_VERSION=system pyenv-which python >/dev/null 2>&1 || \ (PYENV_VERSION=system pyenv-which python --skip-advice >/dev/null 2>&1 || \
PYENV_VERSION=system pyenv-which python3 >/dev/null 2>&1 || \ PYENV_VERSION=system pyenv-which python3 --skip-advice >/dev/null 2>&1 || \
PYENV_VERSION=system pyenv-which python2 >/dev/null 2>&1) ; then PYENV_VERSION=system pyenv-which python2 --skip-advice >/dev/null 2>&1) ; then
print_version system "/" print_version system "/"
fi fi
@ -139,11 +165,15 @@ versions_dir_entries=("$versions_dir"/*)
if sort --version-sort </dev/null >/dev/null 2>&1; then if sort --version-sort </dev/null >/dev/null 2>&1; then
# system sort supports version sorting # system sort supports version sorting
OLDIFS="$IFS" OLDIFS="$IFS"
# VAR=() of unquoted value does glob expansion (against the current dir's contents) after IFS-splitting
# which is undesired
set -f
IFS=$'\n' IFS=$'\n'
versions_dir_entries=($( versions_dir_entries=($(
printf "%s\n" "${versions_dir_entries[@]}" | printf "%s\n" "${versions_dir_entries[@]}" |
sort --version-sort sort --version-sort
)) ))
set +f
IFS="$OLDIFS" IFS="$OLDIFS"
fi fi

View File

@ -2,13 +2,14 @@
# #
# Summary: Display the full path to an executable # Summary: Display the full path to an executable
# #
# Usage: pyenv which <command> [--nosystem] # Usage: pyenv which <command> [--nosystem] [--skip-advice]
# #
# Displays the full path to the executable that pyenv will invoke when # Displays the full path to the executable that pyenv will invoke when
# you run the given command. # you run the given command.
# Use --nosystem argument in case when you don't need to search command in the # Use --nosystem argument in case when you don't need to search command in the
# system environment. # system environment.
# # Internal switch --skip-advice used to skip printing an error message on a
# failed search.
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
@ -18,41 +19,65 @@ if [ "$1" = "--complete" ]; then
exec pyenv-shims --short exec pyenv-shims --short
fi fi
if [ "$2" = "--nosystem" ]; then system="system"
SKIP_ADVICE=""
PYENV_COMMAND="$1"
while [[ $# -gt 0 ]]
do
case "$1" in
--skip-advice)
SKIP_ADVICE=1
shift
;;
--nosystem)
system="" system=""
else shift
system="system" ;;
fi *)
shift
;;
esac
done
remove_from_path() { remove_from_path() {
local path_to_remove="$1" local -a paths_to_remove
local path_before IFS=: paths_to_remove=($1)
local path_to_remove path_before
local result=":${PATH//\~/$HOME}:" local result=":${PATH//\~/$HOME}:"
while [ "$path_before" != "$result" ]; do for path_to_remove in "${paths_to_remove[@]}"; do
while true; do
path_before="$result" path_before="$result"
result="${result//:$path_to_remove:/:}" result="${result//:$path_to_remove:/:}"
if [[ ${#path_before} == "${#result}" ]]; then break; fi
done done
result="${result%:}" done
echo "${result#:}" result="${result:1:${#result}-2}"
echo "$result"
} }
PYENV_COMMAND="$1"
if [ -z "$PYENV_COMMAND" ]; then if [ -z "$PYENV_COMMAND" ]; then
pyenv-help --usage which >&2 pyenv-help --usage which >&2
exit 1 exit 1
fi fi
OLDIFS="$IFS" OLDIFS="$IFS"
IFS=: versions=(${PYENV_VERSION:-$(pyenv-version-name)}) # Unquoted $VAR or VAR=() of unquoted value does glob expansion (against the current dir's contents)
# after IFS-splitting which is undesired
set -f
IFS=: versions=(${PYENV_VERSION:-$(pyenv-version-name -f)})
set +f
IFS="$OLDIFS" IFS="$OLDIFS"
declare -a nonexistent_versions declare -a nonexistent_versions
for version in "${versions[@]}" "$system"; do for version in "${versions[@]}" "$system"; do
if [ "$version" = "system" ]; then if [ "$version" = "system" ]; then
PATH="$(remove_from_path "${PYENV_ROOT}/shims")" PROGRAM="$(echo "$PYENV_COMMAND" | tr a-z- A-Z_ | sed 's/[^A-Z0-9_]/_/g')"
PYENV_COMMAND_PATH="$(command -v "$PYENV_COMMAND" || true)" NR_CUSTOM_SHIM_PATHS="_PYENV_SHIM_PATHS_$PROGRAM"
SEARCH_PATH="$(remove_from_path "${PYENV_ROOT}/shims${!NR_CUSTOM_SHIM_PATHS:+:${!NR_CUSTOM_SHIM_PATHS}}")"
PYENV_COMMAND_PATH="$(PATH="$SEARCH_PATH" command -v "$PYENV_COMMAND" || true)"
else else
# $version may be a prefix to be resolved by pyenv-latest # $version may be a prefix to be resolved by pyenv-latest
version_path="$(pyenv-prefix "${version}" 2>/dev/null)" || \ version_path="$(pyenv-prefix "${version}" 2>/dev/null)" || \
@ -81,21 +106,21 @@ else
for version in "${nonexistent_versions[@]}"; do for version in "${nonexistent_versions[@]}"; do
echo "pyenv: version \`$version' is not installed (set by $(pyenv-version-origin))" >&2 echo "pyenv: version \`$version' is not installed (set by $(pyenv-version-origin))" >&2
done done
exit 1
fi fi
echo "pyenv: $PYENV_COMMAND: command not found" >&2 echo "pyenv: $PYENV_COMMAND: command not found" >&2
if [ -z "$SKIP_ADVICE" ]; then
versions="$(pyenv-whence "$PYENV_COMMAND" || true)" versions="$(pyenv-whence "$PYENV_COMMAND" || true)"
if [ -n "$versions" ]; then if [ -n "$versions" ]; then
{ echo { echo
echo "The \`$1' 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
exit 127 exit 127
fi fi

View File

@ -14,7 +14,7 @@ pyenv lets you easily switch between multiple versions of Python\. It's simple,
.RS 15 .RS 15
.nf .nf
if command -v pyenv 1>/dev/null 2>&1; then\n if command -v pyenv 1>/dev/null 2>&1; then\n
eval "$(pyenv init -)" \n eval "$(pyenv init - bash)" \n
fi fi
.fi .fi
.RE .RE

1
plugins/.gitignore vendored
View File

@ -2,4 +2,5 @@
!/.gitignore !/.gitignore
!/version-ext-compat !/version-ext-compat
!/python-build !/python-build
!/pyenv-binary
/python-build/test/build /python-build/test/build

View File

@ -0,0 +1,75 @@
# pyenv-binary (experimental)
Package an installed Python version into a relocatable archive that can be
installed on another machine.
This is experimental and intentionally decoupled: it does not change
`pyenv install` or any other command. You drive it explicitly through
`pyenv binary`. Run `pyenv binary <command> --help` for details on a command.
## Portability
An archive is portable across machines that share its build platform (OS,
architecture and a compatible libc) and have the recorded system libraries. It
is not portable across, say, glibc and musl, or to an older glibc; the platform
and dependency metadata exist to catch that.
## Commands
### `pyenv binary package <version>:<entry> --archive-base-url <url>`
Installs `<version>` from source under the separate name `<entry>`, packages
that install with `save`, then emits a python-build definition for it with
`generate-installer`. The archive, metadata and definition land in the current
directory, named after the entry; host the archive under `<url>` and drop the
definition into python-build's definition directory. Keeping the entry name
distinct from the version lets the binary sit alongside a normal source
install of the same version.
```sh
pyenv binary package 3.12.7:3.12.7-debian-12 \
--archive-base-url https://example.com/binaries
# writes 3.12.7-debian-12.tar.gz, its .meta file and
# a `3.12.7-debian-12' definition
```
### `pyenv binary save <version> [<output-dir>] [--name <name>]`
Packs an installed version into `<version>-<platform>.tar.gz` (relative paths)
and writes `<version>-<platform>.meta` describing the build platform (OS, arch,
distro and libc version) and the system libraries the build links against. Use
`--name` to set a different base name for both files.
```sh
pyenv binary save 3.12.7 ./dist
```
### `pyenv binary generate-installer <metadata-file> --archive-url <url> [-o <output>]`
Reads a `.meta` file and emits a python-build definition. Drop it into
python-build's definition directory and `pyenv install <name>` installs the
archive like any other version. The archive location is a parameter, so you can
host it anywhere (it does not have to be a pyenv location); the archive itself
must sit next to the `.meta` file so its checksum can be baked into the
definition.
The definition refuses to install on a different OS/architecture, or an older
glibc, than the archive was built for, and checks that the system libraries it
needs are present.
```sh
pyenv binary generate-installer ./dist/3.12.7-linux-x86_64.meta \
--archive-url https://example.com/3.12.7-linux-x86_64.tar.gz \
-o "$(pyenv root)/plugins/python-build/share/python-build/3.12.7-linux-x86_64"
pyenv install 3.12.7-linux-x86_64
```
### `pyenv binary relocate <prefix>`
Rewrites the rpaths of a Python tree unpacked into `<prefix>` so the interpreter
and its extension modules load the bundled libraries from there rather than from
the path the archive was built at. Uses `patchelf`. The generated definition
calls this; you rarely run it by hand.
Relocation is implemented for Linux; macOS is not wired up yet.

View File

@ -0,0 +1,65 @@
#!/usr/bin/env bash
#
# Summary: Package an installed Python version as a relocatable binary (experimental)
#
# Usage: pyenv binary <command> [<args>]
#
# `pyenv binary` packages an already-installed Python version into a relocatable
# archive that can be installed on another machine. It is experimental and does
# not touch `pyenv install' or any other command.
#
# Run `pyenv binary' to list its commands, or `pyenv binary <command> --help'
# for command-specific help.
#
set -e
[ -n "$PYENV_DEBUG" ] && set -x
libexec="${BASH_SOURCE%/*}/../libexec"
# The pyenv launcher only puts a plugin's bin on PATH, but `pyenv-help' looks a
# command up there. Add our libexec so the subcommands, and the help text they
# print, can be found.
export PATH="${libexec}:${PATH}"
list_commands() {
local path
for path in "$libexec"/pyenv-binary-*; do
[ -e "$path" ] && echo "${path##*/pyenv-binary-}"
done
}
# Provide pyenv completions
if [ "$1" = "--complete" ]; then
shift
if [ -z "$1" ]; then
list_commands
else
command_path="${libexec}/pyenv-binary-$1"
shift
[ -x "$command_path" ] && exec "$command_path" --complete "$@"
fi
exit
fi
subcommand="$1"
if [ -z "$subcommand" ]; then
{ pyenv-help binary
echo
echo "Commands:"
list_commands | sed 's/^/ /'
} >&2
exit 1
fi
shift
command_path="${libexec}/pyenv-binary-${subcommand}"
if [ ! -x "$command_path" ]; then
echo "pyenv-binary: no such command \`${subcommand}'" >&2
exit 1
fi
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
exec pyenv-help "binary-${subcommand}"
fi
exec "$command_path" "$@"

View File

@ -0,0 +1,189 @@
#!/usr/bin/env bash
#
# Summary: Generate a python-build definition for a saved binary archive
#
# Usage: pyenv binary generate-installer <metadata-file> --archive-url <url> [-o <output>]
#
# Reads a metadata file written by `pyenv binary save' and emits a python-build
# definition. Dropped into python-build's definition directory, it installs the
# archive like any other version: `pyenv install' downloads it from <url>,
# checks the platform and the required system libraries, unpacks it, then
# rewrites rpaths so the copy runs from its prefix.
#
# The archive must sit next to the metadata file so its checksum can be baked
# into the definition; `pyenv binary save' writes the two together.
#
# <metadata-file> A .meta file written by `pyenv binary save'.
# The corresponsing binary package written by `pyenv binary save'
# needs to be present alongside it.
# --archive-url <url> The URL for the resulting installation script to download
# the package from.
# -o <output> Write the definition here (default: stdout).
#
set -e
[ -n "$PYENV_DEBUG" ] && set -x
# Provide pyenv completions
if [ "$1" = "--complete" ]; then
echo --archive-url
echo -o
exit
fi
metadata=""
archive_url=""
output=""
while [ $# -gt 0 ]; do
case "$1" in
--archive-url )
[ $# -ge 2 ] || { echo "pyenv-binary: --archive-url needs a value" >&2; exit 1; }
archive_url="$2"; shift 2 ;;
-o )
[ $# -ge 2 ] || { echo "pyenv-binary: -o needs a value" >&2; exit 1; }
output="$2"; shift 2 ;;
-* )
echo "pyenv-binary: unknown option \`$1'" >&2; exit 1 ;;
* )
[ -z "$metadata" ] || { echo "pyenv-binary: unexpected argument \`$1'" >&2; exit 1; }
metadata="$1"; shift ;;
esac
done
if [ -z "$metadata" ] || [ -z "$archive_url" ]; then
pyenv-help --usage binary-generate-installer >&2
exit 1
fi
version="" os="" arch="" distro="" libc="" archive=""
deps=""
while IFS='=' read -r key value; do
case "$key" in
version ) version="$value" ;;
os ) os="$value" ;;
arch ) arch="$value" ;;
distro ) distro="$value" ;;
libc ) libc="$value" ;;
archive ) archive="$value" ;;
dep ) deps="${deps:+$deps }$value" ;;
esac
done < "$metadata"
# Fail here if the metadata is incomplete, rather than bake a blank into the
# definition where a missing arch would give a confusing platform error.
for field in version os arch archive; do
if [ -z "${!field}" ]; then
echo "pyenv-binary: metadata is missing \`${field}'" >&2
exit 1
fi
done
# macOS relocation needs install_name_tool and a different rpath scheme, so it is
# not supported yet. Other systems relocate with patchelf.
if [ "$os" = "Darwin" ]; then
echo "pyenv-binary: macOS archives are not supported yet" >&2
exit 1
fi
# The glibc floor only applies on Linux; require it there so the definition can
# tell whether the target is new enough to run the binaries.
if [ "$os" = "Linux" ] && [ -z "$libc" ]; then
echo "pyenv-binary: metadata is missing \`libc'" >&2
exit 1
fi
# python-build downloads the archive itself, so the checksum has to be baked in.
# The archive sits next to the metadata `save' wrote it alongside.
archive_path="$(dirname "$metadata")/${archive}"
if [ ! -r "$archive_path" ]; then
echo "pyenv-binary: cannot read the archive \`${archive_path}' to checksum it" >&2
exit 1
fi
if command -v sha256sum >/dev/null 2>&1; then
sha256="$(sha256sum "$archive_path")"; sha256="${sha256%% *}"
elif command -v shasum >/dev/null 2>&1; then
sha256="$(shasum -a 256 "$archive_path")"; sha256="${sha256%% *}"
elif command -v openssl >/dev/null 2>&1; then
sha256="$(openssl dgst -sha256 "$archive_path")"; sha256="${sha256##* }"
else
echo "pyenv-binary: need sha256sum, shasum or openssl to checksum the archive" >&2
exit 1
fi
emit() {
# The values known now go in as %q-quoted assignments so a stray quote or space
# in the URL or metadata cannot break the definition or inject into it. The body
# below is a quoted here-doc, verbatim.
{
printf '# python-build definition for prebuilt Python %s (%s/%s%s).\n' \
"$version" "$os" "$arch" "${distro:+, $distro}"
echo "# Generated by \`pyenv binary generate-installer'."
echo
printf 'EXPECT_OS=%q\n' "$os"
printf 'EXPECT_ARCH=%q\n' "$arch"
printf 'EXPECT_LIBC=%q\n' "$libc"
printf 'VERSION=%q\n' "$version"
printf 'ARCHIVE_URL=%q\n' "$archive_url"
printf 'SHA256=%q\n' "$sha256"
printf 'DEPS=%q\n' "$deps"
}
cat <<'EOF'
os="$(uname -s)"
arch="$(uname -m)"
if [ "$os" != "$EXPECT_OS" ] || [ "$arch" != "$EXPECT_ARCH" ]; then
echo "pyenv-binary: this archive is for ${EXPECT_OS}/${EXPECT_ARCH}, not ${os}/${arch}" >&2
exit 1
fi
# Refuse a target whose glibc is older than the one the archive was built on;
# the dynamic loader would reject the binaries.
case "$EXPECT_LIBC" in
"glibc "* )
build_libc="${EXPECT_LIBC#glibc }"
target_libc="$(getconf GNU_LIBC_VERSION 2>/dev/null || true)"
case "$target_libc" in
"glibc "* )
target_libc="${target_libc#glibc }"
older="$(printf '%s\n%s\n' "$build_libc" "$target_libc" | sort -V | head -n1)"
if [ "$older" = "$target_libc" ] && [ "$target_libc" != "$build_libc" ]; then
echo "pyenv-binary: archive needs glibc ${build_libc} or newer, but this system has ${target_libc}" >&2
exit 1
fi
;;
esac
;;
esac
# Required system libraries must already be present on the target. ldconfig -p
# lists each library as "<soname> (...) => <path>"; match the soname column
# exactly so a longer name like libc.so.6.1 does not satisfy libc.so.6.
if command -v ldconfig &>/dev/null && cache="$(ldconfig -p)"; then
missing=""
for dep in $DEPS; do
printf '%s\n' "$cache" | awk -v d="$dep" '$1 == d { found = 1 } END { exit !found }' \
|| missing="${missing} ${dep}"
done
if [ -n "$missing" ]; then
echo "pyenv-binary: missing required system libraries:${missing}" >&2
exit 1
fi
elif [ -n "$DEPS" ]; then
echo "pyenv-binary: cannot check required system libraries (ldconfig with -p not found)" >&2
fi
build_package_relocate() {
pyenv binary relocate "$PREFIX_PATH"
}
install_package "Python-${VERSION}-binary" "${ARCHIVE_URL}#${SHA256}" copy relocate
EOF
}
if [ -n "$output" ]; then
emit > "$output"
echo "Wrote definition to ${output}"
else
emit
fi

View File

@ -0,0 +1,90 @@
#!/usr/bin/env bash
#
# Summary: Create an installable binary package from a Python version
#
# Usage: pyenv binary package <version>:<entry> --archive-base-url <url>
#
# Installs <version> from source under the separate name <entry>, saves it as
# a binary package, then emits a python-build definition for that package.
# The archive, metadata and definition are written to the current directory
# as <entry>.tar.gz, <entry>.meta and <entry>.
#
# <version> A version `pyenv install' knows how to build.
# <entry> The name to build under and to install the binary
# as, e.g. `3.13.14-debian-12'. Keeping it distinct
# from <version> lets the binary sit alongside a
# normal source install of the same version.
# --archive-base-url <url>
# Where the archive will be hosted; the definition
# downloads it from <url>/<entry>.tar.gz.
#
set -e
[ -n "$PYENV_DEBUG" ] && set -x
# Provide pyenv completions
if [ "$1" = "--complete" ]; then
echo --archive-base-url
exec pyenv-install --list --bare
fi
spec=""
archive_base_url=""
while [ $# -gt 0 ]; do
case "$1" in
--archive-base-url )
[ $# -ge 2 ] || { echo "pyenv-binary: --archive-base-url needs a value" >&2; exit 1; }
archive_base_url="$2"; shift 2 ;;
-* )
echo "pyenv-binary: unknown option \`$1'" >&2; exit 1 ;;
* )
[ -z "$spec" ] || { echo "pyenv-binary: unexpected argument \`$1'" >&2; exit 1; }
spec="$1"; shift ;;
esac
done
if [ -z "$spec" ] || [ -z "$archive_base_url" ]; then
pyenv-help --usage binary-package >&2
exit 1
fi
case "$spec" in
*?:?* ) ;;
* )
echo "pyenv-binary: expected <version>:<entry>, e.g. \`3.13.14:3.13.14-debian-12'" >&2
exit 1
;;
esac
entry="${spec##*:}"
case "$entry" in
# `pyenv install' reads a trailing `:latest' as part of the version rather than
# as an alias, so nothing would end up installed under that name.
latest )
echo "pyenv-binary: \`latest' cannot be used as an entry name" >&2
exit 1
;;
# The entry becomes a directory name under versions/. `pyenv install' does not
# validate the alias, and `save' only checks once the build is done, so refuse
# a name that could point elsewhere before compiling anything.
*/* | .. | . )
echo "pyenv-binary: invalid entry name \`${entry}'" >&2
exit 1
;;
esac
os="$(uname -s)"
# `generate-installer' refuses a macOS archive, so the last step here cannot
# succeed on one. Give up before compiling rather than after it.
if [ "$os" = "Darwin" ]; then
echo "pyenv-binary: macOS archives are not supported yet" >&2
exit 1
fi
# `pyenv install' puts a `<version>:<alias>' build under versions/<alias>.
pyenv-install "$spec"
pyenv-binary-save "$entry" "$PWD" --name "$entry"
pyenv-binary-generate-installer "${entry}.meta" \
--archive-url "${archive_base_url%/}/${entry}.tar.gz" -o "$entry"

View File

@ -0,0 +1,58 @@
#!/usr/bin/env bash
#
# Summary: Rewrite an unpacked Python's rpaths so it runs from its prefix
#
# Usage: pyenv binary relocate <prefix>
#
# Rewrites the rpaths of a Python tree that was unpacked into <prefix> so the
# interpreter and its extension modules load the bundled libraries from their
# new location rather than the path it was built at. Requires patchelf.
#
# The definition that `pyenv binary generate-installer' produces calls this
# after `install_package ... copy' has laid the tree down.
#
set -e
[ -n "$PYENV_DEBUG" ] && set -x
if [ "$1" = "--complete" ]; then
exit
fi
prefix="$1"
if [ -z "$prefix" ]; then
pyenv-help --usage binary-relocate >&2
exit 1
fi
# patchelf can add an rpath and write one of any length; chrpath can only shorten
# an existing one, which is not enough to relocate every build, so require it.
if ! command -v patchelf >/dev/null 2>&1; then
echo "pyenv-binary: need patchelf to relocate the binary" >&2
exit 1
fi
# The interpreter loads libpython from ../lib. Patch every ELF binary in bin/ so
# this holds whatever the interpreter is named (python3, python2.7, ...); the
# scripts alongside it (pip, idle) are not ELF, so `--print-rpath' fails on them
# and they are skipped. A tree with no interpreter at all did not unpack the way
# we expect, so treat that as an error rather than quietly relocating nothing.
found=0
for file in "$prefix"/bin/*; do
[[ -f $file && -x $file && ! -L $file ]] || continue
patchelf --print-rpath "$file" >/dev/null 2>&1 || continue
patchelf --set-rpath "$prefix/lib" "$file"
found=1
done
if [ "$found" -eq 0 ]; then
echo "pyenv-binary: found no interpreter to relocate under \`${prefix}/bin'" >&2
exit 1
fi
# The extension modules CPython built are the only other objects with an rpath
# into the old prefix, so point them at lib/ as well. Anything a wheel installed
# carries an rpath of its own, often into a bundled library directory beside it,
# and would stop loading if we overwrote it. Each match is an ELF object we expect
# to patch, so let a failure stop us rather than swallow it.
while IFS= read -r so; do
patchelf --set-rpath "$prefix/lib" "$so"
done < <(find "$prefix" -path '*/lib-dynload/*.so')

View File

@ -0,0 +1,141 @@
#!/usr/bin/env bash
#
# Summary: Save an installed Python version as a relocatable archive
#
# Usage: pyenv binary save <version> [<output-dir>] [--name <name>]
#
# Packs an installed version into a relocatable .tar.gz (relative paths) and
# writes a metadata file listing the build platform and the system libraries
# it links against, so an installer can check compatibility before unpacking.
#
# <version> An installed version, as listed by `pyenv versions --bare'.
# <output-dir> Where to write the archive and metadata (default: `.').
# --name <name> Use <name> as the archive and metadata base name instead of
# <version>-<platform>.
#
set -e
[ -n "$PYENV_DEBUG" ] && set -x
# Provide pyenv completions
if [ "$1" = "--complete" ]; then
echo --name
exec pyenv-versions --bare
fi
version=""
output_dir=""
package_name=""
while [ $# -gt 0 ]; do
case "$1" in
--name )
[ $# -ge 2 ] && [ -n "$2" ] || { echo "pyenv-binary: --name needs a value" >&2; exit 1; }
package_name="$2"; shift 2 ;;
-* )
echo "pyenv-binary: unknown option \`$1'" >&2; exit 1 ;;
* )
if [ -z "$version" ]; then
version="$1"
elif [ -z "$output_dir" ]; then
output_dir="$1"
else
echo "pyenv-binary: unexpected argument \`$1'" >&2
exit 1
fi
shift ;;
esac
done
output_dir="${output_dir:-$PWD}"
if [ -z "$version" ]; then
echo "Usage: pyenv binary save <version> [<output-dir>] [--name <name>]" >&2
exit 1
fi
# A version is a single directory name under versions/. With no slash allowed,
# the only remaining names that could point elsewhere are `.' and `..'.
case "$version" in
*/* | .. | . )
echo "pyenv-binary: invalid version name \`${version}'" >&2
exit 1
;;
esac
case "$package_name" in
*/* | .. | . | *[[:cntrl:]]* )
echo "pyenv-binary: invalid package name \`${package_name}'" >&2
exit 1
;;
esac
prefix="${PYENV_ROOT}/versions/${version}"
if [ ! -d "${prefix}/bin" ]; then
echo "pyenv-binary: version \`${version}' is not installed" >&2
exit 1
fi
os="$(uname -s)"
arch="$(uname -m)"
platform="$(printf '%s' "$os" | tr '[:upper:]' '[:lower:]')-${arch}"
# Record the distro and libc version. Platform and arch alone are too coarse to
# judge compatibility: a build is only portable to a matching libc (e.g. a
# glibc 2.36 build will not load on an older glibc, nor on musl at all).
distro=""
libc=""
if [ -r /etc/os-release ]; then
distro="$( . /etc/os-release && printf '%s %s' "${ID:-}" "${VERSION_ID:-}" )"
elif [ "$os" = "Darwin" ]; then
distro="macos $(sw_vers -productVersion 2>/dev/null)"
fi
if [ "$os" = "Linux" ]; then
libc="$(getconf GNU_LIBC_VERSION 2>/dev/null || true)"
fi
# List the external shared libraries the install links against: those that
# resolve outside its own prefix, so they must already exist on the target.
# The interpreter plus every bundled shared object are inspected.
system_deps() {
local f
{
for f in "${prefix}"/bin/python*; do
[ -e "$f" ] && printf '%s\n' "$f"
done
# CPython ships its extension modules as *.so (and *.dylib on macOS). A
# bare *.so.* is unusual for CPython itself, but the odd build carries a
# versioned copy alongside, so match it too rather than miss a dependency.
find "${prefix}" -type f \( -name '*.so' -o -name '*.so.*' -o -name '*.dylib' \)
} | sort -u | while IFS= read -r f; do
if [ "$os" = "Darwin" ]; then
otool -L "$f" 2>/dev/null | tail -n +2 | awk -v pfx="${prefix}/" \
'$1 !~ /^@/ && substr($1, 1, length(pfx)) != pfx { print $1 }'
else
ldd "$f" 2>/dev/null | awk -v pfx="${prefix}/" \
'$2 == "=>" && $3 ~ /^\// && substr($3, 1, length(pfx)) != pfx { print $1 }'
fi
done | sort -u
}
mkdir -p "$output_dir"
package_name="${package_name:-${version}-${platform}}"
archive="${package_name}.tar.gz"
metadata="${package_name}.meta"
tar -C "$(dirname "$prefix")" -czf "${output_dir}/${archive}" "$(basename "$prefix")"
{
echo "# pyenv-binary metadata"
echo "version=${version}"
echo "os=${os}"
echo "arch=${arch}"
echo "platform=${platform}"
[ -n "$distro" ] && echo "distro=${distro}"
[ -n "$libc" ] && echo "libc=${libc}"
echo "archive=${archive}"
system_deps | while IFS= read -r dep; do
[ -n "$dep" ] && echo "dep=${dep}"
done
} > "${output_dir}/${metadata}"
echo "Saved ${archive} and ${metadata} to ${output_dir}"

View File

@ -0,0 +1,123 @@
#!/usr/bin/env bats
load test_helper
create_meta() {
local os="${1-Linux}"
local arch="${2-x86_64}"
local libc="${3-glibc 2.17}"
local archive="${BATS_TEST_TMPDIR}/3.12.7.tar.gz"
local meta="${BATS_TEST_TMPDIR}/sample.meta"
rm -rf "${BATS_TEST_TMPDIR}/archive"
mkdir -p "${BATS_TEST_TMPDIR}/archive/3.12.7/bin"
printf '#!/bin/sh\n' > "${BATS_TEST_TMPDIR}/archive/3.12.7/bin/python"
chmod +x "${BATS_TEST_TMPDIR}/archive/3.12.7/bin/python"
tar -C "${BATS_TEST_TMPDIR}/archive" -czf "$archive" 3.12.7
{
echo "version=3.12.7"
echo "os=${os}"
echo "arch=${arch}"
[ -z "$libc" ] || echo "libc=${libc}"
echo "archive=${archive##*/}"
} > "$meta"
echo "$meta"
}
@test "completion lists the options" {
run pyenv-binary-generate-installer --complete
assert_success "--archive-url
-o"
}
@test "fails with no arguments" {
create_stub pyenv-help "echo usage"
run pyenv-binary-generate-installer
assert_failure "usage"
}
@test "fails without an archive url" {
create_stub pyenv-help "echo usage"
run pyenv-binary-generate-installer "$(create_meta)"
assert_failure "usage"
}
@test "fails when --archive-url has no value" {
run pyenv-binary-generate-installer "$(create_meta)" --archive-url
assert_failure "pyenv-binary: --archive-url needs a value"
}
@test "rejects a second positional argument" {
run pyenv-binary-generate-installer "$(create_meta)" extra --archive-url http://x/a.tar.gz
assert_failure "pyenv-binary: unexpected argument \`extra'"
}
@test "fails for a metadata file that cannot be read" {
run pyenv-binary-generate-installer /no/such.meta --archive-url http://x/a.tar.gz
assert_failure
}
@test "refuses macOS metadata" {
run pyenv-binary-generate-installer "$(create_meta Darwin arm64 '')" \
--archive-url http://x/a.tar.gz
assert_failure "pyenv-binary: macOS archives are not supported yet"
}
@test "fails when required metadata is missing" {
local field meta
for field in version os arch archive; do
meta="$(create_meta)"
#cannot use -i: GNU sed requires -i[suf], BSD sed required -i <suf>
sed "/^${field}=/d" "$meta" > "${meta}.tmp"; mv "${meta}"{.tmp,}
run pyenv-binary-generate-installer "$meta" --archive-url http://x/a.tar.gz
assert_failure "pyenv-binary: metadata is missing \`${field}'"
done
}
@test "fails when Linux metadata is missing libc" {
run pyenv-binary-generate-installer "$(create_meta Linux x86_64 '')" \
--archive-url http://x/a.tar.gz
assert_failure "pyenv-binary: metadata is missing \`libc'"
}
@test "refuses a host whose glibc is older than the archive" {
local out="${BATS_TEST_TMPDIR}/definition"
pyenv-binary-generate-installer "$(create_meta Linux x86_64 'glibc 99.0')" \
--archive-url http://example.com/a.tar.gz -o "$out"
create_stub uname 'case "$1" in -s) echo Linux;; -m) echo x86_64;; esac'
create_stub getconf 'echo "glibc 2.31"'
run bash "$out"
assert_failure "pyenv-binary: archive needs glibc 99.0 or newer, but this system has 2.31"
}
@test "fails when the archive is not beside the metadata" {
local meta="$(create_meta)"
rm "${BATS_TEST_TMPDIR}/3.12.7.tar.gz"
run pyenv-binary-generate-installer "$meta" --archive-url http://x/a.tar.gz
assert_failure "pyenv-binary: cannot read the archive \`${BATS_TEST_TMPDIR}/3.12.7.tar.gz' to checksum it"
}
@test "the generated definition is installable with python-build" {
ldconfig -p &>/dev/null || skip "ldconfig with -p is not present"
local archive="${BATS_TEST_TMPDIR}/3.12.7.tar.gz"
local cache="${BATS_TEST_TMPDIR}/cache"
local definition="${BATS_TEST_TMPDIR}/definition"
local prefix="${BATS_TEST_TMPDIR}/install"
pyenv-binary-generate-installer "$(create_meta)" \
--archive-url http://example.com/3.12.7.tar.gz -o "$definition"
mkdir -p "$cache"
cp "$archive" "${cache}/Python-3.12.7-binary.tar.gz"
create_stub pyenv 'echo "pyenv $*"'
create_stub uname 'case "$1" in -s) echo Linux;; -m) echo x86_64;; esac'
PYTHON_BUILD_CACHE_PATH="$cache" run \
"${BATS_TEST_DIRNAME}/../../python-build/bin/python-build" "$definition" "$prefix"
assert_success
assert_line "pyenv binary relocate ${prefix}"
assert_line "Installed Python-3.12.7-binary to ${prefix}"
assert [ -x "${prefix}/bin/python" ]
}

View File

@ -0,0 +1,92 @@
#!/usr/bin/env bats
load test_helper
# Make the build deterministic: `pyenv-install' just creates the prefix, and
# the platform tools report a fixed Linux target so the real `save' and
# `generate-installer' behave the same on any test host.
stub_build_environment() {
create_stub pyenv-install 'mkdir -p "${PYENV_ROOT}/versions/${1##*:}/bin"'
create_stub uname 'case "$1" in -s) echo Linux;; -m) echo x86_64;; esac'
create_stub getconf 'echo "glibc 2.17"'
}
@test "completion lists the option and definitions provided by another plugin" {
mkdir -p "${PYENV_ROOT}/plugins/example/share/python-build"
touch "${PYENV_ROOT}/plugins/example/share/python-build/3.12.7-example"
PATH="${BATS_TEST_DIRNAME}/../../python-build/bin:${PATH}"
run pyenv-binary-package --complete
assert_success
assert_line "--archive-base-url"
assert_line "3.12.7-example"
refute_line "Available versions:"
}
@test "fails with no arguments" {
create_stub pyenv-help "echo usage"
run pyenv-binary-package
assert_failure "usage"
}
@test "fails without an archive base url" {
create_stub pyenv-help "echo usage"
run pyenv-binary-package 3.12.7:3.12.7-test
assert_failure "usage"
}
@test "fails when --archive-base-url has no value" {
run pyenv-binary-package 3.12.7:3.12.7-test --archive-base-url
assert_failure "pyenv-binary: --archive-base-url needs a value"
}
@test "rejects a second positional argument" {
run pyenv-binary-package 3.12.7:3.12.7-test extra --archive-base-url http://x/b
assert_failure "pyenv-binary: unexpected argument \`extra'"
}
@test "rejects a bare version without an entry name" {
run pyenv-binary-package 3.12.7 --archive-base-url http://x/b
assert_failure "pyenv-binary: expected <version>:<entry>, e.g. \`3.13.14:3.13.14-debian-12'"
}
@test "rejects an entry name containing a slash" {
run pyenv-binary-package "3.12.7:foo/bar" --archive-base-url http://x/b
assert_failure "pyenv-binary: invalid entry name \`foo/bar'"
}
@test "rejects \`latest' as an entry name" {
run pyenv-binary-package 3.12:latest --archive-base-url http://x/b
assert_failure "pyenv-binary: \`latest' cannot be used as an entry name"
}
@test "refuses to package on macOS before compiling anything" {
create_stub uname 'case "$1" in -s) echo Darwin;; -m) echo arm64;; esac'
run pyenv-binary-package 3.12.7:3.12.7-test --archive-base-url http://x/b
assert_failure "pyenv-binary: macOS archives are not supported yet"
}
@test "writes the archive, metadata and definition under the entry name" {
stub_build_environment
cd "${BATS_TEST_TMPDIR}"
run pyenv-binary-package 3.12.7:3.12.7-test \
--archive-base-url http://example.com/binaries
assert_success
assert [ -d "${PYENV_ROOT}/versions/3.12.7-test" ]
assert [ -f "${BATS_TEST_TMPDIR}/3.12.7-test.tar.gz" ]
assert [ -f "${BATS_TEST_TMPDIR}/3.12.7-test.meta" ]
run grep '^ARCHIVE_URL=' "${BATS_TEST_TMPDIR}/3.12.7-test"
assert_success "ARCHIVE_URL=http://example.com/binaries/3.12.7-test.tar.gz"
}
@test "strips a trailing slash from the archive base url" {
stub_build_environment
cd "${BATS_TEST_TMPDIR}"
run pyenv-binary-package 3.12.7:3.12.7-test \
--archive-base-url http://example.com/binaries/
assert_success
run grep '^ARCHIVE_URL=' "${BATS_TEST_TMPDIR}/3.12.7-test"
assert_success "ARCHIVE_URL=http://example.com/binaries/3.12.7-test.tar.gz"
}

View File

@ -0,0 +1,72 @@
#!/usr/bin/env bats
load test_helper
_setup() {
create_stub pyenv-help "echo usage"
}
stub_patchelf() {
create_path_executable patchelf <<STUB
if [ "\$1" = "--print-rpath" ]; then
exit 0
fi
echo "\$*" >> "${BATS_TEST_TMPDIR}/patchelf.log"
STUB
}
create_interpreter() {
mkdir -p "${BATS_TEST_TMPDIR}/prefix/bin"
printf '#!/bin/sh\n' > "${BATS_TEST_TMPDIR}/prefix/bin/python2.7"
chmod +x "${BATS_TEST_TMPDIR}/prefix/bin/python2.7"
}
@test "completion produces nothing" {
run pyenv-binary-relocate --complete
assert_success ""
}
@test "fails without a prefix" {
run pyenv-binary-relocate
assert_failure "usage"
}
@test "fails when patchelf is not available" {
PATH="$(path_without patchelf)" run pyenv-binary-relocate "${BATS_TEST_TMPDIR}/prefix"
assert_failure "pyenv-binary: need patchelf to relocate the binary"
}
@test "fails when the prefix has no interpreter" {
create_path_executable patchelf "exit 0"
mkdir -p "${BATS_TEST_TMPDIR}/prefix"
run pyenv-binary-relocate "${BATS_TEST_TMPDIR}/prefix"
assert_failure "pyenv-binary: found no interpreter to relocate under \`${BATS_TEST_TMPDIR}/prefix/bin'"
}
@test "relocates an executable interpreter" {
stub_patchelf
create_interpreter
run pyenv-binary-relocate "${BATS_TEST_TMPDIR}/prefix"
assert_success
run cat "${BATS_TEST_TMPDIR}/patchelf.log"
assert_output "--set-rpath ${BATS_TEST_TMPDIR}/prefix/lib ${BATS_TEST_TMPDIR}/prefix/bin/python2.7"
}
@test "relocates the extension modules but not what a wheel installed" {
local lib="${BATS_TEST_TMPDIR}/prefix/lib/python3.12"
stub_patchelf
create_interpreter
mkdir -p "${lib}/lib-dynload" "${lib}/site-packages/numpy"
touch "${lib}/lib-dynload/_ssl.cpython-312-x86_64-linux-gnu.so"
# A wheel points its extensions at the libraries it bundles alongside them, so
# its rpath is its own business and must survive relocation.
touch "${lib}/site-packages/numpy/_multiarray.so"
run pyenv-binary-relocate "${BATS_TEST_TMPDIR}/prefix"
assert_success
run cat "${BATS_TEST_TMPDIR}/patchelf.log"
assert_line "--set-rpath ${BATS_TEST_TMPDIR}/prefix/lib ${lib}/lib-dynload/_ssl.cpython-312-x86_64-linux-gnu.so"
refute_line "--set-rpath ${BATS_TEST_TMPDIR}/prefix/lib ${lib}/site-packages/numpy/_multiarray.so"
}

View File

@ -0,0 +1,132 @@
#!/usr/bin/env bats
load test_helper
create_version() {
mkdir -p "${PYENV_ROOT}/versions/$1/bin"
}
platform() {
echo "$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m)"
}
@test "fails with no version given" {
run pyenv-binary-save
assert_failure "Usage: pyenv binary save <version> [<output-dir>] [--name <name>]"
}
@test "fails for a version that is not installed" {
run pyenv-binary-save 9.9.9
assert_failure "pyenv-binary: version \`9.9.9' is not installed"
}
@test "rejects a version name containing a slash" {
run pyenv-binary-save "foo/bar"
assert_failure "pyenv-binary: invalid version name \`foo/bar'"
}
@test "rejects the parent directory reference" {
run pyenv-binary-save ".."
assert_failure "pyenv-binary: invalid version name \`..'"
}
@test "packages an installed version" {
create_version "3.12.7"
local out="${BATS_TEST_TMPDIR}/dist"
local archive="${out}/3.12.7-$(platform).tar.gz"
run pyenv-binary-save "3.12.7" "$out"
assert_success "Saved 3.12.7-$(platform).tar.gz and 3.12.7-$(platform).meta to $out"
assert [ -f "$archive" ]
assert [ -f "${out}/3.12.7-$(platform).meta" ]
run tar -tzf "$archive"
assert_success
assert_line 0 "3.12.7/"
}
@test "uses an explicit package name" {
create_version "3.12.7"
local out="${BATS_TEST_TMPDIR}/dist"
run pyenv-binary-save "3.12.7" "$out" --name "custom"
assert_success "Saved custom.tar.gz and custom.meta to $out"
assert [ -f "${out}/custom.tar.gz" ]
run grep '^archive=' "${out}/custom.meta"
assert_success "archive=custom.tar.gz"
}
@test "fails when --name has no value" {
run pyenv-binary-save "3.12.7" --name
assert_failure "pyenv-binary: --name needs a value"
}
@test "rejects an invalid package name" {
create_version "3.12.7"
run pyenv-binary-save "3.12.7" --name "foo/bar"
assert_failure "pyenv-binary: invalid package name \`foo/bar'"
}
@test "records the platform in the metadata" {
create_version "3.12.7"
local out="${BATS_TEST_TMPDIR}/dist"
pyenv-binary-save "3.12.7" "$out" >/dev/null
run cat "${out}/3.12.7-$(platform).meta"
assert_success
assert_line "version=3.12.7"
assert_line "platform=$(platform)"
assert_line "archive=3.12.7-$(platform).tar.gz"
}
@test "records only the libraries ldd resolves outside the prefix" {
create_version "3.12.7"
touch "${PYENV_ROOT}/versions/3.12.7/bin/python3.12"
create_path_executable uname <<'STUB'
case "$1" in
-s) echo Linux ;;
-m) echo x86_64 ;;
esac
STUB
create_path_executable ldd <<'STUB'
prefix="${PYENV_ROOT}/versions/3.12.7"
cat <<EOF
linux-vdso.so.1 (0x00007ffd1adfe000)
libpython3.12.so.1.0 => ${prefix}/lib/libpython3.12.so.1.0 (0x00007f4a3c000000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f4a3bc00000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4a3b800000)
/lib64/ld-linux-x86-64.so.2 (0x00007f4a3c200000)
EOF
STUB
run pyenv-binary-save "3.12.7" "${BATS_TEST_TMPDIR}/dist"
assert_success
run grep '^dep=' "${BATS_TEST_TMPDIR}/dist/"*.meta
assert_output "dep=libc.so.6
dep=libm.so.6"
}
@test "records only the libraries otool resolves outside the prefix" {
create_version "3.12.7"
touch "${PYENV_ROOT}/versions/3.12.7/bin/python3.12"
create_path_executable uname <<'STUB'
case "$1" in
-s) echo Darwin ;;
-m) echo arm64 ;;
esac
STUB
create_path_executable otool <<'STUB'
prefix="${PYENV_ROOT}/versions/3.12.7"
cat <<EOF
${2}:
@rpath/libpython3.12.dylib (compatibility version 3.12.0, current version 3.12.0)
${prefix}/lib/libcrypto.3.dylib (compatibility version 3.0.0, current version 3.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1345.0.0)
EOF
STUB
run pyenv-binary-save "3.12.7" "${BATS_TEST_TMPDIR}/dist"
assert_success
run grep '^dep=' "${BATS_TEST_TMPDIR}/dist/"*.meta
assert_output "dep=/usr/lib/libSystem.B.dylib"
}

View File

@ -0,0 +1 @@
../../../test/test_helper.bash

View File

@ -67,6 +67,13 @@ exact name of the version you want to install. For example,
Python versions will be installed into a directory of the same name under Python versions will be installed into a directory of the same name under
`~/.pyenv/versions`. `~/.pyenv/versions`.
To install a version under a different name -- for instance, to keep several
builds of the same version side by side -- append `:<alias>` to the version:
pyenv install 3.12.0:3.12-custom
This installs into `~/.pyenv/versions/3.12-custom`.
To see a list of all available Python versions, run `pyenv install --list`. You To see a list of all available Python versions, run `pyenv install --list`. You
may also tab-complete available Python versions if your pyenv installation is may also tab-complete available Python versions if your pyenv installation is
properly configured. properly configured.
@ -138,6 +145,17 @@ would break all Pyenv-managed installations that depend on it.
You can use a [community plugin `fix-version`](https://github.com/pyenv/pyenv/wiki/Plugins#community-plugins) You can use a [community plugin `fix-version`](https://github.com/pyenv/pyenv/wiki/Plugins#community-plugins)
to fix installations in such a case. to fix installations in such a case.
##### MacPorts
MacPorts Homebrew is used to find dependency packages if `port` is found on `PATH` in MacOS.
Set `PYTHON_BUILD_USE_MACPORTS` or `PYTHON_BUILD_SKIP_MACPORTS` to override this default.
###### Interaction with Homebrew
If both Homebrew and MacPorts are installed and allowed to be used, Homebrew takes preference.
There first ecosystem where any of the required dependency packages is found is used.
##### Portage ##### Portage
In FreeBSD, if `pkg` is on PATH, Ports are searched for some dependencies that Configure is known to not search for via `pkg-config`. In FreeBSD, if `pkg` is on PATH, Ports are searched for some dependencies that Configure is known to not search for via `pkg-config`.
@ -164,21 +182,23 @@ 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_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_ROOT` overrides the default location from where build definitions * `PYTHON_BUILD_ROOT` overrides the default location from where build definitions
in `share/python-build/` are looked up. in `share/python-build/` are looked up.
* `PYTHON_BUILD_DEFINITIONS` can be a list of colon-separated paths that get * `PYTHON_BUILD_DEFINITIONS` can be a list of colon-separated paths that get
additionally searched when looking up build definitions. additionally searched when looking up build definitions.
* `CC` sets the path to the C compiler. * `CC` sets the path to the C compiler.
* `PYTHON_CFLAGS` lets you pass additional options to the default `CFLAGS`. Use
this to override, for instance, the `-O3` option.
* `CONFIGURE_OPTS` lets you pass additional options to `./configure`. * `CONFIGURE_OPTS` lets you pass additional options to `./configure`.
* `MAKE` lets you override the command to use for `make`. Useful for specifying * `MAKE` lets you override the command to use for `make`. Useful for specifying
GNU make (`gmake`) on some systems. GNU make (`gmake`) on some systems.
* `MAKE_OPTS` (or `MAKEOPTS`) lets you pass additional options to `make`. * `MAKE_OPTS` (or `MAKEOPTS`) lets you pass additional options to `make`.
* `MAKE_INSTALL_OPTS` lets you pass additional options to `make install`. * `MAKE_INSTALL_OPTS` lets you pass additional options to `make install`.
* `PYTHON_CONFIGURE_OPTS` and `PYTHON_MAKE_OPTS` and `PYTHON_MAKE_INSTALL_OPTS` allow * `<PACKAGE>_CFLAGS`, `<PACKAGE>_CPPFLAGS`, `<PACKAGE>_LDFLAGS` let you pass additional options to `CFLAGS`/`CPPFLAGS`/`LDFLAGS` specifically for building `<package>` (Python itself or a dependency library) from source as part of the build script. `<PACKAGE>` should be a capitalized name of the package without version (technically, capitalized first argument to `install_package` without version). E.g. for CPython, it's "`PYTHON`", for Readline, "`READLINE`", for PyPy (only applies when building it from source), "`PYPY`". Check the source of the build script you're using if unsure.
you to specify configure and make options for building CPython. These variables * `<PACKAGE>_CONFIGURE_OPTS`, `<PACKAGE>_MAKE_OPTS`, `<PACKAGE>_MAKE_INSTALL_OPTS`, `<PACKAGE>_MAKE_INSTALL_TARGET` allow
will be passed to Python only, not any dependent packages (e.g. libyaml). you to specify configure and make options for building `<package>` (same as above). "Make install target" would replace "`install`" in the `make install` invocation.
### Applying patches to Python before compiling ### Applying patches to Python before compiling
@ -208,7 +228,7 @@ enables PGO (profile guided optimization). While your mileage may vary, it is
common for performance improvement from this to be in the ballpark of 30%. common for performance improvement from this to be in the ballpark of 30%.
```sh ```sh
env PYTHON_CONFIGURE_OPTS='--enable-optimizations --with-lto' PYTHON_CFLAGS='-march=native -mtune=native' pyenv install 3.6.0 env PYTHON_CONFIGURE_OPTS='--enable-optimizations --with-lto' PYTHON_CFLAGS='-march=native -mtune=native' pyenv install --verbose 3.6.0
``` ```
You can also customize the task used for profile guided optimization by setting You can also customize the task used for profile guided optimization by setting
@ -249,7 +269,7 @@ would be to make symlinks at the mirror's root:
``` ```
The rationale is to abstract away difference between directory structures of sites The rationale is to abstract away difference between directory structures of sites
of various Python flavors and their occasional changes as well as to accomodate of various Python flavors and their occasional changes as well as to accommodate
people who only wish to cache some select downloads. This also allows to mirror multiple sites at once. people who only wish to cache some select downloads. This also allows to mirror multiple sites at once.
If the mirror being used does not have the same checksum (*e.g.* with a If the mirror being used does not have the same checksum (*e.g.* with a

View File

@ -2,9 +2,9 @@
# #
# Summary: Install a Python version using python-build # Summary: Install a Python version using python-build
# #
# Usage: pyenv install [-f] [-kvp] <version>... # Usage: pyenv install [-f] [-kvp] <version>[:<alias>]...
# pyenv install [-f] [-kvp] <definition-file> # pyenv install [-f] [-kvp] <definition-file>[:<alias>]
# pyenv install -l|--list # pyenv install -l|--list [--bare]
# pyenv install --version # pyenv install --version
# #
# -l/--list List all available versions # -l/--list List all available versions
@ -20,6 +20,13 @@
# --version Show version of python-build # --version Show version of python-build
# -g/--debug Build a debug version # -g/--debug Build a debug version
# #
# Append `:<alias>' to a version to install it under a custom name, so that
# several builds of the same version can coexist:
#
# pyenv install 3.12.0:my-3.12
#
# This installs into $PYENV_ROOT/versions/my-3.12.
#
# For detailed information on installing Python versions with # For detailed information on installing Python versions with
# python-build, including a list of environment variables for adjusting # python-build, including a list of environment variables for adjusting
# compilation, see: https://github.com/pyenv/pyenv#readme # compilation, see: https://github.com/pyenv/pyenv#readme
@ -38,6 +45,7 @@ shopt -u nullglob
# Provide pyenv completions # Provide pyenv completions
if [ "$1" = "--complete" ]; then if [ "$1" = "--complete" ]; then
echo --bare
echo --list echo --list
echo --force echo --force
echo --skip-existing echo --skip-existing
@ -72,6 +80,8 @@ unset KEEP
unset VERBOSE unset VERBOSE
unset HAS_PATCH unset HAS_PATCH
unset DEBUG unset DEBUG
unset BARE
unset LIST
[ -n "$PYENV_DEBUG" ] && VERBOSE="-v" [ -n "$PYENV_DEBUG" ] && VERBOSE="-v"
@ -81,10 +91,11 @@ for option in "${OPTIONS[@]}"; do
"h" | "help" ) "h" | "help" )
usage 0 usage 0
;; ;;
"bare" )
BARE=1
;;
"l" | "list" ) "l" | "list" )
echo "Available versions:" LIST=1
definitions | indent
exit
;; ;;
"f" | "force" ) "f" | "force" )
FORCE=true FORCE=true
@ -113,6 +124,16 @@ for option in "${OPTIONS[@]}"; do
esac esac
done done
if [[ -n $LIST ]]; then
if [[ -n $BARE ]]; then
definitions
else
echo "Available versions:"
definitions | indent
fi
exit
fi
unset VERSION_NAME unset VERSION_NAME
# The first argument contains the definition to install. If the # The first argument contains the definition to install. If the
@ -123,6 +144,20 @@ DEFINITIONS=("${ARGUMENTS[@]}")
[[ "${#DEFINITIONS[*]}" -eq 0 ]] && DEFINITIONS=($(pyenv-local 2>/dev/null || true)) [[ "${#DEFINITIONS[*]}" -eq 0 ]] && DEFINITIONS=($(pyenv-local 2>/dev/null || true))
[[ "${#DEFINITIONS[*]}" -eq 0 ]] && usage 1 >&2 [[ "${#DEFINITIONS[*]}" -eq 0 ]] && usage 1 >&2
# A `<version>:<alias>` argument installs <version> under the custom name
# <alias>, so that several builds of the same version can coexist. The `latest`
# suffix is reserved for latest-version resolution (see the `install` hook), so
# it is left untouched here.
declare -a ALIASES
for i in "${!DEFINITIONS[@]}"; do
definition="${DEFINITIONS[$i]}"
alias="${definition##*:}"
if [[ "$definition" == *:* ]] && [ "$alias" != "latest" ]; then
DEFINITIONS[$i]="${definition%:*}"
ALIASES[$i]="$alias"
fi
done
# Define `before_install` and `after_install` functions that allow # Define `before_install` and `after_install` functions that allow
# plugin hooks to register a string of code for execution before or # plugin hooks to register a string of code for execution before or
# after the installation process. # after the installation process.
@ -152,18 +187,23 @@ IFS="$OLDIFS"
for script in "${scripts[@]}"; do source "$script"; done for script in "${scripts[@]}"; do source "$script"; done
COMBINED_STATUS=0 COMBINED_STATUS=0
for DEFINITION in "${DEFINITIONS[@]}"; do for i in "${!DEFINITIONS[@]}"; do
DEFINITION="${DEFINITIONS[$i]}"
VERSION_ALIAS="${ALIASES[$i]}"
STATUS=0 STATUS=0
# Try to resolve a prefix if user indeed gave a prefix. # Try to resolve a prefix if user indeed gave a prefix.
# We install the version under the resolved name # We install the version under the resolved name
# and hooks also see the resolved name # and hooks also see the resolved name
DEFINITION="$(pyenv-latest -q -k "$DEFINITION" || echo "$DEFINITION")" DEFINITION="$(pyenv-latest -f -k "$DEFINITION")"
# Set VERSION_NAME from $DEFINITION. Then compute the installation prefix. # Set VERSION_NAME from $DEFINITION. Then compute the installation prefix.
# With a `<version>:<alias>` argument, install under the alias instead;
# VERSION_NAME still reflects the real version so version-specific build logic
# (e.g. the bootstrap version detection below) keeps working.
VERSION_NAME="${DEFINITION##*/}" VERSION_NAME="${DEFINITION##*/}"
[ -n "$DEBUG" ] && VERSION_NAME="${VERSION_NAME}-debug" [ -n "$DEBUG" ] && VERSION_NAME="${VERSION_NAME}-debug"
PREFIX="${PYENV_ROOT}/versions/${VERSION_NAME}" PREFIX="${PYENV_ROOT}/versions/${VERSION_ALIAS:-$VERSION_NAME}"
[ -d "${PREFIX}" ] && PREFIX_EXISTS=1 [ -d "${PREFIX}" ] && PREFIX_EXISTS=1
@ -188,7 +228,7 @@ for DEFINITION in "${DEFINITIONS[@]}"; do
# If PYENV_BUILD_ROOT is set, always pass keep options to python-build. # If PYENV_BUILD_ROOT is set, always pass keep options to python-build.
if [ -n "${PYENV_BUILD_ROOT}" ]; then if [ -n "${PYENV_BUILD_ROOT}" ]; then
export PYTHON_BUILD_BUILD_PATH="${PYENV_BUILD_ROOT}/${VERSION_NAME}" export PYTHON_BUILD_BUILD_PATH="${PYENV_BUILD_ROOT}/${VERSION_ALIAS:-$VERSION_NAME}"
KEEP="-k" KEEP="-k"
fi fi
@ -256,7 +296,6 @@ for DEFINITION in "${DEFINITIONS[@]}"; do
# Display a more helpful message if the definition wasn't found. # Display a more helpful message if the definition wasn't found.
if [ "$STATUS" == "2" ]; then if [ "$STATUS" == "2" ]; then
{ candidates="$(definitions "$DEFINITION")" { candidates="$(definitions "$DEFINITION")"
here="$(dirname "${0%/*}")/../.."
if [ -n "$candidates" ]; then if [ -n "$candidates" ]; then
echo echo
echo "The following versions contain \`$DEFINITION' in the name:" echo "The following versions contain \`$DEFINITION' in the name:"
@ -266,12 +305,13 @@ for DEFINITION in "${DEFINITIONS[@]}"; do
echo "See all available versions with \`pyenv install --list'." echo "See all available versions with \`pyenv install --list'."
echo echo
echo -n "If the version you need is missing, try upgrading pyenv" echo -n "If the version you need is missing, try upgrading pyenv"
if [ "$here" != "${here#$(brew --prefix 2>/dev/null)}" ]; then declare brew_prefix
if brew_prefix="$(brew --prefix 2>/dev/null)" && [[ $_PYENV_INSTALL_PREFIX/ == "$brew_prefix/"* ]]; then
printf ":\n\n" printf ":\n\n"
echo " brew update && brew upgrade pyenv" echo " brew update && brew upgrade pyenv"
elif [ -d "${here}/.git" ]; then elif [ -d "${_PYENV_INSTALL_PREFIX}/.git" ]; then
printf ":\n\n" printf ":\n\n"
echo " cd ${here} && git pull && cd -" echo " cd ${_PYENV_INSTALL_PREFIX} && git pull && cd -"
else else
printf ".\n" printf ".\n"
fi fi

View File

@ -11,6 +11,7 @@
# See `pyenv versions` for a complete list of installed versions. # See `pyenv versions` for a complete list of installed versions.
# #
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x
# Provide pyenv completions # Provide pyenv completions
if [ "$1" = "--complete" ]; then if [ "$1" = "--complete" ]; then
@ -74,7 +75,7 @@ uninstall-python() {
exit 1 exit 1
fi fi
read -p "pyenv: remove $PREFIX? [y|N] " read -p "pyenv: remove $PREFIX? (y/N) "
case "$REPLY" in case "$REPLY" in
y | Y | yes | YES ) ;; y | Y | yes | YES ) ;;
* ) exit 1 ;; * ) exit 1 ;;

View File

@ -14,11 +14,12 @@
# -g/--debug Build a debug version # -g/--debug Build a debug version
# #
PYTHON_BUILD_VERSION="20180424" PYTHON_BUILD_VERSION="2.8.1"
OLDIFS="$IFS" OLDIFS="$IFS"
set -E set -E
shopt -s extglob
[ -n "$PYENV_DEBUG" ] && { [ -n "$PYENV_DEBUG" ] && {
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
set -x set -x
@ -26,7 +27,6 @@ set -E
exec 3<&2 # preserve original stderr at fd 3 exec 3<&2 # preserve original stderr at fd 3
lib() { lib() {
parse_options() { parse_options() {
OPTIONS=() OPTIONS=()
@ -80,7 +80,12 @@ abs_dirname() {
cd "$cd_path" cd "$cd_path"
fi fi
name="${path##*/}" name="${path##*/}"
if [[ $name == ".." ]]; then
cd ..
path="$PWD"
else
path="$(resolve_link "$name" || true)" path="$(resolve_link "$name" || true)"
fi
done done
echo "$PWD" echo "$PWD"
@ -105,7 +110,7 @@ os_information() {
if type -p lsb_release >/dev/null; then if type -p lsb_release >/dev/null; then
lsb_release -sir | xargs echo lsb_release -sir | xargs echo
elif type -p sw_vers >/dev/null; then elif type -p sw_vers >/dev/null; then
echo "OS X $(sw_vers -productVersion)" echo "OS X ${_PYTHON_BUILD_CACHE_SW_VERS:=$(sw_vers -productVersion)}"
elif [ -r /etc/os-release ]; then elif [ -r /etc/os-release ]; then
source /etc/os-release source /etc/os-release
echo "$NAME" $VERSION_ID echo "$NAME" $VERSION_ID
@ -116,22 +121,61 @@ os_information() {
} }
is_mac() { is_mac() {
[ "$(uname -s)" = "Darwin" ] || return 1 [ "${_PYTHON_BUILD_CACHE_UNAME_S:=$(uname -s)}" = "Darwin" ] || return 1
[ $# -eq 0 ] || [ "$(osx_version)" "$@" ] [ $# -eq 0 ] || [ "$(osx_version)" "$@" ]
} }
can_use_homebrew() { can_use_homebrew() {
if locked_in; then
locked_in homebrew && rc=$? || rc=$?; return $rc
fi
[[ -n "$PYTHON_BUILD_USE_HOMEBREW" && -n "$PYTHON_BUILD_SKIP_HOMEBREW" ]] && { [[ -n "$PYTHON_BUILD_USE_HOMEBREW" && -n "$PYTHON_BUILD_SKIP_HOMEBREW" ]] && {
echo "error: mutually exclusive environment variables PYTHON_BUILD_USE_HOMEBREW and PYTHON_BUILD_SKIP_HOMEBREW are set" >&3 echo "error: mutually exclusive environment variables PYTHON_BUILD_USE_HOMEBREW and PYTHON_BUILD_SKIP_HOMEBREW are set" >&3
exit 1 exit 1
} }
[[ -n "$PYTHON_BUILD_USE_HOMEBREW" ]] && return 0 [[ -n "$PYTHON_BUILD_USE_HOMEBREW" ]] && return 0
[[ -n "$PYTHON_BUILD_SKIP_HOMEBREW" ]] && return 1 [[ -n "$PYTHON_BUILD_SKIP_HOMEBREW" ]] && return 1
is_mac && return 0 is_mac && command -v brew &>/dev/null && return 0
# In Linux, if Pyenv itself is installed with Homebrew, # In Linux, if Pyenv itself is installed with Homebrew,
# we assume the user wants to take dependencies from there as well by default # we assume the user wants to take dependencies from there as well by default
command -v brew &>/dev/null && [[ $(abs_dirname "${BASH_SOURCE}") == "$(abs_dirname "$(brew --prefix 2>/dev/null ||true)")"/* ]] && return 0 local brew_prefix
return 1 command -v brew &>/dev/null && \
# tests can have non-functional `brew' stub aliased to `false'
# in Bash 3.2, var="$(cmd)" errexits on failure even if part of a conditional chain
brew_prefix="$(brew --prefix || true)" && [[ -n "$brew_prefix" ]] && \
[[ $(abs_dirname "${BASH_SOURCE}") == "$(abs_dirname "${brew_prefix}")"/* ]] && \
{ lock_in homebrew; return 0; }
# do not check the same stuff multiple times
PYTHON_BUILD_SKIP_HOMEBREW=1; return 1
}
can_use_macports() {
if locked_in; then
locked_in macports && rc=$? || rc=$?; return $rc
fi
[[ -n "$PYTHON_BUILD_USE_MACPORTS" && -n "$PYTHON_BUILD_SKIP_MACPORTS" ]] && {
echo "error: mutually exclusive environment variables PYTHON_BUILD_USE_MACPORTS and PYTHON_BUILD_SKIP_MACPORTS are set" >&3
exit 1
}
[[ -n "$PYTHON_BUILD_USE_MACPORTS" ]] && return 0
[[ -n "$PYTHON_BUILD_SKIP_MACPORTS" ]] && return 1
is_mac && command -v port &>/dev/null && return 0
# do not check the same stuff multiple times
PYTHON_BUILD_SKIP_MACPORTS=1; return 1
}
locked_in() {
if [[ -z "$1" ]]; then
[[ -n $_PYTHON_BUILD_ECOSYSTEM_LOCKED_IN ]]
else
[[ $_PYTHON_BUILD_ECOSYSTEM_LOCKED_IN == "$1" ]]
fi
}
lock_in() {
_PYTHON_BUILD_ECOSYSTEM_LOCKED_IN=${1:?}
} }
# 9.1 -> 901 # 9.1 -> 901
@ -139,7 +183,7 @@ can_use_homebrew() {
# 10.10 -> 1010 # 10.10 -> 1010
osx_version() { osx_version() {
local -a ver local -a ver
IFS=. ver=( `sw_vers -productVersion` ) IFS=. ver=( ${_PYTHON_BUILD_CACHE_SW_VERS:=$(sw_vers -productVersion)} )
IFS="$OLDIFS" IFS="$OLDIFS"
echo $(( ${ver[0]}*100 + ${ver[1]} )) echo $(( ${ver[0]}*100 + ${ver[1]} ))
} }
@ -158,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
@ -178,7 +229,7 @@ file_is_not_empty() {
num_cpu_cores() { num_cpu_cores() {
local num local num
case "$(uname -s)" in case "${_PYTHON_BUILD_CACHE_UNAME_S:=$(uname -s)}" in
Darwin | *BSD ) Darwin | *BSD )
num="$(sysctl -n hw.ncpu 2>/dev/null || true)" num="$(sysctl -n hw.ncpu 2>/dev/null || true)"
;; ;;
@ -414,7 +465,14 @@ http_head_curl() {
} }
http_get_curl() { http_get_curl() {
curl -q -o "${2:--}" -sSLf ${CURL_OPTS} "$1" local out;
# Curl is also available as a snap. Snaps cannot read or write /tmp
# (files cannot be found, any write result is silently discarded).
local curl_is_snap;
if [[ $(command -v curl) == "/snap/"* ]]; then curl_is_snap=1; fi
if [[ -n $2 && -n $curl_is_snap ]]; then out="$HOME/$(basename "$2")"; else out="$2"; fi
curl -q -o "${out:--}" -sSLf ${CURL_OPTS} "$1" || return $?
if [[ -n $out && -n $curl_is_snap ]]; then mv "$out" "$2"; fi
} }
http_head_wget() { http_head_wget() {
@ -557,7 +615,7 @@ download_tarball() {
} }
has_tar_xz_support() { has_tar_xz_support() {
tar Jcf - /dev/null 1>/dev/null 2>&1 [[ -z $_PYTHON_BUILD_FORCE_SKIP_XZ ]] && tar Jcf - /dev/null 1>/dev/null 2>&1
} }
fetch_git() { fetch_git() {
@ -810,23 +868,58 @@ build_package_standard_build() {
local PACKAGE_MAKE_OPTS="${package_var_name}_MAKE_OPTS" local PACKAGE_MAKE_OPTS="${package_var_name}_MAKE_OPTS"
local PACKAGE_MAKE_OPTS_ARRAY="${package_var_name}_MAKE_OPTS_ARRAY[@]" local PACKAGE_MAKE_OPTS_ARRAY="${package_var_name}_MAKE_OPTS_ARRAY[@]"
local PACKAGE_CFLAGS="${package_var_name}_CFLAGS" local PACKAGE_CFLAGS="${package_var_name}_CFLAGS"
local PACKAGE_CPPFLAGS="${package_var_name}_CPPFLAGS"
local PACKAGE_LDFLAGS="${package_var_name}_LDFLAGS"
if [ "$package_var_name" = "PYTHON" ]; then if [ "$package_var_name" = "PYTHON" ]; then
use_homebrew || true if can_use_homebrew; then
use_tcltk || true use_custom_tcltk || use_homebrew_tcltk || true
use_homebrew_readline || use_freebsd_pkg || true use_homebrew_readline || true
use_homebrew_ncurses || true use_homebrew_ncurses || true
if is_mac -ge 1014; then if is_mac -ge 1014; then
# While XCode SDK is "always available",
# still need a fallback in case we are using an alternate compiler
use_xcode_sdk_zlib || use_homebrew_zlib || true use_xcode_sdk_zlib || use_homebrew_zlib || true
else else
use_homebrew_zlib || true use_homebrew_zlib || true
fi fi
fi
if can_use_macports; then
use_custom_tcltk || true
use_macports_readline || true
use_macports_ncurses || true
if is_mac -ge 1014; then
# While XCode SDK is "always available",
# still need a fallback in case we are using an alternate compiler
use_xcode_sdk_zlib || use_homebrew_zlib || true
else
use_macports_zlib || true
fi
fi
if can_use_homebrew; then
use_homebrew || true
fi
if can_use_macports; then
use_macports || true
fi
if is_mac -ge 1014 && ! can_use_homebrew && ! can_use_macports; then
use_xcode_sdk_zlib || true
fi
use_freebsd_pkg || true
use_dsymutil || true use_dsymutil || true
use_free_threading || true use_free_threading || true
fi fi
( if [ "${CFLAGS+defined}" ] || [ "${!PACKAGE_CFLAGS+defined}" ]; then ( if [[ -n "${!PACKAGE_CFLAGS}" ]]; then
export CFLAGS="$CFLAGS ${!PACKAGE_CFLAGS}" export CFLAGS="${CFLAGS:+$CFLAGS }${!PACKAGE_CFLAGS}"
fi
if [[ -n "${!PACKAGE_CPPFLAGS}" ]]; then
export CPPFLAGS="${CPPFLAGS:+$CPPFLAGS }${!PACKAGE_CPPFLAGS}"
fi
if [[ -n "${!PACKAGE_LDFLAGS}" ]]; then
export LDFLAGS="${LDFLAGS:+$LDFLAGS }${!PACKAGE_LDFLAGS}"
fi fi
if [ -z "$CC" ] && is_mac -ge 1010; then if [ -z "$CC" ] && is_mac -ge 1010; then
export CC=clang export CC=clang
@ -962,7 +1055,7 @@ build_package_micropython() {
} }
pypy_architecture() { pypy_architecture() {
case "$(uname -s)" in case "${_PYTHON_BUILD_CACHE_UNAME_S:=$(uname -s)}" in
"Darwin" ) "Darwin" )
case "$(uname -m)" in case "$(uname -m)" in
"arm64" ) echo "osarm64" ;; "arm64" ) echo "osarm64" ;;
@ -994,7 +1087,7 @@ pypy_architecture() {
} }
graalpy_architecture() { graalpy_architecture() {
case "$(uname -s)" in case "${_PYTHON_BUILD_CACHE_UNAME_S:=$(uname -s)}" in
"Darwin" ) "Darwin" )
case "$(uname -m)" in case "$(uname -m)" in
"x86_64" ) echo "macos-amd64" ;; "x86_64" ) echo "macos-amd64" ;;
@ -1075,7 +1168,7 @@ build_package_pypy_builder() {
} }
activepython_architecture() { activepython_architecture() {
case "$(uname -s)" in case "${_PYTHON_BUILD_CACHE_UNAME_S:=$(uname -s)}" in
"Darwin" ) echo "macosx10.9-i386-x86_64" ;; "Darwin" ) echo "macosx10.9-i386-x86_64" ;;
"Linux" ) "Linux" )
case "$(uname -m)" in case "$(uname -m)" in
@ -1095,7 +1188,7 @@ build_package_activepython() {
} }
anaconda_architecture() { anaconda_architecture() {
case "$(uname -s)" in case "${_PYTHON_BUILD_CACHE_UNAME_S:=$(uname -s)}" in
"Darwin" ) "Darwin" )
case "$(uname -m)" in case "$(uname -m)" in
"arm64" ) echo "MacOSX-arm64" ;; "arm64" ) echo "MacOSX-arm64" ;;
@ -1151,8 +1244,8 @@ setup_builtin_patches() {
cat >"${package_name}.patch" cat >"${package_name}.patch"
HAS_PATCH=true HAS_PATCH=true
elif [[ -d "${package_patch_path}" ]]; then elif [[ -d "${package_patch_path}" ]]; then
{ find "${package_patch_path}" -maxdepth 1 -type f { find "${package_patch_path}" -maxdepth 1 -type f -print0
} 2>/dev/null | sort | xargs cat 1>"${package_name}.patch" } 2>/dev/null | sort -z | xargs -0 cat 1>"${package_name}.patch"
HAS_PATCH=true HAS_PATCH=true
fi fi
} }
@ -1372,7 +1465,7 @@ require_osx_version() {
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
local required_version="$@" local required_version="$@"
local osx_version="$(sw_vers -productVersion)" local osx_version="${_PYTHON_BUILD_CACHE_SW_VERS:=$(sw_vers -productVersion)}"
if [[ $(version $osx_version) -ge $(version $required_version) ]]; then if [[ $(version $osx_version) -ge $(version $required_version) ]]; then
return 0 return 0
fi fi
@ -1422,16 +1515,36 @@ use_homebrew() {
if command -v brew &>/dev/null; then if command -v brew &>/dev/null; then
local brew_prefix="$(brew --prefix 2>/dev/null || true)" local brew_prefix="$(brew --prefix 2>/dev/null || true)"
# /usr/local/lib:/usr/lib is the default library search path # /usr/local/lib:/usr/lib is the default library search path
if [[ -n $brew_prefix && $brew_prefix != "/usr" && $brew_prefix != "/usr/local" ]]; then if [[ -n $brew_prefix && ( ( $brew_prefix != "/usr" && $brew_prefix != "/usr/local" )
#when -isysroot is passed to Apple CLang, /usr/(local) are excluded from the default search path
|| ( is_mac && osx_using_default_compiler && $CFLAGS =~ (^|\ )-isysroot\ ) ) ]]; then
export CPPFLAGS="${CPPFLAGS:+$CPPFLAGS }-I${brew_prefix}/include" export CPPFLAGS="${CPPFLAGS:+$CPPFLAGS }-I${brew_prefix}/include"
append_ldflags_libs "-L${brew_prefix}/lib -Wl,-rpath,${brew_prefix}/lib" append_ldflags_libs "-L${brew_prefix}/lib -Wl,-rpath,${brew_prefix}/lib"
lock_in homebrew
fi fi
fi fi
} }
use_macports() {
can_use_macports || return 1
local port_location="$(command -v port)"
if [ -n "$port_location" ]; then
local prefix="${port_location%/bin/port}"
export CPPFLAGS="-I${prefix}/include${CPPFLAGS:+ $CPPFLAGS}"
prepend_ldflags_libs "-L${prefix}/lib -Wl,-rpath,${prefix}/lib"
export PKG_CONFIG_PATH="$prefix/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
lock_in macports
fi
}
needs_yaml() { needs_yaml() {
! configured_with_package_dir "python" "yaml.h" && if ! configured_with_package_dir "python" "yaml.h"; then
! use_homebrew_yaml if can_use_homebrew; then
use_homebrew_yaml && return 1
elif can_use_macports; then
use_macports_yaml && return 1
fi
fi
} }
use_homebrew_yaml() { use_homebrew_yaml() {
@ -1441,6 +1554,17 @@ use_homebrew_yaml() {
echo "python-build: use libyaml from homebrew" echo "python-build: use libyaml from homebrew"
export CPPFLAGS="-I$libdir/include${CPPFLAGS:+ $CPPFLAGS}" export CPPFLAGS="-I$libdir/include${CPPFLAGS:+ $CPPFLAGS}"
export LDFLAGS="-L$libdir/lib${LDFLAGS:+ ${LDFLAGS% }}" export LDFLAGS="-L$libdir/lib${LDFLAGS:+ ${LDFLAGS% }}"
lock_in homebrew
else
return 1
fi
}
use_macports_yaml() {
can_use_macports || return 1
if [[ $(port -q installed libyaml | awk '{print $3}') == "(active)" ]]; then
echo "python-build: use libyaml from MacPorts"
lock_in macports
else else
return 1 return 1
fi fi
@ -1448,14 +1572,14 @@ use_homebrew_yaml() {
use_freebsd_pkg() { use_freebsd_pkg() {
# check if FreeBSD # check if FreeBSD
if [ "FreeBSD" = "$(uname -s)" ]; then if [ "FreeBSD" = "${_PYTHON_BUILD_CACHE_UNAME_S:=$(uname -s)}" ]; then
# use openssl if installed from Ports Collection # use openssl if installed from Ports Collection
if pkg info -e openssl; then if pkg info -e openssl; then
package_option python configure --with-openssl="/usr/local" package_option python configure --with-openssl="/usr/local"
fi fi
# check if 11-R or later # check if 11-R or later
release="$(uname -r)" release="${_PYTHON_BUILD_CACHE_UNAME_R:=$(uname -r)}"
if [ "${release%%.*}" -ge 11 ]; then if [ "${release%%.*}" -ge 11 ]; then
# Use packages from Ports Collection. # Use packages from Ports Collection.
# #
@ -1479,9 +1603,17 @@ use_freebsd_pkg() {
has_broken_mac_readline() { has_broken_mac_readline() {
# Mac OS X 10.4 has broken readline. # Mac OS X 10.4 has broken readline.
# https://github.com/pyenv/pyenv/issues/23 # https://github.com/pyenv/pyenv/issues/23
is_mac && if ! is_mac || configured_with_package_dir "python" "readline/rlconf.h"; then
! configured_with_package_dir "python" "readline/rlconf.h" && # Not applicable.
! use_homebrew_readline return 1
fi
if can_use_homebrew; then
use_homebrew_readline && return 1
fi
if can_use_macports; then
use_macports_readline && return 1
fi
return 0
} }
use_homebrew_readline() { use_homebrew_readline() {
@ -1492,6 +1624,19 @@ use_homebrew_readline() {
echo "python-build: use readline from homebrew" echo "python-build: use readline from homebrew"
export CPPFLAGS="-I$libdir/include${CPPFLAGS:+ $CPPFLAGS}" export CPPFLAGS="-I$libdir/include${CPPFLAGS:+ $CPPFLAGS}"
export LDFLAGS="-L$libdir/lib${LDFLAGS:+ $LDFLAGS}" export LDFLAGS="-L$libdir/lib${LDFLAGS:+ $LDFLAGS}"
lock_in homebrew
else
return 1
fi
fi
}
use_macports_readline() {
can_use_macports || return 1
if ! configured_with_package_dir "python" "readline/rlconf.h"; then
if [[ $(port -q installed readline | awk '{print $3}') == "(active)" ]]; then
echo "python-build: use readline from MacPorts"
lock_in macports
else else
return 1 return 1
fi fi
@ -1505,21 +1650,45 @@ use_homebrew_ncurses() {
echo "python-build: use ncurses from homebrew" echo "python-build: use ncurses from homebrew"
export CPPFLAGS="-I$libdir/include${CPPFLAGS:+ $CPPFLAGS}" export CPPFLAGS="-I$libdir/include${CPPFLAGS:+ $CPPFLAGS}"
export LDFLAGS="-L$libdir/lib${LDFLAGS:+ $LDFLAGS}" export LDFLAGS="-L$libdir/lib${LDFLAGS:+ $LDFLAGS}"
lock_in homebrew
else
return 1
fi
}
use_macports_ncurses() {
can_use_macports || return 1
if [[ $(port -q installed ncurses | awk '{print $3}') == "(active)" ]]; then
echo "python-build: use ncurses from MacPorts"
lock_in macports
else else
return 1 return 1
fi fi
} }
prefer_openssl11() { prefer_openssl11() {
# 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)
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
PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA="${PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA:-openssl3 openssl openssl11}"
export PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA
}
prefer_openssl3_to_4() {
PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="${PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA:-openssl@3 openssl@4 openssl@1.1 openssl}"
export PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA
PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA="${PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA:-openssl3 openssl4 openssl openssl11}"
export PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA
} }
build_package_mac_readline() { build_package_mac_readline() {
@ -1539,8 +1708,15 @@ build_package_mac_readline() {
has_broken_mac_openssl() { has_broken_mac_openssl() {
is_mac || return 1 is_mac || return 1
local openssl_version="$(/usr/bin/openssl version 2>/dev/null || true)" local openssl_version="$(/usr/bin/openssl version 2>/dev/null || true)"
[[ $openssl_version = "OpenSSL 0.9.8"?* || $openssl_version = "LibreSSL"* ]] && if [[ $openssl_version = "OpenSSL 0.9.8"?* || $openssl_version = "LibreSSL"* ]]; then
! use_homebrew_openssl if can_use_homebrew; then
use_homebrew_openssl && return 1
fi
if can_use_macports; then
use_macports_openssl && return 1
fi
fi
return 0
} }
use_homebrew_openssl() { use_homebrew_openssl() {
@ -1550,16 +1726,53 @@ use_homebrew_openssl() {
local ssldir="$(brew --prefix "${openssl}" || true)" local ssldir="$(brew --prefix "${openssl}" || true)"
if [ -d "$ssldir" ]; then if [ -d "$ssldir" ]; then
echo "python-build: use ${openssl} from homebrew" echo "python-build: use ${openssl} from homebrew"
# Since 970acdcad3be4262451e9a5180a385dd2158eda3 (openssl@3 3.1.1),
# Homebrew's openssl@3 is no longer keg-only.
# Python's --with-openssl* appends flags to the compiler's command line,
# which in combination with adding Homebrew's general dir to flags
# always causes the build to link to the non-keg `openssl'
# when the non-keg-only formula is installed.
# To counter that, we have to prepend the openssl path to flags
# regardless of using Configure options.
if [[ -n "${PYTHON_BUILD_CONFIGURE_WITH_OPENSSL:-}" ]]; then if [[ -n "${PYTHON_BUILD_CONFIGURE_WITH_OPENSSL:-}" ]]; then
# configure script of newer CPython versions support `--with-openssl` # configure script of newer CPython versions support `--with-openssl`
# https://bugs.python.org/issue21541 # https://bugs.python.org/issue21541
package_option python configure --with-openssl="${ssldir}" package_option python configure --with-openssl="${ssldir}"
else
export CPPFLAGS="-I$ssldir/include ${CPPFLAGS:+ $CPPFLAGS}"
export LDFLAGS="-L$ssldir/lib${LDFLAGS:+ $LDFLAGS}"
fi fi
# 3.10.0+ (https://github.com/python/cpython/pull/24820)
# but has no effect until 3.11.0 (b9e9292d75fdea621e05e39b8629e6935d282d0d)
# and broken in MacOS until 3.12.2 (cc13eabc7ce08accf49656e258ba500f74a1dae8)
if [[ -n $PYTHON_BUILD_CONFIGURE_WITH_OPENSSL_RPATH ]]; then
package_option python configure --with-openssl-rpath="${ssldir}/lib"
fi
export CPPFLAGS="-I${ssldir}/include ${CPPFLAGS:+ $CPPFLAGS}"
export LDFLAGS="-L${ssldir}/lib -Wl,-rpath,${ssldir}/lib${LDFLAGS:+ $LDFLAGS}"
export PKG_CONFIG_PATH="$ssldir/lib/pkgconfig/:${PKG_CONFIG_PATH}" export PKG_CONFIG_PATH="$ssldir/lib/pkgconfig/:${PKG_CONFIG_PATH}"
return lock_in homebrew
return 0
fi
done
return 1
}
use_macports_openssl() {
can_use_macports || return 1
command -v port >/dev/null || return 1
local port_location="$(command -v port)"
local prefix="${port_location%/bin/port}"
# 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
echo "python-build: use ${openssl} from MacPorts"
if [[ -n "${PYTHON_BUILD_CONFIGURE_WITH_OPENSSL:-}" ]]; then
# configure script of newer CPython versions support `--with-openssl`
# https://bugs.python.org/issue21541
package_option python configure --with-openssl="${prefix}"
fi
lock_in macports
return 0
fi fi
done done
return 1 return 1
@ -1592,12 +1805,16 @@ build_package_mac_openssl() {
local nokerberos local nokerberos
[[ "$1" != openssl-1.0.* ]] || nokerberos=1 [[ "$1" != openssl-1.0.* ]] || nokerberos=1
# Compile a shared lib with zlib dynamically linked. # switches introduced in OpenSSL 1.1.1
package_option openssl configure --openssldir="$OPENSSLDIR" zlib-dynamic no-ssl3 shared ${nokerberos:+no-ssl2 no-krb5} local notests
[[ $(openssl_version $1) -ge 10101 ]] && notests=1
# Default MAKE_OPTS are -j 2 which can confuse the build. Thankfully, make # switches introduced in OpenSSL 3.2
# gives precedence to the last -j option, so we can override that. local extra_no_features
package_option openssl make -j 1 [[ $(openssl_version $1) -ge 30200 ]] && extra_no_features=1
# Compile a shared lib with zlib dynamically linked.
package_option openssl configure --openssldir="$OPENSSLDIR" zlib-dynamic no-ssl3 shared ${nokerberos:+no-ssl2 no-krb5} ${extra_no_features:+no-docs no-apps} ${notests:+no-tests}
build_package_standard "$@" build_package_standard "$@"
@ -1607,6 +1824,16 @@ build_package_mac_openssl() {
security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain >> "$pem_file" security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain >> "$pem_file"
} }
# openssl-1.0.1k -> 10001
# openssl-3.2.1 -> 30201
openssl_version() {
local -a ver
IFS=- ver=( ${1:?} )
IFS=. ver=( ${ver[1]} )
[[ ${ver[2]} =~ ^([[:digit:]]+)[[:alpha:]]$ ]] && ver[2]="${BASH_REMATCH[1]}"
echo $(( ${ver[0]}*10000 + ${ver[1]}*100 + ${ver[2]} ))
}
# Post-install check that the openssl extension was built. # Post-install check that the openssl extension was built.
build_package_verify_openssl() { build_package_verify_openssl() {
"$RUBY_BIN" -e ' "$RUBY_BIN" -e '
@ -1648,53 +1875,105 @@ use_homebrew_zlib() {
local brew_zlib="$(brew --prefix zlib 2>/dev/null || true)" local brew_zlib="$(brew --prefix zlib 2>/dev/null || true)"
if [ -d "$brew_zlib" ]; then if [ -d "$brew_zlib" ]; then
echo "python-build: use zlib from homebrew" echo "python-build: use zlib from homebrew"
export CFLAGS="-I${brew_zlib} ${CFLAGS}" export CPPFLAGS="-I${brew_zlib}/include${CPPFLAGS:+ ${CPPFLAGS}}"
export LDFLAGS="-L${brew_zlib}/lib${LDFLAGS:+ ${LDFLAGS}}"
lock_in homebrew
rc=0
fi fi
} }
use_xcode_sdk_zlib() { use_xcode_sdk_zlib() {
# If a custom compiler is used, including XCode SDK will likely break it # If a custom compiler is used, including XCode SDK will likely break it
[[ "${CC:-clang}" != "clang" || "$(command -v clang 2>/dev/null || true)" != "/usr/bin/clang" ]] && return 1 osx_using_default_compiler || return 1
local xc_sdk_path="$(xcrun --show-sdk-path 2>/dev/null || true)"
if [ -d "$xc_sdk_path" ]; then local sdkroot="$(xcrun --sdk macosx --show-sdk-path 2>/dev/null || true)"
[[ -z ${sdkroot} || ! -d ${sdkroot} ]] && return 1
# Since Xcode 16 / macOS SDK 15, Apple tightened how the linker uses SDK content:
# forcing -L "$SDK/usr/lib" now leads to odd link failures.
echo "python-build: use zlib from xcode sdk" echo "python-build: use zlib from xcode sdk"
# Even though SDK's compiler uses the SDK dirs implicitly, # Since 3.9.1 (bpo-41116), CPython's setup.py logic can search default SDK's sysroot itself
# CPython's setup.py has to have nonstandard paths specified explicitly # so we don't need to do anything
# to search for zlib.h in them # Since 2.7.12 and 3.5.2 (Issue #25136), distutils knows to look for Apple XCode 7+ stub libraries (.tbd)
export CPPFLAGS="${CPPFLAGS:+$CPPFLAGS }-I${xc_sdk_path}/usr/include" # when searching in the SDK
if is_mac -ge 1100; then # Since 2.7.4 and 3.2.1 (issue #7724), setup.py and distutils can search in the MacOS SDK when
export LDFLAGS="${LDFLAGS:+$LDFLAGS }-L${xc_sdk_path}/usr/lib" # it's explicitly specified with -isysroot
fi
#distutils.unixcompiler and setup.py specifically search CFLAGS for "-isysroot"
export CFLAGS="${CFLAGS:+$CFLAGS }-isysroot ${sdkroot}"
#while one can get away with adding it just to CFLAGS, this may cause linker failures
#if XCode is for a different major MacOS version (e.g. reported for XCode 12.4 on MacOS 10.15)
export LDFLAGS="${LDFLAGS:+$LDFLAGS }-isysroot ${sdkroot}"
return 0
}
osx_using_default_compiler() {
[[ "${CC:-clang}" == "clang" && "$(command -v clang 2>/dev/null || true)" == "/usr/bin/clang" ]]
}
use_macports_zlib() {
can_use_macports || return 1
if [[ $(port -q installed zlib | awk '{print $3}') == "(active)" ]]; then
echo "python-build: use zlib from MacPorts"
lock_in macports
else
return 1
fi fi
} }
use_homebrew_tcltk() { use_homebrew_tcltk() {
can_use_homebrew || return 1 can_use_homebrew || return 1
# get the version from the folder that homebrew versions local tcltk_formula
local tcltk_libdir="$(brew --prefix tcl-tk 2>/dev/null || true)" # Since https://github.com/Homebrew/homebrew-core/commit/f10e88617b41555193c22fdcba6109fe82155ee2 (10.11.2024),
if [ -d "$tcltk_libdir" ]; then # 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
echo "python-build: use tcl-tk from homebrew" # so we prefer 8
if [[ -z "$PYTHON_BUILD_TCLTK_USE_PKGCONFIG" ]]; then for tcltk_formula in ${PYTHON_BUILD_TCLTK_FORMULA:-tcl-tk@8 tcl-tk}; do
local tcltk_version="$(sh -c '. '"$tcltk_libdir"'/lib/tclConfig.sh; echo $TCL_VERSION')" local tcltk_prefix="$(brew --prefix "${tcltk_formula}" 2>/dev/null || true)"
package_option python configure --with-tcltk-libs="-L$tcltk_libdir/lib -ltcl$tcltk_version -ltk$tcltk_version" 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. # 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 local tcltk_includes="$(sh -c 'cd '"$tcltk_prefix"'/lib; . ./tclConfig.sh; . ./tkConfig.sh; echo "$TCL_INCLUDE_SPEC $TK_INCLUDE_SPEC"')"
# and we'd rather have rpath set to <brew prefix>/opt/<...> to allow micro release upgrades without rebuilding # 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
# XXX: do use tclConfig.sh and translate the paths if more path shenanigans appear in later releases local tcltk_cflags
if [ -d "$tcltk_libdir/include/tcl-tk" ]; then if sh -c '. '"$tcltk_prefix"'/lib/tclConfig.sh; echo "$TCL_DEFS"' | grep -qwFe '-DTCL_WITH_EXTERNAL_TOMMATH=1'; then
package_option python configure --with-tcltk-includes="-I$tcltk_libdir/include/tcl-tk" tcltk_cflags="-DTCL_WITH_EXTERNAL_TOMMATH=1"
fi
# 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
# pkg-config is not present out of the box in MacOS.
# 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${tcltk_cflags:+ $tcltk_cflags}"
export TCLTK_LIBS="$tcltk_libs"
else else
package_option python configure --with-tcltk-includes="-I$tcltk_libdir/include" 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 fi
#set in either case as a failsafe
export PKG_CONFIG_PATH="${tcltk_prefix}/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
lock_in homebrew
return 0
fi fi
export PKG_CONFIG_PATH="${tcltk_libdir}/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" done
fi return 1
} }
# FIXME: this function is a workaround for #1125 # FIXME: this function is a workaround for #1125
# once fixed, it should be removed. # once fixed, it should be removed.
# if tcltk_ops_flag is in PYTHON_CONFIGURE_OPTS, use user provided tcltk
use_custom_tcltk() { use_custom_tcltk() {
local tcltk_ops="$1" local tcltk_ops="$(get_tcltk_flag_from "$PYTHON_CONFIGURE_OPTS")"
if [[ -z "$tcltk_ops" ]]; then
return 1
fi
local tcltk_ops_flag="--with-tcltk-libs=" local tcltk_ops_flag="--with-tcltk-libs="
# get tcltk libs # get tcltk libs
local tcltk_libs="${tcltk_ops//$tcltk_ops_flag/}" local tcltk_libs="${tcltk_ops//$tcltk_ops_flag/}"
@ -1737,21 +2016,6 @@ get_tcltk_flag_from() {
IFS="$OLDIFS" IFS="$OLDIFS"
} }
use_tcltk() {
if can_use_homebrew; then
local tcltk_libdir="$(brew --prefix tcl-tk 2>/dev/null || true)"
fi
local tcl_tk_libs="$(get_tcltk_flag_from "$PYTHON_CONFIGURE_OPTS")"
# if tcltk_ops_flag is in PYTHON_CONFIGURE_OPTS, use user provided tcltk
# otherwise default to homebrew-installed tcl-tk, if installed
if [[ -n "$tcl_tk_libs" ]]; then
use_custom_tcltk "$tcl_tk_libs"
elif [ -d "$tcltk_libdir" ]; then
use_homebrew_tcltk
fi
}
# Since 3.12, CPython can add DWARF debug information in MacOS # Since 3.12, CPython can add DWARF debug information in MacOS
# using Apple's nonstandard way, `dsymutil', that creates a "dSYM bundle" # using Apple's nonstandard way, `dsymutil', that creates a "dSYM bundle"
# that's supposed to be installed alongside executables # that's supposed to be installed alongside executables
@ -1784,20 +2048,14 @@ build_package_auto_tcltk() {
fi fi
} }
# extglob must be set at both parse time and runtime
# https://stackoverflow.com/questions/49283740/bash-script-throws-syntax-errors-when-the-extglob-option-is-set-inside-a-subsh
shopt -s extglob
package_is_python() { package_is_python() {
shopt -s extglob
case "$1" in case "$1" in
Python-* | jython-* | pypy-* | pypy[0-9].+([0-9])-* | stackless-* ) Python-* | jython-* | pypy-* | pypy[0-9].+([0-9])-* | stackless-* )
return 0 return 0
;; ;;
esac esac
return 1 return 1
shopt -u extglob
} }
shopt -u extglob
apply_patch() { apply_patch() {
local package_name="$1" local package_name="$1"
@ -1855,9 +2113,11 @@ build_package_symlink_version_suffix() {
verify_python() { verify_python() {
build_package_symlink_version_suffix build_package_symlink_version_suffix
if [ ! -x "${PYTHON_BIN}" ]; then local python_bin="${PYTHON_BIN%/*}/python${1:?}"
if [ ! -x "${python_bin}" ]; then
{ colorize 1 "ERROR" { colorize 1 "ERROR"
echo ": invalid Python executable: ${PYTHON_BIN}" echo ": invalid Python executable: ${python_bin}"
echo echo
echo "The python-build could not find proper executable of Python after successful build." echo "The python-build could not find proper executable of Python after successful build."
echo "Please open an issue for future improvements." echo "Please open an issue for future improvements."
@ -2030,7 +2290,17 @@ build_package_verify_py313() {
# Post-install check for Python 3.14.x # Post-install check for Python 3.14.x
build_package_verify_py314() { build_package_verify_py314() {
build_package_verify_py313 "$1" "${2:-3.13}" build_package_verify_py313 "$1" "${2:-3.14}"
}
# Post-install check for Python 3.15.x
build_package_verify_py315() {
build_package_verify_py314 "$1" "${2:-3.15}"
}
# Post-install check for Python 3.16.x
build_package_verify_py316() {
build_package_verify_py315 "$1" "${2:-3.16}"
} }
# Post-install check for Python 3.x rolling release scripts # Post-install check for Python 3.x rolling release scripts
@ -2241,11 +2511,13 @@ if [ -n "$noexec" ]; then
fi fi
if [ -z "$MAKE" ]; then if [ -z "$MAKE" ]; then
if [ "FreeBSD" = "$(uname -s)" ]; then if [ "FreeBSD" = "${_PYTHON_BUILD_CACHE_UNAME_S:=$(uname -s)}" ]; then
if [ "$(echo $1 | sed 's/-.*$//')" = "jruby" ]; then if [ "$(echo $1 | sed 's/-.*$//')" = "jruby" ]; then
export MAKE="gmake" export MAKE="gmake"
else else
if [ "$(uname -r | sed 's/[^[:digit:]].*//')" -lt 10 ]; then # var assignment inside $() does not propagate due to being in subshell
: "${_PYTHON_BUILD_CACHE_UNAME_R:=$(uname -r)}"
if [ "$(echo "$_PYTHON_BUILD_CACHE_UNAME_R" | sed 's/[^[:digit:]].*//')" -lt 10 ]; then
export MAKE="gmake" export MAKE="gmake"
else else
export MAKE="make" export MAKE="make"
@ -2308,7 +2580,6 @@ if [[ "$PYPY_OPTS" == *"--shared"* ]]; then
fi fi
# Add support for framework installation (`--enable-framework`) of CPython (#55, #99) # Add support for framework installation (`--enable-framework`) of CPython (#55, #99)
shopt -s extglob
if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; then if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; then
if ! is_mac; then if ! is_mac; then
echo "python-build: framework installation is not supported outside of MacOS." >&2 echo "python-build: framework installation is not supported outside of MacOS." >&2
@ -2334,10 +2605,8 @@ if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; the
PYTHON_CONFIGURE_OPTS="${PYTHON_CONFIGURE_OPTS//--enable-framework?(=*([^ ]))?( )/}"; PYTHON_CONFIGURE_OPTS="${PYTHON_CONFIGURE_OPTS//--enable-framework?(=*([^ ]))?( )/}";
PYTHON_CONFIGURE_OPTS="${PYTHON_CONFIGURE_OPTS% }" PYTHON_CONFIGURE_OPTS="${PYTHON_CONFIGURE_OPTS% }"
fi fi
shopt -u extglob
# Build against universal SDK # Build against universal SDK
shopt -s extglob
if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-universalsdk"* ]]; then if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-universalsdk"* ]]; then
if ! is_mac; then if ! is_mac; then
echo "python-build: universal installation is not supported outside of MacOS." >&2 echo "python-build: universal installation is not supported outside of MacOS." >&2
@ -2359,7 +2628,6 @@ if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-universalsdk"* ]];
fi fi
fi fi
fi fi
shopt -u extglob
# Compile with `--enable-unicode=ucs4` by default (#257) # Compile with `--enable-unicode=ucs4` by default (#257)
if [[ "$PYTHON_CONFIGURE_OPTS" != *"--enable-unicode="* ]]; then if [[ "$PYTHON_CONFIGURE_OPTS" != *"--enable-unicode="* ]]; then
@ -2410,7 +2678,7 @@ if [ -z "${GET_PIP_URL}" ]; then
2.6 | 2.6.* ) 2.6 | 2.6.* )
GET_PIP_URL="https://bootstrap.pypa.io/pip/2.6/get-pip.py" GET_PIP_URL="https://bootstrap.pypa.io/pip/2.6/get-pip.py"
;; ;;
2.7 | 2.7.* | pypy2.7 | pypy2.7-* ) 2.7 | 2.7.* | pypy2.7 | pypy2.7-* | pypy-c-jit-* )
GET_PIP_URL="https://bootstrap.pypa.io/pip/2.7/get-pip.py" GET_PIP_URL="https://bootstrap.pypa.io/pip/2.7/get-pip.py"
;; ;;
3.2 | 3.2.* ) 3.2 | 3.2.* )
@ -2428,6 +2696,15 @@ if [ -z "${GET_PIP_URL}" ]; then
3.6 | 3.6.* | pypy3.6 | pypy3.6-* ) 3.6 | 3.6.* | pypy3.6 | pypy3.6-* )
GET_PIP_URL="https://bootstrap.pypa.io/pip/3.6/get-pip.py" GET_PIP_URL="https://bootstrap.pypa.io/pip/3.6/get-pip.py"
;; ;;
3.7 | 3.7.* | pypy3.7 | pypy3.7-* )
GET_PIP_URL="https://bootstrap.pypa.io/pip/3.7/get-pip.py"
;;
3.8 | 3.8.* | pypy3.8 | pypy3.8-* | pyston* )
GET_PIP_URL="https://bootstrap.pypa.io/pip/3.8/get-pip.py"
;;
3.9 | 3.9.* | pypy3.9 | pypy3.9-* )
GET_PIP_URL="https://bootstrap.pypa.io/pip/3.9/get-pip.py"
;;
* ) * )
GET_PIP_URL="https://bootstrap.pypa.io/get-pip.py" GET_PIP_URL="https://bootstrap.pypa.io/get-pip.py"
;; ;;
@ -2438,7 +2715,7 @@ fi
# Set MACOSX_DEPLOYMENT_TARGET from the product version of OS X (#219, #220) # Set MACOSX_DEPLOYMENT_TARGET from the product version of OS X (#219, #220)
if is_mac; then if is_mac; then
if [ -z "${MACOSX_DEPLOYMENT_TARGET}" ]; then if [ -z "${MACOSX_DEPLOYMENT_TARGET}" ]; then
MACOS_VERSION="$(sw_vers -productVersion 2>/dev/null || true)" MACOS_VERSION="${_PYTHON_BUILD_CACHE_SW_VERS:=$(sw_vers -productVersion)}"
MACOS_VERSION_ARRAY=(${MACOS_VERSION//\./ }) MACOS_VERSION_ARRAY=(${MACOS_VERSION//\./ })
if [ "${#MACOS_VERSION_ARRAY[@]}" -ge 2 ]; then if [ "${#MACOS_VERSION_ARRAY[@]}" -ge 2 ]; then
export MACOSX_DEPLOYMENT_TARGET="${MACOS_VERSION_ARRAY[0]}.${MACOS_VERSION_ARRAY[1]}" export MACOSX_DEPLOYMENT_TARGET="${MACOS_VERSION_ARRAY[0]}.${MACOS_VERSION_ARRAY[1]}"
@ -2454,6 +2731,7 @@ python_bin_suffix() {
version_name="${version_name%-dev}" version_name="${version_name%-dev}"
version_name="${version_name%-rc*}" version_name="${version_name%-rc*}"
version_name="${version_name%rc*}" version_name="${version_name%rc*}"
version_name="${version_name%%*([^0-9])}"
version_info=(${version_name//./ }) version_info=(${version_name//./ })
echo "${version_info[0]}.${version_info[1]}" echo "${version_info[0]}.${version_info[1]}"
;; ;;

View File

@ -0,0 +1 @@
/venv

View File

@ -0,0 +1,758 @@
#!/usr/bin/env python3
"""Script to add CPython releases.
Checks the CPython download archives for new versions,
then writes a build script for any which do not exist locally,
saving it to plugins/python-build/share/python-build.
"""
import argparse
import dataclasses
import hashlib
import io
import itertools
import logging
import operator
import os.path
import pathlib
import pprint
import re
import shutil
import subprocess
import sys
import typing
import urllib.parse
import jc
import more_itertools
import packaging.version
import requests
import requests_html
import sortedcontainers
import tqdm
logger = logging.getLogger(__name__)
CUTOFF_VERSION=packaging.version.Version('3.10')
EXCLUDED_VERSIONS= {
}
here = pathlib.Path(__file__).resolve()
OUT_DIR: pathlib.Path = here.parent.parent / "share" / "python-build"
AUTO_ADD_VERSION_REF_RE = re.compile(
r"^(?P<object_id>[0-9a-f]{40,64})\t"
r"refs/heads/auto_add_version/(?P<versions>\S+)$"
)
OPENSSL_RELEASE_TAG_RE = re.compile(
r"^openssl-(?P<major>\d+)\.\d+(?:\.\d+)*(?:[a-z]+\d*)?$"
)
T_THUNK=\
'''export PYTHON_BUILD_FREE_THREADING=1
source "${BASH_SOURCE[0]%t}"
'''
def adapt_script(version: packaging.version.Version,
previous_version: packaging.version.Version) -> typing.Union[pathlib.Path, None]:
previous_version_path = OUT_DIR.joinpath(str(previous_version))
with previous_version_path.open("r", encoding='utf-8') as f:
script = f.readlines()
result = io.StringIO()
for line in script:
if m:=re.match(r'\s*install_package\s+"(?P<package>Python-\S+)"\s+'
r'"(?P<url>\S+)"\s+.*\s+verify_py(?P<verify_py_suffix>\d+)\s+.*$',
line):
existing_url_path = urllib.parse.urlparse(m.group('url')).path
try:
matched_download = more_itertools.one(
item for item in VersionDirectory.available[version].downloads
if existing_url_path.endswith(item.extension))
except ValueError:
logger.error(f'Cannot match existing URL path\'s {existing_url_path} extension '
f'to available downloads {VersionDirectory.available[version].downloads}')
return
new_package_name, new_package_url = matched_download.package_name, matched_download.url
new_package_hash = Url.sha256_url(new_package_url, VersionDirectory.session)
verify_py_suffix = str(version.major)+str(version.minor)
line = Re.sub_groups(m,
package=new_package_name,
url=new_package_url+'#'+new_package_hash,
verify_py_suffix=verify_py_suffix)
elif m:=re.match(r'\s*install_package\s+'
r'"(?P<package>openssl-(?P<openssl_major>\d+)\.\S+)"\s+'
r'"(?P<url>\S+)"\s.*$',
line):
item = VersionDirectory.openssl.get_store_latest_release(
int(m.group('openssl_major'))
)
line = Re.sub_groups(m,
package=item.package_name,
url=item.url + '#' + item.hash)
elif m:=re.match(r'\s*install_package\s+"(?P<package>readline-\S+)"\s+'
r'"(?P<url>\S+)"\s.*$',
line):
item = VersionDirectory.readline.get_store_latest_release()
line = Re.sub_groups(m,
package=item.package_name,
url=item.url + '#' + item.hash)
result.write(line)
result_path = OUT_DIR.joinpath(str(version))
logger.info(f"Writing {result_path}")
result_path.write_text(result.getvalue(), encoding='utf-8')
result.close()
return result_path
def add_version(version: packaging.version.Version):
previous_version = VersionDirectory.existing.pick_previous_version(version).version
is_prerelease_upgrade = previous_version.major==version.major\
and previous_version.minor==version.minor\
and previous_version.micro==version.micro
logger.info(f"Adding {version} based on {previous_version}"
+ (" (prerelease upgrade)" if is_prerelease_upgrade else ""))
VersionDirectory.available.get_store_available_source_downloads(version)
new_path = adapt_script(version,
previous_version)
if not new_path:
return False
VersionDirectory.existing.append(_CPythonExistingScriptInfo(version,str(new_path)))
handle_version_patches(version, previous_version, is_prerelease_upgrade)
cleanup_prerelease_upgrade(is_prerelease_upgrade, previous_version, version)
handle_t_thunks(version, previous_version, is_prerelease_upgrade)
print(version)
return True
def handle_version_patches(
version: packaging.version.Version,
previous_version: packaging.version.Version,
is_prerelease_upgrade: bool)\
-> None:
if (previous_version.major, previous_version.minor) != (version.major, version.minor):
return
patches_dir = OUT_DIR / "patches"
previous_patches = patches_dir / str(previous_version)
if not previous_patches.exists():
return
new_patches = patches_dir / str(version)
if is_prerelease_upgrade:
logger.info(f"Git moving patches from {previous_version} to {version}")
subprocess.check_call((
"git", "-C", OUT_DIR, "mv",
f"patches/{previous_version}",
f"patches/{version}",
))
else:
logger.info(f"Copying patches from {previous_version} to {version}")
shutil.copytree(previous_patches, new_patches)
# Subdir rename as a separate step from upper dir copying/moving
# in case there are patches for dependency packages as well
previous_package_patches = new_patches / f"Python-{previous_version}"
new_package_patches = new_patches / f"Python-{version}"
if is_prerelease_upgrade:
subprocess.check_call((
"git", "-C", OUT_DIR, "mv",
f"patches/{version}/Python-{previous_version}",
f"patches/{version}/Python-{version}",
))
else:
previous_package_patches.rename(new_package_patches)
if uses_t_thunks(previous_version) and is_prerelease_upgrade:
(patches_dir / f"{previous_version}t").unlink(missing_ok=True)
if uses_t_thunks(version):
(patches_dir / f"{version}t").symlink_to(
str(version), target_is_directory=True
)
def cleanup_prerelease_upgrade(
is_prerelease_upgrade: bool,
previous_version: packaging.version.Version,
new_version: packaging.version.Version)\
-> None:
if not is_prerelease_upgrade:
return
previous_version_filename = str(previous_version)
new_version_filename = str(new_version)
new_version_path = OUT_DIR / new_version_filename
logger.info(f'Git moving {previous_version_filename} '
f'to {new_version_filename} (preserving new data)')
data = new_version_path.read_text()
new_version_path.unlink()
subprocess.check_call(("git","-C",OUT_DIR,
"mv",
previous_version_filename,
new_version_filename))
new_version_path.write_text(data)
del VersionDirectory.existing[previous_version]
def handle_t_thunks(version, previous_version, is_prerelease_upgrade):
if not uses_t_thunks(version):
return
# an old thunk may have older version-specific code
# so it's safer to write a known version-independent template
thunk_name = (str(version) + "t")
thunk_path = OUT_DIR / thunk_name
previous_thunk_name = str(previous_version) + "t"
if is_prerelease_upgrade:
logger.info(f"Git moving {previous_thunk_name} to {thunk_name}")
subprocess.check_call(("git","-C",OUT_DIR,
"mv",
previous_thunk_name,
thunk_name))
logger.info(f"Writing {thunk_path}")
thunk_path.write_text(T_THUNK, encoding='utf-8')
def uses_t_thunks(version: packaging.version.Version) -> bool:
return (version.major, version.minor) >= (3, 13)
Arguments: argparse.Namespace
def main():
global Arguments
Arguments = parse_args()
logging.basicConfig(level=logging.DEBUG if Arguments.verbose else logging.INFO)
cached_session=requests_html.HTMLSession()
global VersionDirectory
VersionDirectory = _VersionDirectory(cached_session)
VersionDirectory.existing.populate()
VersionDirectory.available.populate()
# Prereleases are placed under the same directory as the corresponding release.
# So until we know the release is out, its directory is a potential prerelease directory.
# Normally, prereleases are only made for initial releases (x.y.0) --
# but rarely, they may make them for other releases (e.g. 3.14.5).
for release in (v for v in frozenset(VersionDirectory.available.keys()) #refining alters the
#corresponding directory key
#which breaks iteration
#over the directory --
#so have to iterate over a copy
if v not in VersionDirectory.existing):
VersionDirectory.available.get_store_available_source_downloads(release, True)
del release
# Excluding versions for which there already are PRs.
# This will prevent us from using advanced features of
# peter-evans/create-pull-request Github Action
# like updating a PR and closing a superseded PR
# but we don't really need them as of this writing.
versions_to_add = sorted(
VersionDirectory.available.keys()
- VersionDirectory.existing.keys()
- get_pending_versions()
)
logger.info("Versions to add:\n"+pprint.pformat(versions_to_add))
result = False
for version_to_add in versions_to_add:
result = add_version(version_to_add) or result
return int(not result)
def get_pending_versions() -> typing.Set[packaging.version.Version]:
ls_remote = subprocess.check_output(
("git", "-C", OUT_DIR, "ls-remote", "origin",
"refs/heads/auto_add_version/*"),
text=True,
timeout=30,
)
pending_versions = set()
for line in ls_remote.splitlines():
if not (match := AUTO_ADD_VERSION_REF_RE.fullmatch(line)):
raise ValueError(f"Unexpected git ls-remote output line: {line!r}")
pending_versions.update(
packaging.version.Version(version)
for version in match.group("versions").split("_")
)
return pending_versions
def parse_args():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"-d", "--dry-run", action="store_true",
help="Do not write scripts, just report them to stdout",
)
parser.add_argument(
"-v", "--verbose", action="store_true", default=0,
help="Increase verbosity of logging",
)
parsed = parser.parse_args()
return parsed
T = typing.TypeVar('T', bound=object)
K = typing.TypeVar('K', bound=typing.Hashable)
class KeyedList(typing.List[T], typing.Mapping[K, T]):
key_field: str
item_init: typing.Callable[..., T] = None
def __init__(self, seq: typing.Union[typing.Iterable[T], None] = None):
super().__init__()
self._map = {}
if seq is not None:
self.__iadd__(seq)
# read
def __getitem__(self, key: K) -> T:
return self._map[key]
def __contains__(self, key: K):
return key in self._map
def keys(self) -> typing.AbstractSet[K]:
return self._map.keys()
# write
def append(self, item: T) -> None:
key = self._getkey(item)
if key in self:
raise ValueError(f"Key '{key:r}' already present")
super().append(item)
self._map[key] = item
def __iadd__(self, other: typing.Iterable[T]):
for item in other:
self.append(item)
return self
def __delitem__(self, key: K):
super().remove(self[key])
del self._map[key]
def clear(self):
super().__delitem__(slice(None,None))
self._map.clear()
# read-write
def get_or_create(self, key: K, **kwargs):
try:
return self[key]
except KeyError as e:
if self.item_init is None:
raise AttributeError("'item_init' must be set to use automatic item creation") from e
kwargs[self.key_field] = key
item = self.item_init(**kwargs)
self.append(item)
return item
# info
def __repr__(self):
return self.__class__.__name__ + "([" + ", ".join(repr(i) for i in self) + "])"
# private
def _getkey(self, item: T) -> K:
return getattr(item, self.key_field)
del T, K
@dataclasses.dataclass(frozen=True)
class _CPythonAvailableVersionDownloadInfo:
extension: str
package_name: str
url: str
class _CPythonAvailableVersionDownloadsDirectory(KeyedList[_CPythonAvailableVersionDownloadInfo, str]):
key_field = "extension"
@dataclasses.dataclass(frozen=True)
class _CPythonAvailableVersionInfo:
version: packaging.version.Version
download_page_url: str
downloads: _CPythonAvailableVersionDownloadsDirectory = dataclasses.field(
default_factory=lambda:_CPythonAvailableVersionDownloadsDirectory()
)
class CPythonAvailableVersionsDirectory(KeyedList[_CPythonAvailableVersionInfo, packaging.version.Version]):
key_field = "version"
_session: requests.Session
item_init = _CPythonAvailableVersionInfo
def __init__(self, session: requests.Session, seq=None):
super().__init__(seq)
self._session = session
def populate(self):
"""
Fetch remote versions
"""
logger.info("Fetching available CPython versions")
for name, url in DownloadPage.enum_download_entries(
"https://www.python.org/ftp/python/",
r'^(\d+.*)/$', self._session,
make_name= lambda m: m.group(1)
):
v = packaging.version.Version(name)
if v < CUTOFF_VERSION or v in EXCLUDED_VERSIONS:
continue
logger.debug(f'Available version: {name} ({v}), {url}')
self.append(_CPythonAvailableVersionInfo(
v,
url
))
def get_store_available_source_downloads(self, version, refine_mode=False):
entry = self[version]
if entry.downloads:
#already retrieved
return
additional_versions_found =\
CPythonAvailableVersionsDirectory(self._session) if refine_mode else None
exact_download_found = False
for name, url in DownloadPage.enum_download_entries(
entry.download_page_url,
r'Python-.*\.(tar\.xz|tgz)$',
self._session):
m = re.match(r'(?P<package>Python-(?P<version>.*))\.(?P<extension>tar\.xz|tgz)$', name)
download_version = packaging.version.Version(m.group("version"))
if download_version != version:
if not refine_mode:
logger.warning(f"Ignoring download {name} ({download_version}) "
f"for {version} at page {entry.download_page_url}")
continue
entry_to_fill = additional_versions_found.get_or_create(
download_version,
download_page_url=entry.download_page_url
)
else:
exact_download_found = True
entry_to_fill = entry
entry_to_fill.downloads.append(_CPythonAvailableVersionDownloadInfo(
m.group("extension"), m.group('package'), url
))
# XXX: Exact download not found in non-refine mode never happens now
# 'cuz we first call the function in refine mode.
# Decide what's best to do if it starts to after a logic change.
if not exact_download_found and refine_mode:
actual_version = max(additional_versions_found.keys())
logger.debug(f"Refining available version {version} to {actual_version}")
del self[version]
self.append(
additional_versions_found[
actual_version
])
class _CPythonExistingScriptInfo(typing.NamedTuple):
version: packaging.version.Version
filename: str
class CPythonExistingScriptsDirectory(KeyedList[_CPythonExistingScriptInfo, packaging.version.Version]):
key_field = "version"
_filename_pattern = r'^\d+\.\d+(?:(t?)(-\w+)|(.\d+((?:a|b|rc)\d)?(t?)))$'
def populate(self):
"""
Enumerate existing installation scripts in share/python-build/ by pattern
"""
logger.info(f"Enumerating existing versions in {OUT_DIR}")
for entry_name in (p.name for p in OUT_DIR.iterdir() if p.is_file()):
if (not (m := re.match(self._filename_pattern, entry_name))
or m.group(1) == 't' or m.group(5) == 't'):
continue
try:
v = packaging.version.Version(entry_name)
if v < CUTOFF_VERSION:
continue
# branch tip scripts are different from release scripts and thus unusable as a pattern
if v.dev is not None:
continue
logger.debug(f"Existing version {v}")
self.append(_CPythonExistingScriptInfo(v, entry_name))
except ValueError as e:
logger.error(f"Unable to parse existing version {entry_name}: {e}")
def pick_previous_version(self,
version: packaging.version.Version) \
-> _CPythonExistingScriptInfo:
return max(v for v in self if v.version < version)
class _OpenSSLVersionInfo(typing.NamedTuple):
version: packaging.version.Version
package_name: str
url: str
hash: str
class OpenSSLVersionsDirectory(KeyedList[_OpenSSLVersionInfo, packaging.version.Version]):
key_field = "version"
def get_store_latest_release(self, major: int) \
-> _OpenSSLVersionInfo:
matching = [
release for release in self
if release.version.major == major
]
if matching:
return max(matching, key=lambda release: release.version)
url = "https://api.github.com/repos/openssl/openssl/releases"
while url:
response = Requests.get(url)
matching = [
release
for release in response.json()
if not release['draft']
and not release['prerelease']
and (match := OPENSSL_RELEASE_TAG_RE.fullmatch(
release['tag_name']
))
and int(match.group('major')) == major
]
if matching:
j_release = matching[0]
break
url = response.links.get('next', {}).get('url')
else:
raise ValueError(f"No OpenSSL {major}.x release found")
# noinspection PyTypeChecker
# urlparse can parse str as well as bytes
shasum_url = more_itertools.one(
asset['browser_download_url']
for asset in j_release['assets']
if urllib.parse.urlparse(asset['browser_download_url']).path.split('/')[-1].endswith('.sha256')
)
shasum_text = Requests.get(shasum_url).text
shasum_data = jc.parse("hashsum", shasum_text, quiet=True)[0]
package_hash, package_filename = shasum_data["hash"], shasum_data["filename"]
del shasum_data, shasum_text, shasum_url
# OpenSSL Github repo has tag names "openssl-<version>" as of this writing like we need
# but let's not rely on that
# splitext doesn't work with a chained extension, it only splits off the last one
package_name, package_version_str = re.match(r"([^-]+-(.*?))\.\D", package_filename).groups()
package_version = packaging.version.Version(package_version_str)
package_url = more_itertools.one(
asset['browser_download_url']
for asset in j_release['assets']
if urllib.parse.urlparse(asset['browser_download_url']).path.split('/')[-1] == package_filename
)
result = _OpenSSLVersionInfo(package_version, package_name, package_url, package_hash)
self.append(result)
return result
class _ReadlineVersionInfo(typing.NamedTuple):
version : packaging.version.Version
package_name : str
url : str
hash : str
class ReadlineVersionsDirectory(KeyedList[_ReadlineVersionInfo, packaging.version.Version]):
key_field = "version"
def get_store_latest_release(self):
if not self:
self._store_latest_release()
return self._latest_release()
def _store_latest_release(self):
candidates = ReadlineVersionsDirectory()
pattern = r'(?P<package_name>readline-(?P<version>\d+(?:\.\d+)+)).tar\.gz$'
for name, url in DownloadPage.enum_download_entries(
'https://ftpmirror.gnu.org/readline/', pattern, VersionDirectory.session):
m = re.match(pattern, name)
version = packaging.version.Version(m.group('version'))
candidates.append(_ReadlineVersionInfo(
version,
m.group('package_name'),
url,
""
))
max_item = candidates._latest_release()
hash_ = Url.sha256_url(max_item.url, VersionDirectory.session)
permalink = 'https://ftpmirror.gnu.org/readline/' +\
os.path.basename(urllib.parse.urlparse(max_item.url).path)
result = _ReadlineVersionInfo(
max_item.version,
max_item.package_name,
permalink,
hash_)
self.append(result)
return result
def _latest_release(self):
return self[max(self.keys())]
class _VersionDirectory:
def __init__(self, session):
self.existing = CPythonExistingScriptsDirectory()
self.available = CPythonAvailableVersionsDirectory(session)
self.openssl = OpenSSLVersionsDirectory()
self.readline = ReadlineVersionsDirectory()
self.session = session
VersionDirectory : _VersionDirectory
class DownloadPage:
class _DownloadPageEntry(typing.NamedTuple):
name: str
url: str
@classmethod
def enum_download_entries(cls, url, pattern, session=None,
make_name = lambda m: m.string ) \
-> typing.Generator[_DownloadPageEntry, None, None]:
"""
Enum download entries in a standard Apache directory page
(incl. CPython download page https://www.python.org/ftp/python/)
or a GNU mirror directory page
(https://ftpmirror.gnu.org/<package>/ destinations)
"""
if session is None:
session = requests_html.HTMLSession()
response = session.get(url, timeout=30)
response.raise_for_status()
page = response.html
table = page.find("pre", first=True)
# some GNU mirrors format entries as a table
# (e.g. https://mirrors.ibiblio.org/gnu/readline/)
if table is None:
table = page.find("table", first=True)
links = table.find("a")
for link in links:
href = link.attrs['href']
# CPython entries are directories
name = link.text
# skip directory entries
if not (m:=re.match(pattern, name)):
continue
name = make_name(m)
yield cls._DownloadPageEntry(name, urllib.parse.urljoin(response.url, href))
class Re:
@dataclasses.dataclass
class _interval:
group: typing.Union[int, str, None]
start: int
end: int
@staticmethod
def sub_groups(match: re.Match,
/, *args: [typing.AnyStr],
**kwargs: [typing.AnyStr])\
-> typing.AnyStr:
repls={i:repl for i,repl in enumerate(args) if repl is not None}
repls.update({n:repl for n,repl in kwargs.items() if repl is not None})
intervals: sortedcontainers.SortedList[Re._interval]=\
sortedcontainers.SortedKeyList(key=operator.attrgetter("start","end"))
for group_id in itertools.chain(range(1,len(match.groups())), match.groupdict().keys()):
if group_id not in repls:
continue
if match.start(group_id) == -1:
continue
intervals.add(Re._interval(group_id,match.start(group_id),match.end(group_id)))
del group_id
last_interval=Re._interval(None,0,0)
result=""
for interval in intervals:
if interval.start < last_interval.end:
raise ValueError(f"Cannot replace intersecting matches "
f"for groups {last_interval.group} and {interval.group} "
f"(position {interval.start})")
if interval.end == interval.start and \
last_interval.start == last_interval.end == interval.start:
raise ValueError(f"Cannot replace consecutive zero-length matches "
f"for groups {last_interval.group} and {interval.group} "
f"(position {interval.start})")
result+=match.string[last_interval.end:interval.start]+repls[interval.group]
last_interval = interval
result+=match.string[last_interval.end:]
return result
class Url:
@staticmethod
def sha256_url(url, session=None):
if session is None:
session = requests_html.HTMLSession()
logger.info(f"Downloading and computing hash of {url}")
h=hashlib.sha256()
r=session.get(url,stream=True,timeout=30)
total_bytes=int(r.headers.get('content-length',0)) or float('inf')
with tqdm.tqdm(total=total_bytes, unit='B', unit_scale=True, unit_divisor=1024) as t:
for c in r.iter_content(1024):
t.update(len(c))
h.update(c)
return h.hexdigest()
class Requests:
@staticmethod
def get(url: str) -> requests.Response:
response = requests.get(url, timeout=30)
response.raise_for_status()
return response
if __name__ == "__main__":
#sys.excepthook seems to have no effect in Github Actions
try:
sys.exit(main())
except Exception:
logging.exception("Unhandled exception occurred")
sys.exit(2)

View File

@ -11,15 +11,18 @@ Also ignores sub-patch releases if that major.minor.patch already exists,
but otherwise, takes the latest sub-patch release for given OS/arch. but otherwise, takes the latest sub-patch release for given OS/arch.
Assumes all miniconda3 releases < 4.7 default to python 3.6, and anything else 3.7. Assumes all miniconda3 releases < 4.7 default to python 3.6, and anything else 3.7.
""" """
import logging
import re
import string
import sys
import textwrap import textwrap
from argparse import ArgumentParser from argparse import ArgumentParser
from collections import defaultdict from collections import defaultdict
from dataclasses import dataclass
from enum import Enum from enum import Enum
from functools import total_ordering from functools import total_ordering
from pathlib import Path from pathlib import Path
from typing import NamedTuple, List, Optional, DefaultDict, Dict from typing import NamedTuple, List, Optional, DefaultDict, Dict
import logging
import string
import requests_html import requests_html
@ -29,7 +32,11 @@ CONDA_REPO = "https://repo.anaconda.com"
MINICONDA_REPO = CONDA_REPO + "/miniconda" MINICONDA_REPO = CONDA_REPO + "/miniconda"
ANACONDA_REPO = CONDA_REPO + "/archive" ANACONDA_REPO = CONDA_REPO + "/archive"
auto_accept_tos_fmt="""export CONDA_PLUGINS_AUTO_ACCEPT_TOS=true
""".strip()
install_script_fmt = """ install_script_fmt = """
{auto_accept_tos}
case "$(anaconda_architecture 2>/dev/null || true)" in case "$(anaconda_architecture 2>/dev/null || true)" in
{install_lines} {install_lines}
* ) * )
@ -102,21 +109,37 @@ class Suffix(StrEnum):
NONE = "" NONE = ""
class PyVersion(StrEnum): PyVersion = None
PY27 = "py27" class PyVersionMeta(type):
PY36 = "py36" def __getattr__(self, name):
PY37 = "py37" """Generate PyVersion.PYXXX on demand to future-proof it"""
PY38 = "py38" if PyVersion is not None:
PY39 = "py39" return PyVersion(name.lower())
PY310 = "py310" return super(PyVersionMeta,self).__getattr__(self, name)
PY311 = "py311"
@dataclass(frozen=True)
class PyVersion(metaclass=PyVersionMeta):
major: str
minor: str
def __init__(self, value):
(major, minor) = re.match(r"py(\d)(\d+)", value).groups()
object.__setattr__(self, "major", major)
object.__setattr__(self, "minor", minor)
@property
def value(self):
return f"py{self.major}{self.minor}"
def version(self): def version(self):
first, *others = self.value[2:] return f"{self.major}.{self.minor}"
return f"{first}.{''.join(others)}"
def version_info(self): def version_info(self):
return tuple(int(n) for n in self.version().split(".")) return (self.major, self.minor)
def __str__(self):
return self.value
@total_ordering @total_ordering
@ -190,10 +213,17 @@ class CondaVersion(NamedTuple):
# https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-python.html # https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-python.html
if v < (4, 7): if v < (4, 7):
return PyVersion.PY36 return PyVersion.PY36
else: if v < (4, 8):
return PyVersion.PY37 return PyVersion.PY37
else:
# since 4.8, Miniconda specifies versions explicitly in the file name
raise ValueError("Miniconda 4.8+ is supposed to specify a Python version explicitly")
if self.flavor == "anaconda": if self.flavor == "anaconda":
# https://docs.anaconda.com/free/anaconda/reference/release-notes/ # https://www.anaconda.com/docs/tools/anaconda-org/release-notes
if v >= (2025,6):
return PyVersion.PY313
if v >= (2024,6):
return PyVersion.PY312
if v >= (2023,7): if v >= (2023,7):
return PyVersion.PY311 return PyVersion.PY311
if v >= (2023,3): if v >= (2023,3):
@ -210,6 +240,13 @@ class CondaVersion(NamedTuple):
raise ValueError(self.flavor) raise ValueError(self.flavor)
def requires_tos_accept(self):
"""
requires to accept TOS for installation
"""
return self.flavor == Flavor.MINICONDA \
and self.version_str.info() >= (25,)
class CondaSpec(NamedTuple): class CondaSpec(NamedTuple):
tflavor: TFlavor tflavor: TFlavor
@ -246,8 +283,9 @@ class CondaSpec(NamedTuple):
SupportedArch(arch), SupportedArch(arch),
md5, md5,
repo, repo,
py_ver
) )
if py_version is None: if py_version is None and py_ver is None and ver != "latest":
spec = spec.with_py_version(spec.version.default_py_version()) spec = spec.with_py_version(spec.version.default_py_version())
return spec return spec
@ -277,7 +315,8 @@ def make_script(specs: List[CondaSpec]):
return install_script_fmt.format( return install_script_fmt.format(
install_lines="\n".join(install_lines), install_lines="\n".join(install_lines),
tflavor=specs[0].tflavor, tflavor=specs[0].tflavor,
) auto_accept_tos = auto_accept_tos_fmt if specs[0].version.requires_tos_accept() else ""
).lstrip()
def get_existing_condas(name): def get_existing_condas(name):
@ -296,8 +335,8 @@ def get_existing_condas(name):
if v.version_str != "latest": if v.version_str != "latest":
logger.debug("Found existing %(name)s version %(v)s", locals()) logger.debug("Found existing %(name)s version %(v)s", locals())
yield v yield v
except ValueError: except ValueError as e:
logger.error("Unable to parse existing version %s", entry_name) logger.error("Unable to parse existing version %s: %s", entry_name, e)
def get_available_condas(name, repo): def get_available_condas(name, repo):
@ -348,19 +387,12 @@ if __name__ == "__main__":
help="Do not write scripts, just report them to stdout", help="Do not write scripts, just report them to stdout",
) )
parser.add_argument( parser.add_argument(
"-v", "--verbose", action="count", default=0, "-v", "--verbose", action="store_true", default=0,
help="Increase verbosity of logging", help="Increase verbosity of logging",
) )
parsed = parser.parse_args() parsed = parser.parse_args()
log_level = { logging.basicConfig(level=logging.DEBUG if parsed.verbose else logging.INFO)
0: logging.WARNING,
1: logging.INFO,
2: logging.DEBUG,
}.get(parsed.verbose, logging.DEBUG)
logging.basicConfig(level=log_level)
if parsed.verbose < 3:
logging.getLogger("requests").setLevel(logging.WARNING)
existing_versions = set() existing_versions = set()
available_specs = set() available_specs = set()

View File

@ -11,8 +11,17 @@ logger = logging.getLogger(__name__)
logging.basicConfig(level=os.environ.get('LOGLEVEL', 'INFO')) logging.basicConfig(level=os.environ.get('LOGLEVEL', 'INFO'))
MINIFORGE_REPO = 'conda-forge/miniforge' MINIFORGE_REPO = 'conda-forge/miniforge'
PYTHON_VERSION = '310' DISTRIBUTIONS = ['miniforge']
DISTRIBUTIONS = ['miniforge', 'mambaforge'] DISTRIBUTIONS_PRE25 = ['miniforge', 'mambaforge']
SKIPPED_RELEASES = [
'4.13.0-0', #has no Mambaforge. We already generated scripts for Miniforge
'22.11.1-0', #MacOS packages are broken (have broken dep tarballs, downloading them fails with 403)
'22.11.1-1', #MacOS packages are broken (have broken dep tarballs, downloading them fails with 403)
'22.11.1-2', #MacOS packages are broken (have broken dep tarballs, downloading them fails with 403)
'25.3.0-0', #marked as prerelease, no Linux version
'25.11.0-0', #regression reported in constructor, re-released as 25.11.0-1 with hotfix bumping to constructor>=3.14 (was >=3.12, 3.13 implicit)
]
install_script_fmt = """ install_script_fmt = """
case "$(anaconda_architecture 2>/dev/null || true)" in case "$(anaconda_architecture 2>/dev/null || true)" in
@ -38,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.debug('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):
@ -56,34 +65,58 @@ def create_spec(filename, sha, url):
'filename': filename, 'filename': filename,
'sha': sha, 'sha': sha,
'url': url, 'url': url,
'py_version': PYTHON_VERSION, 'py_version': py_version(version),
'flavor': flavor, 'flavor': flavor,
'os': os, 'os': os,
'arch': arch, 'arch': arch,
'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
def supported(filename): def version_tuple(version):
return ('pypy' not in filename) and ('Windows' not in filename) return tuple(int(part) for part in version.split('-')[0].split("."))
def add_version(release): def py_version(version):
"""Suffix for `verify_pyXXX` to call in the generated build script"""
version_tuple_ = version_tuple(version)
# current version: mentioned under https://github.com/conda-forge/miniforge?tab=readme-ov-file#requirements-and-installers
# transition points:
# https://github.com/conda-forge/miniforge/blame/main/Miniforge3/construct.yaml
# look for "- python <version>" in non-pypy branch and which tag the commit is first in
if version_tuple_ >= (26,1):
# https://github.com/conda-forge/miniforge/commit/0016367731e52c67234d6d0e7e6a24c6bf7673e4
return "313"
if version_tuple_ >= (24,5):
# yes, they jumped from 3.10 directly to 3.12
# https://github.com/conda-forge/miniforge/commit/bddad0baf22b37cfe079e47fd1680fdfb2183590
return "312"
if version_tuple_ >= (4,14):
return "310"
raise ValueError("Bundled Python version unknown for release `%s'"%version)
def supported(filename):
return ('pypy' not in filename) and ('Windows' not in filename) and (not filename.endswith('.pkg'))
def add_version(release, distributions):
tag_name = release['tag_name'] tag_name = release['tag_name']
download_urls = { f['name']: f['browser_download_url'] for f in release['assets'] } download_urls = { f['name']: f['browser_download_url'] for f in release['assets'] }
shas = dict([download_sha(url) for (name, url) in download_urls.items() if name.endswith('.sha256') and tag_name in name]) # can assume that sha files are named similar to release files so can also check supported(on their names)
shas = dict([download_sha(url) for (name, url) in download_urls.items()
if name.endswith('.sha256') and supported(os.path.splitext(name)[0]) and tag_name in name])
specs = [create_spec(filename, sha, download_urls[filename]) for (filename, sha) in shas.items() if supported(filename)] specs = [create_spec(filename, sha, download_urls[filename]) for (filename, sha) in shas.items() if supported(filename)]
for distribution in DISTRIBUTIONS:
for distribution in distributions:
distribution_specs = [spec for spec in specs if distribution in spec['flavor'].lower()] distribution_specs = [spec for spec in specs if distribution in spec['flavor'].lower()]
count = len(distribution_specs) count = len(distribution_specs)
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]),
@ -93,20 +126,27 @@ def add_version(release):
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}')
for release in requests.get(f'https://api.github.com/repos/{MINIFORGE_REPO}/releases').json():
def main():
for release in requests.get(f'https://api.github.com/repos/{MINIFORGE_REPO}/releases').json():
version = release['tag_name'] version = release['tag_name']
logger.info('Looking for %(version)s in %(out_dir)s', locals()) if version in SKIPPED_RELEASES:
# This release has no mambaforge artifacts which causes the next check to always trigger.
# Build scripts for miniforge3-4.13.0-0 have already been generated.
# Assuming this was a fluke, we don't yet need to implement proactively checking all releases for contents
# or ignoring a release if _any_ of the flavors is already present in Pyenv.
if version == '4.13.0-0':
continue continue
if any(not list(out_dir.glob(f'{distribution}*-{version}')) for distribution in DISTRIBUTIONS): logger.info(f'Looking for {version} in {out_dir}')
logger.info('Downloading %(version)s', locals())
add_version(release) # mambaforge is retired https://github.com/conda-forge/miniforge/releases/tag/24.11.2-0
if version_tuple(version) >= (24, 11, 2):
distributions = DISTRIBUTIONS
else:
distributions = DISTRIBUTIONS_PRE25
if any(not list(out_dir.glob(f'{distribution}*-{version}')) for distribution in distributions):
logger.info(f'Downloading {version}')
add_version(release, distributions)
if __name__ == '__main__':
main()

View File

@ -1 +1,9 @@
more_itertools
requests-html requests-html
fake_useragent<2; python_version < "3.9"
lxml[html_clean]
packaging
requests
sortedcontainers
tqdm
jc

View File

@ -1,4 +1,6 @@
prefer_openssl11 export PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="${PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA:-openssl@1.1 openssl@1.0}"
export PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA="${PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA:-openssl11 openssl10}"
export PYTHON_CFLAGS="${PYTHON_CFLAGS:+$PYTHON_CFLAGS }-std=c99"
install_package "openssl-1.1.0j" "https://www.openssl.org/source/old/1.1.0/openssl-1.1.0j.tar.gz#31bec6c203ce1a8e93d5994f4ed304c63ccf07676118b6634edded12ad1b3246" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.1.0j" "https://www.openssl.org/source/old/1.1.0/openssl-1.1.0j.tar.gz#31bec6c203ce1a8e93d5994f4ed304c63ccf07676118b6634edded12ad1b3246" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
install_git "Python-2.7-dev" "https://github.com/python/cpython" "2.7" standard verify_py27 copy_python_gdb ensurepip install_git "Python-2.7-dev" "https://github.com/python/cpython" "2.7" standard verify_py27 copy_python_gdb ensurepip

View File

@ -1,3 +1,4 @@
export PYTHON_CFLAGS="${PYTHON_CFLAGS:+$PYTHON_CFLAGS }-std=c99"
install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
install_package "Python-2.7" "https://www.python.org/ftp/python/2.7/Python-2.7.tgz#5670dd6c0c93b0b529781d070852f7b51ce6855615b16afcd318341af2910fb5" standard verify_py27 copy_python_gdb ensurepip install_package "Python-2.7" "https://www.python.org/ftp/python/2.7/Python-2.7.tgz#5670dd6c0c93b0b529781d070852f7b51ce6855615b16afcd318341af2910fb5" standard verify_py27 copy_python_gdb ensurepip

View File

@ -1,3 +1,4 @@
export PYTHON_CFLAGS="${PYTHON_CFLAGS:+$PYTHON_CFLAGS }-std=c99"
install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
install_package "Python-2.7.1" "https://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz#ca13e7b1860821494f70de017202283ad73b1fb7bd88586401c54ef958226ec8" standard verify_py27 copy_python_gdb ensurepip install_package "Python-2.7.1" "https://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz#ca13e7b1860821494f70de017202283ad73b1fb7bd88586401c54ef958226ec8" standard verify_py27 copy_python_gdb ensurepip

View File

@ -1,3 +1,4 @@
export PYTHON_CFLAGS="${PYTHON_CFLAGS:+$PYTHON_CFLAGS }-std=c99"
install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then if has_tar_xz_support; then

View File

@ -1,3 +1,4 @@
export PYTHON_CFLAGS="${PYTHON_CFLAGS:+$PYTHON_CFLAGS }-std=c99"
install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then if has_tar_xz_support; then

View File

@ -1,3 +1,4 @@
export PYTHON_CFLAGS="${PYTHON_CFLAGS:+$PYTHON_CFLAGS }-std=c99"
install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then if has_tar_xz_support; then

View File

@ -1,3 +1,4 @@
export PYTHON_CFLAGS="${PYTHON_CFLAGS:+$PYTHON_CFLAGS }-std=c99"
install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then if has_tar_xz_support; then

View File

@ -1,4 +1,6 @@
prefer_openssl11 export PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="${PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA:-openssl@1.1 openssl@1.0}"
export PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA="${PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA:-openssl11 openssl10}"
export PYTHON_CFLAGS="${PYTHON_CFLAGS:+$PYTHON_CFLAGS }-std=c99"
install_package "openssl-1.1.0j" "https://www.openssl.org/source/old/1.1.0/openssl-1.1.0j.tar.gz#31bec6c203ce1a8e93d5994f4ed304c63ccf07676118b6634edded12ad1b3246" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.1.0j" "https://www.openssl.org/source/old/1.1.0/openssl-1.1.0j.tar.gz#31bec6c203ce1a8e93d5994f4ed304c63ccf07676118b6634edded12ad1b3246" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then if has_tar_xz_support; then

View File

@ -1,4 +1,6 @@
prefer_openssl11 export PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="${PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA:-openssl@1.1 openssl@1.0}"
export PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA="${PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA:-openssl11 openssl10}"
export PYTHON_CFLAGS="${PYTHON_CFLAGS:+$PYTHON_CFLAGS }-std=c99"
install_package "openssl-1.1.0j" "https://www.openssl.org/source/old/1.1.0/openssl-1.1.0j.tar.gz#31bec6c203ce1a8e93d5994f4ed304c63ccf07676118b6634edded12ad1b3246" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.1.0j" "https://www.openssl.org/source/old/1.1.0/openssl-1.1.0j.tar.gz#31bec6c203ce1a8e93d5994f4ed304c63ccf07676118b6634edded12ad1b3246" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then if has_tar_xz_support; then

View File

@ -1,3 +1,6 @@
export PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="${PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA:-openssl@1.1 openssl@1.0}"
export PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA="${PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA:-openssl11 openssl10}"
export PYTHON_CFLAGS="${PYTHON_CFLAGS:+$PYTHON_CFLAGS }-std=c99"
install_package "openssl-1.0.2q" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2q.tar.gz#5744cfcbcec2b1b48629f7354203bc1e5e9b5466998bbccc5b5fcde3b18eb684" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.0.2q" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2q.tar.gz#5744cfcbcec2b1b48629f7354203bc1e5e9b5466998bbccc5b5fcde3b18eb684" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then if has_tar_xz_support; then

View File

@ -1,3 +1,6 @@
export PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="${PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA:-openssl@1.1 openssl@1.0}"
export PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA="${PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA:-openssl11 openssl10}"
export PYTHON_CFLAGS="${PYTHON_CFLAGS:+$PYTHON_CFLAGS }-std=c99"
install_package "openssl-1.0.2q" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2q.tar.gz#5744cfcbcec2b1b48629f7354203bc1e5e9b5466998bbccc5b5fcde3b18eb684" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.0.2q" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2q.tar.gz#5744cfcbcec2b1b48629f7354203bc1e5e9b5466998bbccc5b5fcde3b18eb684" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then if has_tar_xz_support; then

View File

@ -1,4 +1,6 @@
export PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="openssl@1.1 openssl@1.0 openssl" export PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="${PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA:-openssl@1.1 openssl@1.0}"
export PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA="${PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA:-openssl11 openssl10}"
export PYTHON_CFLAGS="${PYTHON_CFLAGS:+$PYTHON_CFLAGS }-std=c99"
install_package "openssl-1.1.1v" "https://www.openssl.org/source/openssl-1.1.1v.tar.gz" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.1.1v" "https://www.openssl.org/source/openssl-1.1.1v.tar.gz" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then if has_tar_xz_support; then

View File

@ -1,3 +1,4 @@
export PYTHON_CFLAGS="${PYTHON_CFLAGS:+$PYTHON_CFLAGS }-std=c99"
install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
install_package "Python-2.7.2" "https://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz#1d54b7096c17902c3f40ffce7e5b84e0072d0144024184fff184a84d563abbb3" standard verify_py27 copy_python_gdb ensurepip install_package "Python-2.7.2" "https://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz#1d54b7096c17902c3f40ffce7e5b84e0072d0144024184fff184a84d563abbb3" standard verify_py27 copy_python_gdb ensurepip

View File

@ -1,3 +1,4 @@
export PYTHON_CFLAGS="${PYTHON_CFLAGS:+$PYTHON_CFLAGS }-std=c99"
install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
install_package "Python-2.7.3" "https://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz#d4c20f2b5faf95999fd5fecb3f7d32071b0820516224a6d2b72932ab47a1cb8e" standard verify_py27 copy_python_gdb ensurepip install_package "Python-2.7.3" "https://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz#d4c20f2b5faf95999fd5fecb3f7d32071b0820516224a6d2b72932ab47a1cb8e" standard verify_py27 copy_python_gdb ensurepip

View File

@ -1,3 +1,4 @@
export PYTHON_CFLAGS="${PYTHON_CFLAGS:+$PYTHON_CFLAGS }-std=c99"
install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
install_package "Python-2.7.4" "https://www.python.org/ftp/python/2.7.4/Python-2.7.4.tgz#98c5eb9c8e65effcc0122112ba17a0bce880aa23ecb560af56b55eb55632b81a" standard verify_py27 copy_python_gdb ensurepip install_package "Python-2.7.4" "https://www.python.org/ftp/python/2.7.4/Python-2.7.4.tgz#98c5eb9c8e65effcc0122112ba17a0bce880aa23ecb560af56b55eb55632b81a" standard verify_py27 copy_python_gdb ensurepip

View File

@ -1,3 +1,4 @@
export PYTHON_CFLAGS="${PYTHON_CFLAGS:+$PYTHON_CFLAGS }-std=c99"
install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
install_package "Python-2.7.5" "https://www.python.org/ftp/python/2.7.5/Python-2.7.5.tgz#8e1b5fa87b91835afb376a9c0d319d41feca07ffebc0288d97ab08d64f48afbf" standard verify_py27 copy_python_gdb ensurepip install_package "Python-2.7.5" "https://www.python.org/ftp/python/2.7.5/Python-2.7.5.tgz#8e1b5fa87b91835afb376a9c0d319d41feca07ffebc0288d97ab08d64f48afbf" standard verify_py27 copy_python_gdb ensurepip

View File

@ -1,3 +1,4 @@
export PYTHON_CFLAGS="${PYTHON_CFLAGS:+$PYTHON_CFLAGS }-std=c99"
install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
install_package "Python-2.7.6" "https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz#99c6860b70977befa1590029fae092ddb18db1d69ae67e8b9385b66ed104ba58" standard verify_py27 copy_python_gdb ensurepip install_package "Python-2.7.6" "https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz#99c6860b70977befa1590029fae092ddb18db1d69ae67e8b9385b66ed104ba58" standard verify_py27 copy_python_gdb ensurepip

View File

@ -1,3 +1,4 @@
export PYTHON_CFLAGS="${PYTHON_CFLAGS:+$PYTHON_CFLAGS }-std=c99"
install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then if has_tar_xz_support; then

View File

@ -1,3 +1,4 @@
export PYTHON_CFLAGS="${PYTHON_CFLAGS:+$PYTHON_CFLAGS }-std=c99"
install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then if has_tar_xz_support; then

View File

@ -1,3 +1,4 @@
export PYTHON_CFLAGS="${PYTHON_CFLAGS:+$PYTHON_CFLAGS }-std=c99"
install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.0.2k" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz#6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then if has_tar_xz_support; then

View File

@ -1,4 +1,4 @@
prefer_openssl11 prefer_openssl3
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1 export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
install_package "openssl-1.1.1n" "https://www.openssl.org/source/openssl-1.1.1n.tar.gz#40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.1.1n" "https://www.openssl.org/source/openssl-1.1.1n.tar.gz#40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline

View File

@ -1,4 +1,4 @@
prefer_openssl11 prefer_openssl3
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1 export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
install_package "openssl-1.1.1n" "https://www.openssl.org/source/openssl-1.1.1n.tar.gz#40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.1.1n" "https://www.openssl.org/source/openssl-1.1.1n.tar.gz#40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline

View File

@ -1,4 +1,4 @@
prefer_openssl11 prefer_openssl3
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1 export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
install_package "openssl-1.1.1n" "https://www.openssl.org/source/openssl-1.1.1n.tar.gz#40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.1.1n" "https://www.openssl.org/source/openssl-1.1.1n.tar.gz#40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline

View File

@ -1,4 +1,4 @@
prefer_openssl11 prefer_openssl3
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1 export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
install_package "openssl-1.1.1o" "https://www.openssl.org/source/openssl-1.1.1o.tar.gz#9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.1.1o" "https://www.openssl.org/source/openssl-1.1.1o.tar.gz#9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f" 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 install_package "readline-8.1" "https://ftpmirror.gnu.org/readline/readline-8.1.tar.gz#f8ceb4ee131e3232226a17f51b164afc46cd0b9e6cef344be87c65962cb82b02" mac_readline --if has_broken_mac_readline

View File

@ -1,4 +1,4 @@
prefer_openssl11 prefer_openssl3
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1 export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
install_package "openssl-1.1.1o" "https://www.openssl.org/source/openssl-1.1.1o.tar.gz#9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.1.1o" "https://www.openssl.org/source/openssl-1.1.1o.tar.gz#9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f" 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 install_package "readline-8.1" "https://ftpmirror.gnu.org/readline/readline-8.1.tar.gz#f8ceb4ee131e3232226a17f51b164afc46cd0b9e6cef344be87c65962cb82b02" mac_readline --if has_broken_mac_readline

View File

@ -1,4 +1,4 @@
prefer_openssl11 prefer_openssl3
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1 export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
install_package "openssl-1.1.1o" "https://www.openssl.org/source/openssl-1.1.1o.tar.gz#9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.1.1o" "https://www.openssl.org/source/openssl-1.1.1o.tar.gz#9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f" 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 install_package "readline-8.1" "https://ftpmirror.gnu.org/readline/readline-8.1.tar.gz#f8ceb4ee131e3232226a17f51b164afc46cd0b9e6cef344be87c65962cb82b02" mac_readline --if has_broken_mac_readline

View File

@ -1,4 +1,4 @@
prefer_openssl11 prefer_openssl3
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1 export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
install_package "openssl-1.1.1o" "https://www.openssl.org/source/openssl-1.1.1o.tar.gz#9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.1.1o" "https://www.openssl.org/source/openssl-1.1.1o.tar.gz#9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f" 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 install_package "readline-8.1" "https://ftpmirror.gnu.org/readline/readline-8.1.tar.gz#f8ceb4ee131e3232226a17f51b164afc46cd0b9e6cef344be87c65962cb82b02" mac_readline --if has_broken_mac_readline

View File

@ -1,4 +1,4 @@
prefer_openssl11 prefer_openssl3
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1 export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
install_package "openssl-1.1.1o" "https://www.openssl.org/source/openssl-1.1.1o.tar.gz#9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.1.1o" "https://www.openssl.org/source/openssl-1.1.1o.tar.gz#9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f" 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 install_package "readline-8.1" "https://ftpmirror.gnu.org/readline/readline-8.1.tar.gz#f8ceb4ee131e3232226a17f51b164afc46cd0b9e6cef344be87c65962cb82b02" mac_readline --if has_broken_mac_readline

View File

@ -0,0 +1,9 @@
prefer_openssl3
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
install_package "openssl-1.1.1o" "https://www.openssl.org/source/openssl-1.1.1o.tar.gz#9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f" 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.15" "https://www.python.org/ftp/python/3.10.15/Python-3.10.15.tar.xz#aab0950817735172601879872d937c1e4928a57c409ae02369ec3d91dccebe79" standard verify_py310 copy_python_gdb ensurepip
else
install_package "Python-3.10.15" "https://www.python.org/ftp/python/3.10.15/Python-3.10.15.tgz#a27864e5ba2a4474f8f6c58ab92ff52767ac8b66f1646923355a53fe3ef15074" standard verify_py310 copy_python_gdb ensurepip
fi

View File

@ -0,0 +1,9 @@
prefer_openssl3
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
install_package "openssl-1.1.1o" "https://www.openssl.org/source/openssl-1.1.1o.tar.gz#9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f" 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.16" "https://www.python.org/ftp/python/3.10.16/Python-3.10.16.tar.xz#bfb249609990220491a1b92850a07135ed0831e41738cf681d63cf01b2a8fbd1" standard verify_py310 copy_python_gdb ensurepip
else
install_package "Python-3.10.16" "https://www.python.org/ftp/python/3.10.16/Python-3.10.16.tgz#f2e22ed965a93cfeb642378ed6e6cdbc127682664b24123679f3d013fafe9cd0" standard verify_py310 copy_python_gdb ensurepip
fi

View 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.17" "https://www.python.org/ftp/python/3.10.17/Python-3.10.17.tar.xz#4c68050f049d1b4ac5aadd0df5f27941c0350d2a9e7ab0907ee5eb5225d9d6b0" standard verify_py310 copy_python_gdb ensurepip
else
install_package "Python-3.10.17" "https://www.python.org/ftp/python/3.10.17/Python-3.10.17.tgz#8fcda0fbdc131859a4a4223abb925fd522a77e3fb3b52c46cea5f3bc2ae0cd9f" standard verify_py310 copy_python_gdb ensurepip
fi

View 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.18" "https://www.python.org/ftp/python/3.10.18/Python-3.10.18.tar.xz#ae665bc678abd9ab6a6e1573d2481625a53719bc517e9a634ed2b9fefae3817f" standard verify_py310 copy_python_gdb ensurepip
else
install_package "Python-3.10.18" "https://www.python.org/ftp/python/3.10.18/Python-3.10.18.tgz#1b19ab802518eb36a851f5ddef571862c7a31ece533109a99df6d5af0a1ceb99" standard verify_py310 copy_python_gdb ensurepip
fi

View 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

View File

@ -1,4 +1,4 @@
prefer_openssl11 prefer_openssl3
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1 export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
install_package "openssl-1.1.1n" "https://www.openssl.org/source/openssl-1.1.1n.tar.gz#40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.1.1n" "https://www.openssl.org/source/openssl-1.1.1n.tar.gz#40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline

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

@ -1,4 +1,4 @@
prefer_openssl11 prefer_openssl3
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1 export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
install_package "openssl-1.1.1n" "https://www.openssl.org/source/openssl-1.1.1n.tar.gz#40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.1.1n" "https://www.openssl.org/source/openssl-1.1.1n.tar.gz#40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline

View File

@ -1,4 +1,4 @@
prefer_openssl11 prefer_openssl3
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1 export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
install_package "openssl-1.1.1n" "https://www.openssl.org/source/openssl-1.1.1n.tar.gz#40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.1.1n" "https://www.openssl.org/source/openssl-1.1.1n.tar.gz#40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline

View File

@ -1,4 +1,4 @@
prefer_openssl11 prefer_openssl3
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1 export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
install_package "openssl-1.1.1o" "https://www.openssl.org/source/openssl-1.1.1o.tar.gz#9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.1.1o" "https://www.openssl.org/source/openssl-1.1.1o.tar.gz#9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f" 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 install_package "readline-8.1" "https://ftpmirror.gnu.org/readline/readline-8.1.tar.gz#f8ceb4ee131e3232226a17f51b164afc46cd0b9e6cef344be87c65962cb82b02" mac_readline --if has_broken_mac_readline

Some files were not shown because too many files have changed in this diff Show More