Commit graph

19 commits

Author SHA1 Message Date
Sam Doran c483e44cb4
Fix incorrect IFS handling
The echo "${VIRTUALENV_PREFIX_PATHS[*]}" statement at the end of the file
only worked by accident because IFS=: was set earlier in the file.

Properly set/unset IFS.
2026-04-23 18:02:22 -04:00
Sam Doran 5ac3b3a1d9
Check for existence of venv directory
Only call pyenv-prefix if the path doesn’t exist.
2026-04-23 17:30:06 -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
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 8c7dd01954 Replaced pyvenv by -m venv 2016-07-16 06:50:50 +00:00
Yamashita, Yuu 2d73d058bd Fix wrong library path for virtualenv on PyPy/Jython (fixes #134) 2015-12-15 00:24:02 +00:00
Yamashita, Yuu 1e88df88a9 Rewrite virtualenv-prefix without executing python (#132) 2015-12-10 03:53:16 +00:00
Yamashita, Yuu 1edff311d5 exits as error if the virtual environment doesn't have python executable (#104)
conda's environment might not have `python` executable. If the prefix
doesn't contain `python` in it, `pyenv-which` might be ran into infinite
loop if some of `which` hooks invoke `pyenv-virtualenv-prefix`.
2015-11-26 10:34:32 +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 b32d357353 Add tests for conda 2015-07-19 15:01:04 +09: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 0fc9441f09 Anaconda has activate script nevertheless it is not a virtual environment (#65) 2015-01-18 20:15:44 +09:00
Yamashita Yuu be18fd294e Fix virtualenv-prefix when the version is system 2014-07-04 22:44:08 +09:00
Yamashita Yuu a40cbc8acd Add tests for pyenv-virtualenv-prefix 2014-01-21 01:27:03 +09:00
Yamashita Yuu 4e61656e9d Modify error messages 2014-01-17 20:17:05 +09:00
Yamashita Yuu 6e7945a626 prefer pyvenv rather than virtualenv if --pyvenv is given 2013-06-19 23:57:45 +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