Commit graph

23 commits

Author SHA1 Message Date
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
native-api dc873cf568
Support missing versions being present and set in a local .python-version (#3134)
Some checks failed
macos_build / macos_build (3.10) (push) Waiting to run
macos_build / macos_build (3.11) (push) Waiting to run
macos_build / macos_build (3.12) (push) Waiting to run
macos_build / macos_build (3.13) (push) Waiting to run
macos_build / macos_build (3.9) (push) Waiting to run
pyenv_tests / pyenv_tests (macos-13) (push) Waiting to run
pyenv_tests / pyenv_tests (macos-14) (push) Waiting to run
pyenv_tests / pyenv_tests (ubuntu-20.04) (push) Waiting to run
pyenv_tests / pyenv_tests (ubuntu-22.04) (push) Failing after 1s
ubuntu_build / ubuntu_build (3.10) (push) Failing after 1s
ubuntu_build / ubuntu_build (3.11) (push) Failing after 0s
ubuntu_build / ubuntu_build (3.12) (push) Failing after 0s
ubuntu_build / ubuntu_build (3.13) (push) Failing after 1s
ubuntu_build / ubuntu_build (3.9) (push) Failing after 1s
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
Antoine Arbouin 03b60aafec
Support virtualenvs with names starting with "python-" (#3086) 2024-10-10 20:43:13 +03:00
Ed Morley d60d1c5cdc
Fix latest version resolution when using python- prefix (#3056)
Some checks failed
pyenv_tests / pyenv_tests (ubuntu-22.04) (push) Failing after 0s
ubuntu_build / ubuntu_build (3.10) (push) Failing after 0s
ubuntu_build / ubuntu_build (3.11) (push) Failing after 0s
ubuntu_build / ubuntu_build (3.12) (push) Failing after 0s
ubuntu_build / ubuntu_build (3.8) (push) Failing after 0s
ubuntu_build / ubuntu_build (3.9) (push) Failing after 0s
macos_build / macos_build (3.10) (push) Has been cancelled
macos_build / macos_build (3.11) (push) Has been cancelled
macos_build / macos_build (3.12) (push) Has been cancelled
macos_build / macos_build (3.8) (push) Has been cancelled
macos_build / macos_build (3.9) (push) Has been cancelled
pyenv_tests / pyenv_tests (macos-13) (push) Has been cancelled
pyenv_tests / pyenv_tests (macos-14) (push) Has been cancelled
pyenv_tests / pyenv_tests (ubuntu-20.04) (push) Has been cancelled
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
native-api a12f947cc3
Auto-resolve prefixes to the latest version (#2487) 2022-10-30 03:38:40 +03:00
Ville Skyttä 725ff0c5dd Spelling fixes 2016-10-11 14:07:48 +03:00
Yamashita, Yuu fd893ea3b0 Fix broken test for pyenv-version-name 2016-03-04 00:10:48 +00:00
Yamashita, Yuu 41ce3aade2 Merge remote-tracking branch 'rbenv/master' into rbenv-1.0 2016-03-02 01:39:52 +00:00
Jason Karns 565798d617 Test IFS handling in version-name/version-origin hooks 2016-01-04 09:14:28 -05:00
Jason Karns 0f7a2cad8d Use create_hook helper
Use extracted create_hook helper in tests for:

- exec
- hooks
- rehash
- version-name
- version-origin
- which
2016-01-04 09:14:25 -05:00
Mislav Marohnić 6e30032278 Simplify version-name, version-origin hook tests
No need for helper function that's gonna be used just once.
2015-12-23 17:39:14 +01:00
Mislav Marohnić 40c1d27445 Merge remote-tracking branch 'origin/master' into version-hooks 2015-12-23 17:22:43 +01:00
Jason Karns 258e4413b1 create hook: version-name
Expose a `version-name` hook.

It is invoked *after* the traditional `RBENV_VERSION` lookup. Which means hook scripts can interrogate `$RBENV_VERSION_FILE` and/or `$RBENV_VERSION` (or use the executables).

The hooks are then run, giving plugins a chance to alter `RBENV_VERSION`. Once the hooks have run, we now have (in `$RBENV_VERSION`) the actual version we want to use (or it's empty which defaults to `system` per normal). Lastly, the same logic remains for checking if the version exists, or trimming the `ruby-` prefix.

Prime example: the ruby-bundler-ruby-version plugin can select a ruby by using the `ruby` directive from the `Gemfile` if a local `.ruby-version` doesn't exist.
2015-12-23 17:22:30 +01:00
Yamashita, Yuu 8da3749648 Merge remote-tracking branch 'rbenv/master' into rbenv-20151121 2015-11-21 04:21:14 +00:00
Daniel Hahler e3982fae38 Display version origin with non-installed versions
This is useful as an indicator where it is coming from.
2015-07-17 17:10:33 +02:00
Yamashita, Yuu 46ffb0c8df Merge pull request #290 from blueyed/version-handle-missing-better
Improve `pyenv version`, if there is one missing
2015-05-17 12:05:03 +09:00
Yamashita Yuu f48a5b11d7 Import recent changes from rbenv 4d72eefffc 2015-03-07 01:01:32 +09:00
Mislav Marohnić 6820704c91 Remove warning about extraneous "ruby-" prefix in .ruby-version
When we started to support reading `.ruby-version` files, we made a
commitment to not support fuzzy version matching. Treating "ruby-2.1.5"
as "2.1.5" is a sort of fuzzy matching, so we put in place a warning
telling you to remove the extraneous "ruby-" prefix popularly used by
other Ruby version managers to denote MRI. (Their logic is that MRI is
"ruby" and other rubies are not "ruby", apparently.)

However, people are often not able to remove the prefix in their
projects because they want to support other coworkers and tools that
sadly still require the prefix, like RubyMine.

So to restore sanity for a big portion of our users, the warning is gone.
2015-01-29 01:55:58 -08:00
Daniel Hahler e8433cfeb3 Use exitcode from pyenv-version-name in pyenv-version, do not halt 2014-12-11 20:37:03 +01:00
Daniel Hahler 7f88eabd0b Improve pyenv version, if there is one missing
Display the other available ones still.

Fixes https://github.com/yyuu/pyenv/issues/291
2014-12-11 18:49:38 +01:00
Yamashita Yuu 319721b380 Modify applications and versions for Python 2014-01-03 04:41:23 +09:00
Yamashita Yuu 0965577b93 Import tests from rbenv with sed -e s/rbenv/pyenv/g 2014-01-03 02:06:36 +09:00
Mislav Marohnić ab197ef51e add tests for version commands 2013-04-08 23:16:35 +02:00