mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-12 13:33:52 -05:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad644e83b5 | ||
|
|
0786c7c5b6 | ||
|
|
58e93f9e0d | ||
|
|
2060c43387 | ||
|
|
a02eb0a396 |
@@ -28,7 +28,7 @@ From inside that directory you can:
|
|||||||
|
|
||||||
$ git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
|
$ git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
|
||||||
|
|
||||||
2. **Add `pyenv virtualenv-init` to your shell** to enable activation of virtualenv
|
2. **Add `pyenv virtualenv-init` to your shell** to enable activation of virtualenv. This is entirely optional but pretty useful.
|
||||||
|
|
||||||
$ echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile
|
$ echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile
|
||||||
|
|
||||||
@@ -149,6 +149,11 @@ You can set certain environment variables to control the pyenv-virtualenv.
|
|||||||
|
|
||||||
## Version History
|
## Version History
|
||||||
|
|
||||||
|
#### 20141106
|
||||||
|
|
||||||
|
* Stop creating after `ensurepip` since it has done by `ensurepip` itself
|
||||||
|
* Suppress some useless warnings from `pyenv virtualenv-init`
|
||||||
|
|
||||||
#### 20141012
|
#### 20141012
|
||||||
|
|
||||||
* Fix warnings from `shellcheck` to improve support for POSIX sh (#40)
|
* Fix warnings from `shellcheck` to improve support for POSIX sh (#40)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
# -f/--force Install even if the version appears to be installed already
|
# -f/--force Install even if the version appears to be installed already
|
||||||
#
|
#
|
||||||
|
|
||||||
PYENV_VIRTUALENV_VERSION="20141012"
|
PYENV_VIRTUALENV_VERSION="20141106"
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
[ -n "$PYENV_DEBUG" ] && set -x
|
[ -n "$PYENV_DEBUG" ] && set -x
|
||||||
@@ -185,28 +185,6 @@ build_package_ensurepip() {
|
|||||||
pyenv-exec python -m ensurepip 2>/dev/null|| {
|
pyenv-exec python -m ensurepip 2>/dev/null|| {
|
||||||
build_package_ez_setup "$@" && build_package_get_pip "$@"
|
build_package_ez_setup "$@" && build_package_get_pip "$@"
|
||||||
} || return 1
|
} || return 1
|
||||||
|
|
||||||
create_symlinks "$(pyenv-exec python -c 'import sys;v=sys.version_info;sys.stdout.write("python%d.%d"%(v[0],v[1]))')"
|
|
||||||
}
|
|
||||||
|
|
||||||
create_symlinks() {
|
|
||||||
local suffix="$1"
|
|
||||||
|
|
||||||
local file link
|
|
||||||
shopt -s nullglob
|
|
||||||
for file in "${VIRTUALENV_PATH}/bin"/*; do
|
|
||||||
if [[ "${file##*/}" == *"${suffix}" ]]; then
|
|
||||||
if [[ "${file}" == *"-${suffix}" ]]; then
|
|
||||||
link="${file%%-${suffix}}"
|
|
||||||
else
|
|
||||||
link="${file%%${suffix}}"
|
|
||||||
fi
|
|
||||||
if [ ! -e "${link}" ]; then
|
|
||||||
( cd "${file%/*}" && ln -fs "${file##*/}" "${link##*/}" )
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
shopt -u nullglob
|
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_requirements() {
|
prepare_requirements() {
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ function _pyenv_virtualenv_hook --on-event fish_prompt;
|
|||||||
set -e PYENV_DEACTIVATE
|
set -e PYENV_DEACTIVATE
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
if [ "\$PYENV_ACTIVATE" != (pyenv prefix) ]
|
if [ "\$PYENV_ACTIVATE" != (pyenv prefix 2>/dev/null) ]
|
||||||
if pyenv deactivate --no-error --verbose
|
if pyenv deactivate --no-error --verbose
|
||||||
set -e PYENV_DEACTIVATE
|
set -e PYENV_DEACTIVATE
|
||||||
pyenv activate --no-error --verbose; or set -e PYENV_DEACTIVATE
|
pyenv activate --no-error --verbose; or set -e PYENV_DEACTIVATE
|
||||||
@@ -90,7 +90,7 @@ function _pyenv_virtualenv_hook --on-event fish_prompt;
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if [ -z "\$VIRTUAL_ENV" ]; and [ "\$PYENV_DEACTIVATE" != (pyenv prefix) ]
|
if [ -z "\$VIRTUAL_ENV" ]; and [ "\$PYENV_DEACTIVATE" != (pyenv prefix 2>/dev/null) ]
|
||||||
pyenv activate --no-error --verbose
|
pyenv activate --no-error --verbose
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -117,7 +117,7 @@ if [[ "$shell" != "fish" ]]; then
|
|||||||
unset PYENV_DEACTIVATE
|
unset PYENV_DEACTIVATE
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if [ "\$PYENV_ACTIVATE" != "\$(pyenv prefix)" ]; then
|
if [ "\$PYENV_ACTIVATE" != "\$(pyenv prefix 2>/dev/null)" ]; then
|
||||||
if pyenv deactivate --no-error --verbose; then
|
if pyenv deactivate --no-error --verbose; then
|
||||||
unset PYENV_DEACTIVATE
|
unset PYENV_DEACTIVATE
|
||||||
pyenv activate --no-error --verbose || unset PYENV_DEACTIVATE
|
pyenv activate --no-error --verbose || unset PYENV_DEACTIVATE
|
||||||
@@ -126,7 +126,7 @@ if [[ "$shell" != "fish" ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ -z "\$VIRTUAL_ENV" ] && [ "\$PYENV_DEACTIVATE" != "\$(pyenv prefix)" ]; then
|
if [ -z "\$VIRTUAL_ENV" ] && [ "\$PYENV_DEACTIVATE" != "\$(pyenv prefix 2>/dev/null)" ]; then
|
||||||
pyenv activate --no-error --verbose
|
pyenv activate --no-error --verbose
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ _pyenv_virtualenv_hook() {
|
|||||||
unset PYENV_DEACTIVATE
|
unset PYENV_DEACTIVATE
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if [ "\$PYENV_ACTIVATE" != "\$(pyenv prefix)" ]; then
|
if [ "\$PYENV_ACTIVATE" != "\$(pyenv prefix 2>/dev/null)" ]; then
|
||||||
if pyenv deactivate --no-error --verbose; then
|
if pyenv deactivate --no-error --verbose; then
|
||||||
unset PYENV_DEACTIVATE
|
unset PYENV_DEACTIVATE
|
||||||
pyenv activate --no-error --verbose || unset PYENV_DEACTIVATE
|
pyenv activate --no-error --verbose || unset PYENV_DEACTIVATE
|
||||||
@@ -46,7 +46,7 @@ _pyenv_virtualenv_hook() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ -z "\$VIRTUAL_ENV" ] && [ "\$PYENV_DEACTIVATE" != "\$(pyenv prefix)" ]; then
|
if [ -z "\$VIRTUAL_ENV" ] && [ "\$PYENV_DEACTIVATE" != "\$(pyenv prefix 2>/dev/null)" ]; then
|
||||||
pyenv activate --no-error --verbose
|
pyenv activate --no-error --verbose
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -69,7 +69,7 @@ function _pyenv_virtualenv_hook --on-event fish_prompt;
|
|||||||
set -e PYENV_DEACTIVATE
|
set -e PYENV_DEACTIVATE
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
if [ "\$PYENV_ACTIVATE" != (pyenv prefix) ]
|
if [ "\$PYENV_ACTIVATE" != (pyenv prefix 2>/dev/null) ]
|
||||||
if pyenv deactivate --no-error --verbose
|
if pyenv deactivate --no-error --verbose
|
||||||
set -e PYENV_DEACTIVATE
|
set -e PYENV_DEACTIVATE
|
||||||
pyenv activate --no-error --verbose; or set -e PYENV_DEACTIVATE
|
pyenv activate --no-error --verbose; or set -e PYENV_DEACTIVATE
|
||||||
@@ -78,7 +78,7 @@ function _pyenv_virtualenv_hook --on-event fish_prompt;
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if [ -z "\$VIRTUAL_ENV" ]; and [ "\$PYENV_DEACTIVATE" != (pyenv prefix) ]
|
if [ -z "\$VIRTUAL_ENV" ]; and [ "\$PYENV_DEACTIVATE" != (pyenv prefix 2>/dev/null) ]
|
||||||
pyenv activate --no-error --verbose
|
pyenv activate --no-error --verbose
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -98,7 +98,7 @@ _pyenv_virtualenv_hook() {
|
|||||||
unset PYENV_DEACTIVATE
|
unset PYENV_DEACTIVATE
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if [ "\$PYENV_ACTIVATE" != "\$(pyenv prefix)" ]; then
|
if [ "\$PYENV_ACTIVATE" != "\$(pyenv prefix 2>/dev/null)" ]; then
|
||||||
if pyenv deactivate --no-error --verbose; then
|
if pyenv deactivate --no-error --verbose; then
|
||||||
unset PYENV_DEACTIVATE
|
unset PYENV_DEACTIVATE
|
||||||
pyenv activate --no-error --verbose || unset PYENV_DEACTIVATE
|
pyenv activate --no-error --verbose || unset PYENV_DEACTIVATE
|
||||||
@@ -107,7 +107,7 @@ _pyenv_virtualenv_hook() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ -z "\$VIRTUAL_ENV" ] && [ "\$PYENV_DEACTIVATE" != "\$(pyenv prefix)" ]; then
|
if [ -z "\$VIRTUAL_ENV" ] && [ "\$PYENV_DEACTIVATE" != "\$(pyenv prefix 2>/dev/null)" ]; then
|
||||||
pyenv activate --no-error --verbose
|
pyenv activate --no-error --verbose
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -26,8 +26,7 @@ unstub_pyenv() {
|
|||||||
stub pyenv-prefix " : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'"
|
stub pyenv-prefix " : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'"
|
||||||
stub pyenv-prefix " : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'"
|
stub pyenv-prefix " : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'"
|
||||||
stub pyenv-exec "pyvenv ${PYENV_ROOT}/versions/venv : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";mkdir -p \${PYENV_ROOT}/versions/venv/bin"
|
stub pyenv-exec "pyvenv ${PYENV_ROOT}/versions/venv : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";mkdir -p \${PYENV_ROOT}/versions/venv/bin"
|
||||||
stub pyenv-exec "python -m ensurepip : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";touch \${PYENV_ROOT}/versions/venv/bin/pip3.4"
|
stub pyenv-exec "python -m ensurepip : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";touch \${PYENV_ROOT}/versions/venv/bin/pip"
|
||||||
stub pyenv-exec "python -c * : echo ${PYENV_VERSION%.*}"
|
|
||||||
|
|
||||||
remove_executable "3.4.1" "virtualenv"
|
remove_executable "3.4.1" "virtualenv"
|
||||||
create_executable "3.4.1" "pyvenv"
|
create_executable "3.4.1" "pyvenv"
|
||||||
@@ -54,8 +53,7 @@ OUT
|
|||||||
stub pyenv-exec "pyvenv ${PYENV_ROOT}/versions/venv : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";mkdir -p \${PYENV_ROOT}/versions/venv/bin"
|
stub pyenv-exec "pyvenv ${PYENV_ROOT}/versions/venv : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";mkdir -p \${PYENV_ROOT}/versions/venv/bin"
|
||||||
stub pyenv-exec "python -m ensurepip : false"
|
stub pyenv-exec "python -m ensurepip : false"
|
||||||
stub pyenv-exec "python */ez_setup.py : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";touch \${PYENV_ROOT}/versions/venv/bin/easy_install"
|
stub pyenv-exec "python */ez_setup.py : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";touch \${PYENV_ROOT}/versions/venv/bin/easy_install"
|
||||||
stub pyenv-exec "python */get-pip.py : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";touch \${PYENV_ROOT}/versions/venv/bin/pip3.3"
|
stub pyenv-exec "python */get-pip.py : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";touch \${PYENV_ROOT}/versions/venv/bin/pip"
|
||||||
stub pyenv-exec "python -c * : echo ${PYENV_VERSION%.*}"
|
|
||||||
stub curl true
|
stub curl true
|
||||||
stub curl true
|
stub curl true
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ unstub_pyenv() {
|
|||||||
stub pyenv-prefix " : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'"
|
stub pyenv-prefix " : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'"
|
||||||
stub pyenv-exec "pyvenv ${PYENV_ROOT}/versions/venv : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
stub pyenv-exec "pyvenv ${PYENV_ROOT}/versions/venv : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||||
stub pyenv-exec "python -m ensurepip : true"
|
stub pyenv-exec "python -m ensurepip : true"
|
||||||
stub pyenv-exec "python -c * : echo ${PYENV_VERSION%.*}"
|
|
||||||
|
|
||||||
remove_executable "3.4.1" "virtualenv"
|
remove_executable "3.4.1" "virtualenv"
|
||||||
create_executable "3.4.1" "pyvenv"
|
create_executable "3.4.1" "pyvenv"
|
||||||
@@ -51,7 +50,6 @@ OUT
|
|||||||
stub pyenv-prefix " : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'"
|
stub pyenv-prefix " : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'"
|
||||||
stub pyenv-exec "virtualenv ${PYENV_ROOT}/versions/venv : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
stub pyenv-exec "virtualenv ${PYENV_ROOT}/versions/venv : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||||
stub pyenv-exec "python -m ensurepip : true"
|
stub pyenv-exec "python -m ensurepip : true"
|
||||||
stub pyenv-exec "python -c * : echo ${PYENV_VERSION%.*}"
|
|
||||||
|
|
||||||
create_executable "3.4.1" "virtualenv"
|
create_executable "3.4.1" "virtualenv"
|
||||||
create_executable "3.4.1" "pyvenv"
|
create_executable "3.4.1" "pyvenv"
|
||||||
@@ -78,7 +76,6 @@ OUT
|
|||||||
stub pyenv-exec "python -m ensurepip : false"
|
stub pyenv-exec "python -m ensurepip : false"
|
||||||
stub pyenv-exec "python */ez_setup.py : true"
|
stub pyenv-exec "python */ez_setup.py : true"
|
||||||
stub pyenv-exec "python */get-pip.py : true"
|
stub pyenv-exec "python */get-pip.py : true"
|
||||||
stub pyenv-exec "python -c * : echo ${PYENV_VERSION%.*}"
|
|
||||||
stub curl true
|
stub curl true
|
||||||
stub curl true
|
stub curl true
|
||||||
|
|
||||||
@@ -109,7 +106,6 @@ OUT
|
|||||||
stub pyenv-exec "pip install virtualenv : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
stub pyenv-exec "pip install virtualenv : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||||
stub pyenv-exec "virtualenv --python=python3 ${PYENV_ROOT}/versions/venv : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
stub pyenv-exec "virtualenv --python=python3 ${PYENV_ROOT}/versions/venv : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||||
stub pyenv-exec "python -m ensurepip : true"
|
stub pyenv-exec "python -m ensurepip : true"
|
||||||
stub pyenv-exec "python -c * : echo ${PYENV_VERSION%.*}"
|
|
||||||
|
|
||||||
remove_executable "3.4.1" "virtualenv"
|
remove_executable "3.4.1" "virtualenv"
|
||||||
create_executable "3.4.1" "pyvenv"
|
create_executable "3.4.1" "pyvenv"
|
||||||
@@ -135,7 +131,6 @@ OUT
|
|||||||
stub pyenv-exec "pip install virtualenv : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
stub pyenv-exec "pip install virtualenv : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||||
stub pyenv-exec "virtualenv --python=python3 ${PYENV_ROOT}/versions/venv : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
stub pyenv-exec "virtualenv --python=python3 ${PYENV_ROOT}/versions/venv : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||||
stub pyenv-exec "python -m ensurepip : true"
|
stub pyenv-exec "python -m ensurepip : true"
|
||||||
stub pyenv-exec "python -c * : echo ${PYENV_VERSION%.*}"
|
|
||||||
|
|
||||||
remove_executable "3.4.1" "virtualenv"
|
remove_executable "3.4.1" "virtualenv"
|
||||||
create_executable "3.4.1" "pyvenv"
|
create_executable "3.4.1" "pyvenv"
|
||||||
@@ -163,7 +158,6 @@ OUT
|
|||||||
stub pyenv-exec "python -m ensurepip : false"
|
stub pyenv-exec "python -m ensurepip : false"
|
||||||
stub pyenv-exec "python */ez_setup.py : true"
|
stub pyenv-exec "python */ez_setup.py : true"
|
||||||
stub pyenv-exec "python */get-pip.py : true"
|
stub pyenv-exec "python */get-pip.py : true"
|
||||||
stub pyenv-exec "python -c * : echo ${PYENV_VERSION%.*}"
|
|
||||||
stub curl true
|
stub curl true
|
||||||
stub curl true
|
stub curl true
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ load test_helper
|
|||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
export PYENV_ROOT="${TMP}/pyenv"
|
export PYENV_ROOT="${TMP}/pyenv"
|
||||||
export PYENV_VIRTUALENV_VERSION="20141012"
|
export PYENV_VIRTUALENV_VERSION="20141106"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "display virtualenv version" {
|
@test "display virtualenv version" {
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ unstub_pyenv() {
|
|||||||
stub pyenv-exec "python -m ensurepip : false"
|
stub pyenv-exec "python -m ensurepip : false"
|
||||||
stub pyenv-exec "python */ez_setup.py : true"
|
stub pyenv-exec "python */ez_setup.py : true"
|
||||||
stub pyenv-exec "python */get-pip.py : true"
|
stub pyenv-exec "python */get-pip.py : true"
|
||||||
stub pyenv-exec "python -c * : echo ${PYENV_VERSION%.*}"
|
|
||||||
stub curl true
|
stub curl true
|
||||||
stub curl true
|
stub curl true
|
||||||
|
|
||||||
@@ -57,7 +56,6 @@ OUT
|
|||||||
stub pyenv-exec "python -m ensurepip : false"
|
stub pyenv-exec "python -m ensurepip : false"
|
||||||
stub pyenv-exec "python */ez_setup.py : true"
|
stub pyenv-exec "python */ez_setup.py : true"
|
||||||
stub pyenv-exec "python */get-pip.py : true"
|
stub pyenv-exec "python */get-pip.py : true"
|
||||||
stub pyenv-exec "python -c * : echo ${PYENV_VERSION%.*}"
|
|
||||||
stub curl true
|
stub curl true
|
||||||
stub curl true
|
stub curl true
|
||||||
|
|
||||||
@@ -85,7 +83,6 @@ OUT
|
|||||||
stub pyenv-exec "python -m ensurepip : false"
|
stub pyenv-exec "python -m ensurepip : false"
|
||||||
stub pyenv-exec "python */ez_setup.py : true"
|
stub pyenv-exec "python */ez_setup.py : true"
|
||||||
stub pyenv-exec "python */get-pip.py : true"
|
stub pyenv-exec "python */get-pip.py : true"
|
||||||
stub pyenv-exec "python -c * : echo ${PYENV_VERSION%.*}"
|
|
||||||
stub curl true
|
stub curl true
|
||||||
stub curl true
|
stub curl true
|
||||||
|
|
||||||
@@ -113,7 +110,6 @@ OUT
|
|||||||
stub pyenv-exec "python -m ensurepip : false"
|
stub pyenv-exec "python -m ensurepip : false"
|
||||||
stub pyenv-exec "python */ez_setup.py : true"
|
stub pyenv-exec "python */ez_setup.py : true"
|
||||||
stub pyenv-exec "python */get-pip.py : true"
|
stub pyenv-exec "python */get-pip.py : true"
|
||||||
stub pyenv-exec "python -c * : echo ${PYENV_VERSION%.*}"
|
|
||||||
stub curl true
|
stub curl true
|
||||||
stub curl true
|
stub curl true
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user