Commit graph

15 commits

Author SHA1 Message Date
Sam Doran 37ab83f1b0
Improve performance and output of pyenv virtualenvs (#502)
* With 160 envs, cuts time from ~14s to ~2.5s
* Change the output to be more like `pyenv-versions'
* Shellcheck fixes
* virtualenv: Only show non-envs for completion since env engines don't support piggy-backing envs
* Remove dead/unused code
* Fix IFS handling
`IFS=: <command>' doesn't apply that IFS to expansions in <command>,
it has to be set separately earlier
* Adjust and refactor tests

---------

Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
2026-04-29 08:08:52 +03:00
Andrew Christianson c4de2555b7
Use realpath of scripts to determine relative locations (#308)
Just using paths relative to ${BASH_SOURCE} to access `libexec`
fails if the scripts are symlinked to a location,
such as when installed with Homebrew,
since the `libexec` directory is not linked into `brew --prefix`.

Implement a simple version of `realpath`
and run `${BASH_SOURCE}` through it.
This gets the actual installation directory
relative to which `libexec` is located.

Co-authored-by: Andrew Christianson <achristianson@edmunds.com>
2022-10-14 04:37:08 +03:00
Gaurav Talreja b334dde5ef Fix #394 - update pyenv virtualenvs command to list virtualenvs starting with dot prefixes 2021-06-16 15:20:14 +05:30
Luis Marsano e0a1e9b35c
support newer conda
pyenv-virtualenvs could not list conda environments & pyenv shell would only activate the base conda environment
the conda detection criteria of testing the presence of `conda` or `activate` files under `$(pyenv root)/versions/$version/bin` appears to be the culprit, since newer environments no longer include these files: those files reside in the base conda environment
- add detection criteria of `$(pyenv root)/versions/$version/conda-meta`
- compute the real prefix to the base environment from `realpath $(realpath $(pyenv root)/versions/$version)/../..`
- to allow that, enhance substitute `realpath` in `pyenv-virtualenvs` to reduce relative paths `.` & `..`, and factor that code out to a file under `libexec` for reuse
- hook `which` to locate conda from the real prefix
2018-11-21 22:00:56 -05:00
Yamashita, Yuu 5e92253943 Fix broken --skip-aliases 2015-11-25 12:04:48 +00:00
Yamashita, Yuu f92a3a26c5 Add --skip-aliases to pyenv virtualenvs (fixes #120) 2015-11-23 12:06:22 +00:00
Yamashita, Yuu 2ae921c253 Treat all versions with activate script as a virtual environment 2015-11-04 13:07:46 +00:00
Yamashita, Yuu cdbf7c9972 activate "root" environment of anaconda/miniconda if environment name is not given 2015-07-19 04:19:34 +09:00
Yamashita, Yuu 6132f4228e *EXPERIMENTAL* a support for _envs_ created by anaconda/miniconda 2015-07-19 00:07:59 +09:00
Yamashita Yuu 2f20c56b1d remove redundant checks for pyenv-prefix 2013-06-21 19:42:46 +09:00
Yamashita Yuu 77f9c1502d like pyenv versions, show "*" on the start of line if the environment
is enabled
2013-06-21 19:40:59 +09:00
Yamashita Yuu 1db9840620 check existence of ./bin/activate to detect virtualenvs to support pyvenv 2013-06-19 23:39:26 +09:00
Yamashita Yuu b7c498ce03 add pyenv-virtualenv-prefix 2013-06-04 18:56:58 +09:00
Yamashita Yuu 6915cd0320 no need to import print_function in this case 2013-06-04 17:52:10 +09:00
Yamashita Yuu 4263783195 add pyenv virtualenvs command 2013-06-04 17:07:48 +09:00