Commit graph

18 commits

Author SHA1 Message Date
Sam Doran 13b0d850d8
Add skip-aliases to complete output
This was removed by accident.
2026-04-23 17:29:17 -04:00
Sam Doran 6d2cb280f8
Add --only-aliases argument
This is useful for listing the “frinedly” virtualenv names instead of
the short path which includes the Python version.
2026-04-23 17:29:16 -04:00
Sam Doran 97e1333197
Shellcheck fixes, mostly quoting to avoid word splitting 2026-04-23 17:29:16 -04:00
Sam Doran 563bcff28e
Improve performance of pyenv-virtualenvs
Use the code from pyenv-versions for efficiency and consistent output.

The main performance problem was in the call to pyenv-virtualenv-prefix,
which called pyenv-prefix, which then enumerated every virtual environment.
This was done inside a loop, compounding the problem.

Simply the virtual environment listing so that it does not have to call
pyenv-virtualenv-prefix anymore.
2026-04-23 17:29:16 -04: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