mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-08 11:33:55 -05:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b90bd92853 | ||
|
|
33f54ecad9 | ||
|
|
f8469a1c67 | ||
|
|
ac28398fc0 | ||
|
|
45a28ac094 | ||
|
|
0f83c33a3b | ||
|
|
2b2b87a25a | ||
|
|
38a6561f96 |
40
CHANGELOG.md
40
CHANGELOG.md
@@ -1,5 +1,45 @@
|
||||
## Version History
|
||||
|
||||
#### 1.2.3
|
||||
* Fix: add `colorize` helper by @silverjam in https://github.com/pyenv/pyenv-virtualenv/pull/470
|
||||
* Bump pyenv-virtualenv reporting version to match release by @ushuz in https://github.com/pyenv/pyenv-virtualenv/pull/471
|
||||
* Add fish prompt changing by @romirk in https://github.com/pyenv/pyenv-virtualenv/pull/475
|
||||
* Don't activate if a 3rd-party venv is activated over ours by @native-api in https://github.com/pyenv/pyenv-virtualenv/pull/478
|
||||
|
||||
#### 1.2.2
|
||||
* Prompt removal was never done and is not planned anymore by @native-api in https://github.com/pyenv/pyenv-virtualenv/pull/447
|
||||
* Update PYENV_VIRTUALENV_VERSION by @jack-mcivor in https://github.com/pyenv/pyenv-virtualenv/pull/449
|
||||
* Add activate/deactivate hooks by @joshfrench in https://github.com/pyenv/pyenv-virtualenv/pull/452
|
||||
* More helpful error message when requesting a nonexistent base version by @MarcinKonowalczyk in https://github.com/pyenv/pyenv-virtualenv/pull/454
|
||||
* Add fish install oneliner by @ElijahLynn in https://github.com/pyenv/pyenv-virtualenv/pull/322
|
||||
* Link python*-config into VE by @native-api in https://github.com/pyenv/pyenv-virtualenv/pull/460
|
||||
|
||||
#### 1.2.1
|
||||
* Support prefixes resolved by pyenv-latest as base version names by @native-api in https://github.com/pyenv/pyenv-virtualenv/pull/446
|
||||
|
||||
#### 1.2.0
|
||||
* ~/.*rc should be modified instead of ~/.*profile by @native-api in https://github.com/pyenv/pyenv-virtualenv/pull/384
|
||||
* Fixes #394 - update pyenv virtualenvs to list virtualenvs start with dot prefixes by @Gauravtalreja1 in https://github.com/pyenv/pyenv-virtualenv/pull/395
|
||||
* Fix installation steps to allow for Pyenv 2 by @native-api in https://github.com/pyenv/pyenv-virtualenv/pull/388
|
||||
* Fix get-pip.py URLs for older versions of Python by @jivanf in https://github.com/pyenv/pyenv-virtualenv/pull/403
|
||||
* Add (y/N) prompt help text by @sh-cho in https://github.com/pyenv/pyenv-virtualenv/pull/404
|
||||
* perf(sh-activate): avoid a pyenv-version-name call by @scop in https://github.com/pyenv/pyenv-virtualenv/pull/380
|
||||
* Fix unbound variable errors when running `pyenv activate` with `set -u` Use default empty value. This fixes #422. by @ackalker in https://github.com/pyenv/pyenv-virtualenv/pull/423
|
||||
* Fix another unbound variable error by @ackalker in https://github.com/pyenv/pyenv-virtualenv/pull/424
|
||||
* Update `get-pip.py` URLs in `pyenv-virtualenv` by @mcdonnnj in https://github.com/pyenv/pyenv-virtualenv/pull/426
|
||||
* Deduplicate shims in $PATH for the fish shell during initialization by @ericvw in https://github.com/pyenv/pyenv-virtualenv/pull/430
|
||||
* Upgrade uninstall hook after pyenv/pyenv#2432 by @laggardkernel in https://github.com/pyenv/pyenv-virtualenv/pull/438
|
||||
* Stop delete force failing when virtualenv does not exist by @eganjs in https://github.com/pyenv/pyenv-virtualenv/pull/330
|
||||
* fix: relative path to pyenv-realpath.dylib by @scop in https://github.com/pyenv/pyenv-virtualenv/pull/378
|
||||
* Spelling fixes by @scop in https://github.com/pyenv/pyenv-virtualenv/pull/352
|
||||
* Clone bats with --depth=1, gitignore it by @scop in https://github.com/pyenv/pyenv-virtualenv/pull/351
|
||||
* set -u fixes by @scop in https://github.com/pyenv/pyenv-virtualenv/pull/350
|
||||
* Set up Github Actions CI by @native-api in https://github.com/pyenv/pyenv-virtualenv/pull/440
|
||||
* Enhance documentation about options for `pyenv virtualenv` by @pylipp in https://github.com/pyenv/pyenv-virtualenv/pull/425
|
||||
* Return control to pyenv-uninstall in uninstall/envs.bash by @aiguofer in https://github.com/pyenv/pyenv-virtualenv/pull/321
|
||||
* Use realpath of scripts to determine relative locations by @andrew-christianson in https://github.com/pyenv/pyenv-virtualenv/pull/308
|
||||
* Shell detect improvements by @scop in https://github.com/pyenv/pyenv-virtualenv/pull/377
|
||||
|
||||
#### 1.1.5
|
||||
|
||||
* Fix install script (#290, #302)
|
||||
|
||||
15
MAINTENANCE.md
Normal file
15
MAINTENANCE.md
Normal file
@@ -0,0 +1,15 @@
|
||||
Creating a release
|
||||
==================
|
||||
|
||||
The release of the new version of Pyenv is done via GitHub Releases.
|
||||
|
||||
Release checklist:
|
||||
* Start [drafting a new release on GitHub](https://github.com/pyenv/pyenv-virtualenv/releases) to generate a summary of changes. Save the summary locally.
|
||||
* The summary may need editing. E.g. rephrase entries, delete/merge entries that are too minor or irrelevant to the users (e.g. typo fixes, CI)
|
||||
* Push the version number in `bin/pyenv-virtualenv`
|
||||
* Minor version is pushed if there are significant functional changes (not e.g. bugfixes/formula adaptations/supporting niche use cases).
|
||||
* Major version is pushed if there are breaking changes
|
||||
* Update `CHANGELOG.md` with the new version number and the edited summary (only the changes section), reformatting it like the rest of the changelog sections
|
||||
* Commit the changes locally into `master`
|
||||
* Create a new tag with the new version number and push the changes including the tag
|
||||
* Create a new release on GitHub based on the tag, using the saved summary
|
||||
@@ -96,8 +96,8 @@ fi
|
||||
venv="${versions}"
|
||||
|
||||
if [ -n "${VIRTUAL_ENV}" ]; then
|
||||
# exit as success if some virtualenv is already activated outside from pyenv-virtualenv
|
||||
if [ -z "${PYENV_VIRTUAL_ENV}" ]; then
|
||||
# exit as success if a non-pyenv virtualenv is active
|
||||
if [[ -z $PYENV_VIRTUAL_ENV || $PYENV_VIRTUAL_ENV != "$VIRTUAL_ENV" ]]; then
|
||||
if [ -z "${FORCE}" ]; then
|
||||
if [ -z "${QUIET}" ]; then
|
||||
echo "pyenv-virtualenv: virtualenv \`${VIRTUAL_ENV}' is already activated" 1>&2
|
||||
@@ -245,7 +245,20 @@ if [ -z "${PYENV_VIRTUALENV_DISABLE_PROMPT}" ]; then
|
||||
case "${shell}" in
|
||||
fish )
|
||||
if [ -z "${QUIET}" ]; then
|
||||
echo "pyenv-virtualenv: prompt changing not working for fish." 1>&2
|
||||
cat <<EOS
|
||||
functions -e _pyenv_old_prompt # remove old prompt function if exists.
|
||||
# since everything is in memory, it's safe to
|
||||
# remove it.
|
||||
functions -c fish_prompt _pyenv_old_prompt # backup old prompt function
|
||||
|
||||
# from python-venv
|
||||
function fish_prompt
|
||||
set -l prompt (_pyenv_old_prompt) # call old prompt function first since it might
|
||||
# read exit status
|
||||
echo -n "(${venv}) " # add virtualenv to prompt
|
||||
string join -- \n \$prompt # handle multiline prompts
|
||||
end
|
||||
EOS
|
||||
fi
|
||||
;;
|
||||
* )
|
||||
|
||||
@@ -187,7 +187,15 @@ esac
|
||||
|
||||
case "${shell}" in
|
||||
fish )
|
||||
:
|
||||
cat <<EOS
|
||||
# check if old prompt function exists
|
||||
if functions -q _pyenv_old_prompt
|
||||
# remove old prompt function if exists.
|
||||
functions -e fish_prompt
|
||||
functions -c _pyenv_old_prompt fish_prompt
|
||||
functions -e _pyenv_old_prompt
|
||||
end
|
||||
EOS
|
||||
;;
|
||||
* )
|
||||
cat <<EOS
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
# -u/--upgrade Imply --force
|
||||
#
|
||||
|
||||
PYENV_VIRTUALENV_VERSION="1.2.1"
|
||||
PYENV_VIRTUALENV_VERSION="1.2.3"
|
||||
|
||||
set -e
|
||||
[ -n "$PYENV_DEBUG" ] && set -x
|
||||
@@ -54,6 +54,12 @@ parse_options() {
|
||||
done
|
||||
}
|
||||
|
||||
colorize() {
|
||||
if [ -t 1 ]; then printf "\e[%sm%s\e[m" "$1" "$2"
|
||||
else echo -n "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
resolve_link() {
|
||||
$(type -p greadlink readlink | head -1) "$1"
|
||||
}
|
||||
|
||||
@@ -138,7 +138,18 @@ EOS
|
||||
deactivated
|
||||
set -gx PYENV_VIRTUAL_ENV "${PYENV_ROOT}/versions/venv";
|
||||
set -gx VIRTUAL_ENV "${PYENV_ROOT}/versions/venv";
|
||||
pyenv-virtualenv: prompt changing not working for fish.
|
||||
functions -e _pyenv_old_prompt # remove old prompt function if exists.
|
||||
# since everything is in memory, it's safe to
|
||||
# remove it.
|
||||
functions -c fish_prompt _pyenv_old_prompt # backup old prompt function
|
||||
|
||||
# from python-venv
|
||||
function fish_prompt
|
||||
set -l prompt (_pyenv_old_prompt) # call old prompt function first since it might
|
||||
# read exit status
|
||||
echo -n "(venv) " # add virtualenv to prompt
|
||||
string join -- \n \$prompt # handle multiline prompts
|
||||
end
|
||||
EOS
|
||||
|
||||
unstub pyenv-version-name
|
||||
@@ -164,7 +175,18 @@ set -gx PYENV_VERSION "venv";
|
||||
set -gx PYENV_ACTIVATE_SHELL 1;
|
||||
set -gx PYENV_VIRTUAL_ENV "${PYENV_ROOT}/versions/venv";
|
||||
set -gx VIRTUAL_ENV "${PYENV_ROOT}/versions/venv";
|
||||
pyenv-virtualenv: prompt changing not working for fish.
|
||||
functions -e _pyenv_old_prompt # remove old prompt function if exists.
|
||||
# since everything is in memory, it's safe to
|
||||
# remove it.
|
||||
functions -c fish_prompt _pyenv_old_prompt # backup old prompt function
|
||||
|
||||
# from python-venv
|
||||
function fish_prompt
|
||||
set -l prompt (_pyenv_old_prompt) # call old prompt function first since it might
|
||||
# read exit status
|
||||
echo -n "(venv) " # add virtualenv to prompt
|
||||
string join -- \n \$prompt # handle multiline prompts
|
||||
end
|
||||
EOS
|
||||
|
||||
unstub pyenv-version-name
|
||||
@@ -239,7 +261,18 @@ set -gx PYENV_VERSION "venv27";
|
||||
set -gx PYENV_ACTIVATE_SHELL 1;
|
||||
set -gx PYENV_VIRTUAL_ENV "${PYENV_ROOT}/versions/venv27";
|
||||
set -gx VIRTUAL_ENV "${PYENV_ROOT}/versions/venv27";
|
||||
pyenv-virtualenv: prompt changing not working for fish.
|
||||
functions -e _pyenv_old_prompt # remove old prompt function if exists.
|
||||
# since everything is in memory, it's safe to
|
||||
# remove it.
|
||||
functions -c fish_prompt _pyenv_old_prompt # backup old prompt function
|
||||
|
||||
# from python-venv
|
||||
function fish_prompt
|
||||
set -l prompt (_pyenv_old_prompt) # call old prompt function first since it might
|
||||
# read exit status
|
||||
echo -n "(venv27) " # add virtualenv to prompt
|
||||
string join -- \n \$prompt # handle multiline prompts
|
||||
end
|
||||
EOS
|
||||
|
||||
unstub pyenv-virtualenv-prefix
|
||||
@@ -263,7 +296,18 @@ set -gx PYENV_VERSION "venv27";
|
||||
set -gx PYENV_ACTIVATE_SHELL 1;
|
||||
set -gx PYENV_VIRTUAL_ENV "${PYENV_ROOT}/versions/venv27";
|
||||
set -gx VIRTUAL_ENV "${PYENV_ROOT}/versions/venv27";
|
||||
pyenv-virtualenv: prompt changing not working for fish.
|
||||
functions -e _pyenv_old_prompt # remove old prompt function if exists.
|
||||
# since everything is in memory, it's safe to
|
||||
# remove it.
|
||||
functions -c fish_prompt _pyenv_old_prompt # backup old prompt function
|
||||
|
||||
# from python-venv
|
||||
function fish_prompt
|
||||
set -l prompt (_pyenv_old_prompt) # call old prompt function first since it might
|
||||
# read exit status
|
||||
echo -n "(venv27) " # add virtualenv to prompt
|
||||
string join -- \n \$prompt # handle multiline prompts
|
||||
end
|
||||
EOS
|
||||
|
||||
unstub pyenv-virtualenv-prefix
|
||||
@@ -395,6 +439,34 @@ EOS
|
||||
unstub pyenv-prefix
|
||||
}
|
||||
|
||||
@test "do nothing if a 3rd-party virtualenv is active" {
|
||||
export PYENV_VIRTUALENV_INIT=1
|
||||
export VIRTUAL_ENV="${TMP}/venv-3rd-party"
|
||||
unset PYENV_VIRTUAL_ENV
|
||||
|
||||
PYENV_SHELL="bash" run pyenv-sh-activate "venv"
|
||||
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
pyenv-virtualenv: virtualenv \`${TMP}/venv-3rd-party' is already activated
|
||||
true
|
||||
EOS
|
||||
}
|
||||
|
||||
@test "do nothing if a 3rd-party virtualenv is active over ours" {
|
||||
export PYENV_VIRTUALENV_INIT=1
|
||||
export VIRTUAL_ENV="${TMP}/venv-3rd-party"
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
|
||||
|
||||
PYENV_SHELL="bash" run pyenv-sh-activate "venv"
|
||||
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
pyenv-virtualenv: virtualenv \`${TMP}/venv-3rd-party' is already activated
|
||||
true
|
||||
EOS
|
||||
}
|
||||
|
||||
@test "should fail if activate is invoked as a command" {
|
||||
run pyenv-activate
|
||||
|
||||
|
||||
@@ -70,7 +70,18 @@ deactivated
|
||||
set -gx PYENV_VIRTUAL_ENV "${TMP}/pyenv/versions/anaconda-2.3.0";
|
||||
set -gx VIRTUAL_ENV "${TMP}/pyenv/versions/anaconda-2.3.0";
|
||||
set -gx CONDA_DEFAULT_ENV "root";
|
||||
pyenv-virtualenv: prompt changing not working for fish.
|
||||
functions -e _pyenv_old_prompt # remove old prompt function if exists.
|
||||
# since everything is in memory, it's safe to
|
||||
# remove it.
|
||||
functions -c fish_prompt _pyenv_old_prompt # backup old prompt function
|
||||
|
||||
# from python-venv
|
||||
function fish_prompt
|
||||
set -l prompt (_pyenv_old_prompt) # call old prompt function first since it might
|
||||
# read exit status
|
||||
echo -n "(anaconda-2.3.0) " # add virtualenv to prompt
|
||||
string join -- \n \$prompt # handle multiline prompts
|
||||
end
|
||||
EOS
|
||||
|
||||
unstub pyenv-version-name
|
||||
|
||||
@@ -82,6 +82,13 @@ if [ -n "\$_OLD_VIRTUAL_PYTHONHOME" ];
|
||||
set -gx PYTHONHOME "\$_OLD_VIRTUAL_PYTHONHOME";
|
||||
set -e _OLD_VIRTUAL_PYTHONHOME;
|
||||
end;
|
||||
# check if old prompt function exists
|
||||
if functions -q _pyenv_old_prompt
|
||||
# remove old prompt function if exists.
|
||||
functions -e fish_prompt
|
||||
functions -c _pyenv_old_prompt fish_prompt
|
||||
functions -e _pyenv_old_prompt
|
||||
end
|
||||
if functions -q deactivate;
|
||||
functions -e deactivate;
|
||||
end;
|
||||
|
||||
@@ -225,6 +225,13 @@ if [ -n "\$_OLD_VIRTUAL_PYTHONHOME" ];
|
||||
set -gx PYTHONHOME "\$_OLD_VIRTUAL_PYTHONHOME";
|
||||
set -e _OLD_VIRTUAL_PYTHONHOME;
|
||||
end;
|
||||
# check if old prompt function exists
|
||||
if functions -q _pyenv_old_prompt
|
||||
# remove old prompt function if exists.
|
||||
functions -e fish_prompt
|
||||
functions -c _pyenv_old_prompt fish_prompt
|
||||
functions -e _pyenv_old_prompt
|
||||
end
|
||||
if functions -q deactivate;
|
||||
functions -e deactivate;
|
||||
end;
|
||||
@@ -251,6 +258,13 @@ if [ -n "\$_OLD_VIRTUAL_PYTHONHOME" ];
|
||||
set -gx PYTHONHOME "\$_OLD_VIRTUAL_PYTHONHOME";
|
||||
set -e _OLD_VIRTUAL_PYTHONHOME;
|
||||
end;
|
||||
# check if old prompt function exists
|
||||
if functions -q _pyenv_old_prompt
|
||||
# remove old prompt function if exists.
|
||||
functions -e fish_prompt
|
||||
functions -c _pyenv_old_prompt fish_prompt
|
||||
functions -e _pyenv_old_prompt
|
||||
end
|
||||
if functions -q deactivate;
|
||||
functions -e deactivate;
|
||||
end;
|
||||
@@ -279,6 +293,13 @@ if [ -n "\$_OLD_VIRTUAL_PYTHONHOME" ];
|
||||
set -gx PYTHONHOME "\$_OLD_VIRTUAL_PYTHONHOME";
|
||||
set -e _OLD_VIRTUAL_PYTHONHOME;
|
||||
end;
|
||||
# check if old prompt function exists
|
||||
if functions -q _pyenv_old_prompt
|
||||
# remove old prompt function if exists.
|
||||
functions -e fish_prompt
|
||||
functions -c _pyenv_old_prompt fish_prompt
|
||||
functions -e _pyenv_old_prompt
|
||||
end
|
||||
if functions -q deactivate;
|
||||
functions -e deactivate;
|
||||
end;
|
||||
@@ -307,6 +328,13 @@ if [ -n "\$_OLD_VIRTUAL_PYTHONHOME" ];
|
||||
set -gx PYTHONHOME "\$_OLD_VIRTUAL_PYTHONHOME";
|
||||
set -e _OLD_VIRTUAL_PYTHONHOME;
|
||||
end;
|
||||
# check if old prompt function exists
|
||||
if functions -q _pyenv_old_prompt
|
||||
# remove old prompt function if exists.
|
||||
functions -e fish_prompt
|
||||
functions -c _pyenv_old_prompt fish_prompt
|
||||
functions -e _pyenv_old_prompt
|
||||
end
|
||||
if functions -q deactivate;
|
||||
functions -e deactivate;
|
||||
end;
|
||||
@@ -333,6 +361,13 @@ if [ -n "\$_OLD_VIRTUAL_PYTHONHOME" ];
|
||||
set -gx PYTHONHOME "\$_OLD_VIRTUAL_PYTHONHOME";
|
||||
set -e _OLD_VIRTUAL_PYTHONHOME;
|
||||
end;
|
||||
# check if old prompt function exists
|
||||
if functions -q _pyenv_old_prompt
|
||||
# remove old prompt function if exists.
|
||||
functions -e fish_prompt
|
||||
functions -c _pyenv_old_prompt fish_prompt
|
||||
functions -e _pyenv_old_prompt
|
||||
end
|
||||
if functions -q deactivate;
|
||||
functions -e deactivate;
|
||||
end;
|
||||
|
||||
@@ -11,11 +11,10 @@ _STUB_RUN="${PROGRAM}_STUB_RUN"
|
||||
_STUB_INDEX="${PROGRAM}_STUB_INDEX"
|
||||
_STUB_RESULT="${PROGRAM}_STUB_RESULT"
|
||||
_STUB_END="${PROGRAM}_STUB_END"
|
||||
_STUB_DEBUG="${PROGRAM}_STUB_DEBUG"
|
||||
_STUB_LOG="${PROGRAM}_STUB_LOG"
|
||||
|
||||
if [ -n "${!_STUB_DEBUG}" ]; then
|
||||
echo "$program" "$@" >&${!_STUB_DEBUG}
|
||||
fi
|
||||
[ -n "${!_STUB_LOG}" ] || eval "${_STUB_LOG}"="${TMPDIR}/${program}-stub-log"
|
||||
if test -z "${!_STUB_END}"; then echo "$program" "$@" >>"${!_STUB_LOG}"; fi
|
||||
|
||||
[ -e "${!_STUB_PLAN}" ] || exit 1
|
||||
[ -n "${!_STUB_RUN}" ] || eval "${_STUB_RUN}"="${TMPDIR}/${program}-stub-run"
|
||||
@@ -24,7 +23,7 @@ fi
|
||||
# Initialize or load the stub run information.
|
||||
eval "${_STUB_INDEX}"=1
|
||||
eval "${_STUB_RESULT}"=0
|
||||
[ ! -e "${!_STUB_RUN}" ] || source "${!_STUB_RUN}"
|
||||
if test -e "${!_STUB_RUN}"; then source "${!_STUB_RUN}"; fi
|
||||
|
||||
|
||||
# Loop over each line in the plan.
|
||||
@@ -80,14 +79,26 @@ done < "${!_STUB_PLAN}"
|
||||
|
||||
|
||||
if [ -n "${!_STUB_END}" ]; then
|
||||
# Clean up the run file.
|
||||
rm -f "${!_STUB_RUN}"
|
||||
|
||||
# If the number of lines in the plan is larger than
|
||||
# the requested index, we failed.
|
||||
if [ $index -ge "${!_STUB_INDEX}" ]; then
|
||||
eval "${_STUB_RESULT}"=1
|
||||
fi
|
||||
if [ "${!_STUB_RESULT}" -ne 0 ]; then
|
||||
{
|
||||
echo "index: $index; stub index: ${!_STUB_INDEX}"
|
||||
echo "plan:"
|
||||
cat "${!_STUB_PLAN}" || true
|
||||
echo "run:"
|
||||
cat "${!_STUB_RUN}" || true
|
||||
echo "log:"
|
||||
cat "${!_STUB_LOG}" || true
|
||||
} >&2
|
||||
fi
|
||||
|
||||
# Clean up the run file.
|
||||
rm -f "${!_STUB_RUN}"
|
||||
rm -f "${!_STUB_LOG}"
|
||||
|
||||
# Return the result.
|
||||
exit "${!_STUB_RESULT}"
|
||||
|
||||
@@ -16,6 +16,7 @@ stub() {
|
||||
|
||||
export "${prefix}_STUB_PLAN"="${TMP}/${program}-stub-plan"
|
||||
export "${prefix}_STUB_RUN"="${TMP}/${program}-stub-run"
|
||||
export "${prefix}_STUB_LOG"="${TMP}/${program}-stub-log"
|
||||
export "${prefix}_STUB_END"=
|
||||
|
||||
mkdir -p "${TMP}/bin"
|
||||
|
||||
Reference in New Issue
Block a user