3396 Commits

Author SHA1 Message Date
Ivan Pozdeev
37136e1ad3 README: Fix an incorrect fact about completions locaton [no ci] 2024-12-22 15:16:17 +03:00
Christian Fredrik Johnsen
76adade69a fix: print_shell_function(), use ${1:-} instead of $1, AND use echo \ setup instead of `echo
'`

1) If people are using bash with `set -u` (enable unset variable
   checking), then they will get an error if they run `pyenv` in the
   CLI under the current setup. To avoid any errors when no positional
   arguments, we use ${1:-} instead of $1.

2) We find that the script looks better when using:

```bash
echo \
'pyenv() {
  local command=${1:-}'
```

As opposed to:

```
echo 'pyenv() {
  local command=${1:-}'
```
2024-12-22 12:20:41 +01:00
Christian Fredrik Johnsen
b1882cb6fe fix: Fix shell completions tests for pyenv-init
In `test_helper.bash`:
set

PATH="${BATS_TEST_DIRNAME%/*}/libexec:$PATH"

instead of

PATH="${BATS_TEST_DIRNAME}../libexec:$PATH"

it essentially enables us to expect

`${exec_root}/completions/pyenv.bash`

instead of something like

`${exec_root}/test/../completions/pyenv.zsh
2024-12-21 18:05:48 +01:00
Christian Fredrik Johnsen
2e1c756793 revert: do not use PYENV_ROOT when printing path to completions.
Homebrew installations have PYENV_ROOT set to `~/.pyenv`, while the
actual completion file resides in /home/linuxbrew/.linuxbrew/Cellar/pyenv/2.4.23/completions/pyenv.zsh

Thus, if you try to use `$PYENV_ROOT/completions/pyenv.${shell}`, the
completions file will not be found, since you are pointing to:

`~/.pyenv/completions/pyenv.zsh`

when the actual location is:

`/home/linuxbrew/.linuxbrew/Cellar/pyenv/2.4.23/completions/pyenv.zsh`

This problem is resolved by using the parent folder of the currently
executing file:

`/home/linuxbrew/.linuxbrew/Cellar/pyenv/2.4.23/libexec/pyenv-init`

which is

`/home/linuxbrew/.linuxbrew/Cellar/pyenv/2.4.23`

And then go to completions from there.

I don't like the fact that homebrew installations store some things in
`/home/linuxbrew/.linuxbrew/Cellar/pyenv/2.4.23/libexec/pyenv-init`

while stuff like `shims` and python versions are stored in `~/.pyenv`, but
that's how it currently is.
2024-12-21 18:05:48 +01:00
Christian Fredrik Johnsen
c2554fc885 docs: add documentation to Advanced Configuration section.
Tell users that `pyenv init -` works, but that specifying the shell
which is used is preferable, as it reduces launch time.
2024-12-21 18:05:48 +01:00
Christian Fredrik Johnsen
e8f9c3d6a0 style: replace double quotes with single quotes in functions help_() and
print_shell_function().

-> Maintainers prefer single quotes instead of double quotes, since it
allows us to look away from tracking what to escape.
2024-12-21 18:05:48 +01:00
Christian Fredrik Johnsen
63bd18d6d7 perf: replace cat calls with echo in print_shell_function()
echo is a bash built-in, and thus you don't need to launch a new
process for something as simple as writing to stdout.
Saves about 2-3ms.
2024-12-21 18:05:48 +01:00
Christian Fredrik Johnsen
29dd360010 style: remove unnecessary variable declarations at the top of file in pyenv-init. 2024-12-21 18:05:48 +01:00
Christian Fredrik Johnsen
10732c1d8a test: fix 'setup shell completion' tests.
The old tests seems to have been copy-paste from some 11 year old
rubyenv setup, and included a long and windy pathname. The old setup was
extremely bad in my view, current test is much better.

Exported variables are local to the specific test, so they will not
affect other test instances.

---> Enables us to remove unnecessary `root` variable in pyenv-init.
2024-12-21 18:05:48 +01:00
Christian Fredrik Johnsen
1c985d2ed9 test: alter @test fish instructions to expect 'pyenv init - fish | source' instead of 'pyenv init - | source'. 2024-12-21 18:05:48 +01:00
Christian Fredrik Johnsen
198c89471a refactor: Use same setup as rbenv-init for reading arguments in
pyenv-init.

- It turns out that the code I wrote was very similar to what was
  already present in rbenv-init.

As rbenv is referenced when I am writing a pull request, I am assuming
that maintainers want code similar to what's already there.

WARNING:
The code will now not validate whether the specified shell is valid or
not, and if you make a silly mistake like writing `--parh` instead of
`--path`, the shell may be set to `--parh` and so forth. But I guess
this is acceptable.
2024-12-21 18:05:48 +01:00
Christian Fredrik Johnsen
b21c209329 docs: fix help_() function inside pyenv-init, such that it reminds users
to specify the shell they are using when adding:
`eval $(pyenv init - <shell>)` to their config file.
2024-12-21 18:05:48 +01:00
Christian Fredrik Johnsen
66a5c14622 docs: Recommend users to specify the shell they are using.
- Local testing shows that you get a trivial 1.6x speedup in command execution
  time (over doing `pyenv init -`) by specifying which shell you are using.
2024-12-21 18:05:48 +01:00
Christian Fredrik Johnsen
4ea68e3ca0 perf: replace a series of if statements with a case block. Add error
handling for case where unknown option is provided.

- Error handling involves writing error message to stderr, and
  forcefully exiting the init script, forcing user to fix their setup.
2024-12-21 18:05:48 +01:00
Christian Fredrik Johnsen
4ff5dbfe9b perf: remove unnecessary root variable, PYENV_ROOT already present. 2024-12-21 18:05:48 +01: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 v2.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 v2.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 v2.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 v2.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 v2.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 v2.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 v2.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