mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-13 22:13:52 -05:00
Compare commits
6 Commits
v1.2.3
...
e83e7496fa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e83e7496fa | ||
|
|
6c523f4ce3 | ||
|
|
119c4db68c | ||
|
|
83fae32522 | ||
|
|
96d066e44c | ||
|
|
9f3afd0cfb |
40
CHANGELOG.md
40
CHANGELOG.md
@@ -1,45 +1,5 @@
|
|||||||
## Version History
|
## 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
|
#### 1.1.5
|
||||||
|
|
||||||
* Fix install script (#290, #302)
|
* Fix install script (#290, #302)
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
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
|
|
||||||
@@ -243,6 +243,7 @@ You can set certain environment variables to control pyenv-virtualenv.
|
|||||||
* `PIP_VERSION`, if set and `venv` is preferred
|
* `PIP_VERSION`, if set and `venv` is preferred
|
||||||
over `virtualenv`, install the specified version of pip.
|
over `virtualenv`, install the specified version of pip.
|
||||||
* `PYENV_VIRTUALENV_VERBOSE_ACTIVATE`, if set, shows some verbose outputs on activation and deactivation
|
* `PYENV_VIRTUALENV_VERBOSE_ACTIVATE`, if set, shows some verbose outputs on activation and deactivation
|
||||||
|
* `PYENV_VIRTUALENV_PROMPT`, if set, allows users to customize how `pyenv-virtualenv` modifies their shell prompt. The default prompt ("(venv)") is overwritten with any user-specified text. Specify the location of the virtual environment name with the string `{venv}`. For example, the default prompt string would be `({venv})`.
|
||||||
|
|
||||||
## Version History
|
## Version History
|
||||||
|
|
||||||
|
|||||||
@@ -96,8 +96,8 @@ fi
|
|||||||
venv="${versions}"
|
venv="${versions}"
|
||||||
|
|
||||||
if [ -n "${VIRTUAL_ENV}" ]; then
|
if [ -n "${VIRTUAL_ENV}" ]; then
|
||||||
# exit as success if a non-pyenv virtualenv is active
|
# exit as success if some virtualenv is already activated outside from pyenv-virtualenv
|
||||||
if [[ -z $PYENV_VIRTUAL_ENV || $PYENV_VIRTUAL_ENV != "$VIRTUAL_ENV" ]]; then
|
if [ -z "${PYENV_VIRTUAL_ENV}" ]; then
|
||||||
if [ -z "${FORCE}" ]; then
|
if [ -z "${FORCE}" ]; then
|
||||||
if [ -z "${QUIET}" ]; then
|
if [ -z "${QUIET}" ]; then
|
||||||
echo "pyenv-virtualenv: virtualenv \`${VIRTUAL_ENV}' is already activated" 1>&2
|
echo "pyenv-virtualenv: virtualenv \`${VIRTUAL_ENV}' is already activated" 1>&2
|
||||||
@@ -262,9 +262,14 @@ EOS
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
|
if [ -z "${PYENV_VIRTUALENV_PROMPT}" ]; then
|
||||||
|
PYENV_VIRTUALENV_PROMPT="(${venv})"
|
||||||
|
else
|
||||||
|
PYENV_VIRTUALENV_PROMPT="${PYENV_VIRTUALENV_PROMPT/\{venv\}/${venv}}"
|
||||||
|
fi
|
||||||
cat <<EOS
|
cat <<EOS
|
||||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||||
export PS1="(${venv}) \${PS1:-}";
|
export PS1="${PYENV_VIRTUALENV_PROMPT} \${PS1:-}";
|
||||||
EOS
|
EOS
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
# -u/--upgrade Imply --force
|
# -u/--upgrade Imply --force
|
||||||
#
|
#
|
||||||
|
|
||||||
PYENV_VIRTUALENV_VERSION="1.2.3"
|
PYENV_VIRTUALENV_VERSION="1.2.2"
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
[ -n "$PYENV_DEBUG" ] && set -x
|
[ -n "$PYENV_DEBUG" ] && set -x
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ setup() {
|
|||||||
unset PYENV_VIRTUALENV_DISABLE_PROMPT
|
unset PYENV_VIRTUALENV_DISABLE_PROMPT
|
||||||
unset PYENV_VIRTUAL_ENV_DISABLE_PROMPT
|
unset PYENV_VIRTUAL_ENV_DISABLE_PROMPT
|
||||||
unset VIRTUAL_ENV_DISABLE_PROMPT
|
unset VIRTUAL_ENV_DISABLE_PROMPT
|
||||||
|
unset PYENV_VIRTUALENV_PROMPT
|
||||||
unset _OLD_VIRTUAL_PS1
|
unset _OLD_VIRTUAL_PS1
|
||||||
stub pyenv-hooks "activate : echo"
|
stub pyenv-hooks "activate : echo"
|
||||||
}
|
}
|
||||||
@@ -44,6 +45,31 @@ EOS
|
|||||||
unstub pyenv-sh-deactivate
|
unstub pyenv-sh-deactivate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "activate virtualenv from current version with custom prompt" {
|
||||||
|
export PYENV_VIRTUALENV_INIT=1
|
||||||
|
|
||||||
|
stub pyenv-version-name "echo venv"
|
||||||
|
stub pyenv-virtualenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\""
|
||||||
|
stub pyenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\""
|
||||||
|
stub pyenv-sh-deactivate "--force --quiet : echo deactivated"
|
||||||
|
|
||||||
|
PYENV_SHELL="bash" PYENV_VERSION="venv" PYENV_VIRTUALENV_PROMPT='venv:{venv}' run pyenv-sh-activate
|
||||||
|
|
||||||
|
assert_success
|
||||||
|
assert_output <<EOS
|
||||||
|
deactivated
|
||||||
|
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
|
||||||
|
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
|
||||||
|
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||||
|
export PS1="venv:venv \${PS1:-}";
|
||||||
|
EOS
|
||||||
|
|
||||||
|
unstub pyenv-version-name
|
||||||
|
unstub pyenv-virtualenv-prefix
|
||||||
|
unstub pyenv-prefix
|
||||||
|
unstub pyenv-sh-deactivate
|
||||||
|
}
|
||||||
|
|
||||||
@test "activate virtualenv from current version (quiet)" {
|
@test "activate virtualenv from current version (quiet)" {
|
||||||
export PYENV_VIRTUALENV_INIT=1
|
export PYENV_VIRTUALENV_INIT=1
|
||||||
|
|
||||||
@@ -439,34 +465,6 @@ EOS
|
|||||||
unstub pyenv-prefix
|
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" {
|
@test "should fail if activate is invoked as a command" {
|
||||||
run pyenv-activate
|
run pyenv-activate
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ setup() {
|
|||||||
unset PYENV_VIRTUALENV_DISABLE_PROMPT
|
unset PYENV_VIRTUALENV_DISABLE_PROMPT
|
||||||
unset PYENV_VIRTUAL_ENV_DISABLE_PROMPT
|
unset PYENV_VIRTUAL_ENV_DISABLE_PROMPT
|
||||||
unset VIRTUAL_ENV_DISABLE_PROMPT
|
unset VIRTUAL_ENV_DISABLE_PROMPT
|
||||||
|
unset PYENV_VIRTUALENV_PROMPT
|
||||||
unset _OLD_VIRTUAL_PS1
|
unset _OLD_VIRTUAL_PS1
|
||||||
stub pyenv-hooks "activate : echo"
|
stub pyenv-hooks "activate : echo"
|
||||||
}
|
}
|
||||||
@@ -53,6 +54,35 @@ EOS
|
|||||||
teardown_conda "anaconda-2.3.0"
|
teardown_conda "anaconda-2.3.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "activate conda root from current version with custom prompt" {
|
||||||
|
export PYENV_VIRTUALENV_INIT=1
|
||||||
|
|
||||||
|
setup_conda "anaconda-2.3.0"
|
||||||
|
stub pyenv-version-name "echo anaconda-2.3.0"
|
||||||
|
stub pyenv-virtualenv-prefix "anaconda-2.3.0 : echo \"${PYENV_ROOT}/versions/anaconda-2.3.0\""
|
||||||
|
stub pyenv-prefix "anaconda-2.3.0 : echo \"${PYENV_ROOT}/versions/anaconda-2.3.0\""
|
||||||
|
stub pyenv-sh-deactivate "--force --quiet : echo deactivated"
|
||||||
|
|
||||||
|
PYENV_SHELL="bash" PYENV_VERSION="anaconda-2.3.0" PYENV_VIRTUALENV_PROMPT='venv:{venv}' run pyenv-sh-activate
|
||||||
|
|
||||||
|
assert_success
|
||||||
|
assert_output <<EOS
|
||||||
|
deactivated
|
||||||
|
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/anaconda-2.3.0";
|
||||||
|
export VIRTUAL_ENV="${PYENV_ROOT}/versions/anaconda-2.3.0";
|
||||||
|
export CONDA_DEFAULT_ENV="root";
|
||||||
|
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||||
|
export PS1="venv:anaconda-2.3.0 \${PS1:-}";
|
||||||
|
export CONDA_PREFIX="${TMP}/pyenv/versions/anaconda-2.3.0";
|
||||||
|
EOS
|
||||||
|
|
||||||
|
unstub pyenv-version-name
|
||||||
|
unstub pyenv-virtualenv-prefix
|
||||||
|
unstub pyenv-prefix
|
||||||
|
unstub pyenv-sh-deactivate
|
||||||
|
teardown_conda "anaconda-2.3.0"
|
||||||
|
}
|
||||||
|
|
||||||
@test "activate conda root from current version (fish)" {
|
@test "activate conda root from current version (fish)" {
|
||||||
export PYENV_VIRTUALENV_INIT=1
|
export PYENV_VIRTUALENV_INIT=1
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ setup() {
|
|||||||
export PYENV_ROOT="${TMP}/pyenv"
|
export PYENV_ROOT="${TMP}/pyenv"
|
||||||
export HOOK_PATH="${TMP}/i has hooks"
|
export HOOK_PATH="${TMP}/i has hooks"
|
||||||
mkdir -p "$HOOK_PATH"
|
mkdir -p "$HOOK_PATH"
|
||||||
|
unset PYENV_VIRTUALENV_PROMPT
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "pyenv-virtualenv hooks" {
|
@test "pyenv-virtualenv hooks" {
|
||||||
|
|||||||
@@ -11,10 +11,11 @@ _STUB_RUN="${PROGRAM}_STUB_RUN"
|
|||||||
_STUB_INDEX="${PROGRAM}_STUB_INDEX"
|
_STUB_INDEX="${PROGRAM}_STUB_INDEX"
|
||||||
_STUB_RESULT="${PROGRAM}_STUB_RESULT"
|
_STUB_RESULT="${PROGRAM}_STUB_RESULT"
|
||||||
_STUB_END="${PROGRAM}_STUB_END"
|
_STUB_END="${PROGRAM}_STUB_END"
|
||||||
_STUB_LOG="${PROGRAM}_STUB_LOG"
|
_STUB_DEBUG="${PROGRAM}_STUB_DEBUG"
|
||||||
|
|
||||||
[ -n "${!_STUB_LOG}" ] || eval "${_STUB_LOG}"="${TMPDIR}/${program}-stub-log"
|
if [ -n "${!_STUB_DEBUG}" ]; then
|
||||||
if test -z "${!_STUB_END}"; then echo "$program" "$@" >>"${!_STUB_LOG}"; fi
|
echo "$program" "$@" >&${!_STUB_DEBUG}
|
||||||
|
fi
|
||||||
|
|
||||||
[ -e "${!_STUB_PLAN}" ] || exit 1
|
[ -e "${!_STUB_PLAN}" ] || exit 1
|
||||||
[ -n "${!_STUB_RUN}" ] || eval "${_STUB_RUN}"="${TMPDIR}/${program}-stub-run"
|
[ -n "${!_STUB_RUN}" ] || eval "${_STUB_RUN}"="${TMPDIR}/${program}-stub-run"
|
||||||
@@ -23,7 +24,7 @@ if test -z "${!_STUB_END}"; then echo "$program" "$@" >>"${!_STUB_LOG}"; fi
|
|||||||
# Initialize or load the stub run information.
|
# Initialize or load the stub run information.
|
||||||
eval "${_STUB_INDEX}"=1
|
eval "${_STUB_INDEX}"=1
|
||||||
eval "${_STUB_RESULT}"=0
|
eval "${_STUB_RESULT}"=0
|
||||||
if test -e "${!_STUB_RUN}"; then source "${!_STUB_RUN}"; fi
|
[ ! -e "${!_STUB_RUN}" ] || source "${!_STUB_RUN}"
|
||||||
|
|
||||||
|
|
||||||
# Loop over each line in the plan.
|
# Loop over each line in the plan.
|
||||||
@@ -79,26 +80,14 @@ done < "${!_STUB_PLAN}"
|
|||||||
|
|
||||||
|
|
||||||
if [ -n "${!_STUB_END}" ]; then
|
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
|
# If the number of lines in the plan is larger than
|
||||||
# the requested index, we failed.
|
# the requested index, we failed.
|
||||||
if [ $index -ge "${!_STUB_INDEX}" ]; then
|
if [ $index -ge "${!_STUB_INDEX}" ]; then
|
||||||
eval "${_STUB_RESULT}"=1
|
eval "${_STUB_RESULT}"=1
|
||||||
fi
|
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.
|
# Return the result.
|
||||||
exit "${!_STUB_RESULT}"
|
exit "${!_STUB_RESULT}"
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ stub() {
|
|||||||
|
|
||||||
export "${prefix}_STUB_PLAN"="${TMP}/${program}-stub-plan"
|
export "${prefix}_STUB_PLAN"="${TMP}/${program}-stub-plan"
|
||||||
export "${prefix}_STUB_RUN"="${TMP}/${program}-stub-run"
|
export "${prefix}_STUB_RUN"="${TMP}/${program}-stub-run"
|
||||||
export "${prefix}_STUB_LOG"="${TMP}/${program}-stub-log"
|
|
||||||
export "${prefix}_STUB_END"=
|
export "${prefix}_STUB_END"=
|
||||||
|
|
||||||
mkdir -p "${TMP}/bin"
|
mkdir -p "${TMP}/bin"
|
||||||
|
|||||||
Reference in New Issue
Block a user