mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-08 11:33:55 -05:00
Merge branch 'master' into pr
This commit is contained in:
12
.github/FUNDING.yml
vendored
Normal file
12
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [pyenv] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: pyenv # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: ['https://www.bountysource.com/teams/pyenv-virtualenv/issues'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
29
.github/ISSUE_TEMPLATE.md
vendored
Normal file
29
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
Too many issues will kill our team's development velocity, drastically.
|
||||
Make sure you have checked all steps below.
|
||||
|
||||
### Prerequisite
|
||||
* [ ] Make sure your problem is not listed in [the common build problems](https://github.com/pyenv/pyenv/wiki/Common-build-problems).
|
||||
* [ ] Make sure no duplicated issue has already been reported in [the pyenv-virtualenv issues](https://github.com/pyenv/pyenv-virtualenv/issues). You should look in closed issues, too.
|
||||
* [ ] Make sure you are not asking us to help solving your specific issue.
|
||||
* GitHub issues is opened mainly for development purposes. If you want to ask someone to help solving your problem, go to some community site like [Gitter](https://gitter.im/yyuu/pyenv), [StackOverflow](https://stackoverflow.com/questions/tagged/pyenv), etc.
|
||||
* [ ] Make sure your problem is not derived from packaging (e.g. [Homebrew](https://brew.sh)).
|
||||
* Please refer to the package documentation for the installation issues, etc.
|
||||
* [ ] Make sure your problem is not derived from other plugins.
|
||||
* This repository is maintaining the `pyenv-virtualenv` plugin only. Please refrain from reporting issues of other plugins here.
|
||||
|
||||
### Description
|
||||
- [ ] Platform information (e.g. Ubuntu Linux 20.04):
|
||||
- [ ] OS architecture (e.g. amd64):
|
||||
- [ ] pyenv version:
|
||||
- [ ] pyenv-virtualenv version:
|
||||
- [ ] Python version:
|
||||
- [ ] virtualenv version (if installed):
|
||||
- [ ] Please attach the debug log of a faulty Pyenv invocation as a gist
|
||||
* If the problem happens in a Pyenv invocation, you can turn on debug logging by setting `PYENV_DEBUG=1`, e.g. `env PYENV_DEBUG=1 pyenv install -v 3.6.4`
|
||||
* If the problem happens outside of a Pyenv invocation, get the debug log like this:
|
||||
```
|
||||
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
|
||||
set -x
|
||||
<reproduce the problem>
|
||||
set +x
|
||||
```
|
||||
13
.github/no-response.yml
vendored
Normal file
13
.github/no-response.yml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# Configuration for probot-no-response - https://github.com/probot/no-response
|
||||
|
||||
# Number of days of inactivity before an Issue is closed for lack of response
|
||||
daysUntilClose: 30
|
||||
# Label requiring a response
|
||||
responseRequiredLabel: need-feedback
|
||||
# Comment to post when closing an Issue for lack of response. Set to `false` to disable
|
||||
closeComment: >
|
||||
This issue has been automatically closed because there has been no response
|
||||
to our request for more information from the original author. With only the
|
||||
information that is currently in the issue, we don't have enough information
|
||||
to take action. Please reach out if you have or find the answers we need so
|
||||
that we can investigate further.
|
||||
37
.github/workflows/tests.yml
vendored
Normal file
37
.github/workflows/tests.yml
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
name: tests
|
||||
on: [pull_request, push]
|
||||
jobs:
|
||||
tests:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-22.04
|
||||
- ubuntu-20.04
|
||||
- macos-12
|
||||
- macos-11
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
# Normally, we would use the superbly maintained...
|
||||
# - uses: actions/setup-python@v2
|
||||
# with:
|
||||
# python-version: ${{ matrix.python-version }}
|
||||
# ... but in the repo, we want to test pyenv builds on Ubuntu
|
||||
# - run: |
|
||||
# sudo apt-get install -y build-essential libssl-dev zlib1g-dev libbz2-dev \
|
||||
# libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
|
||||
# xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
|
||||
# https://github.com/pyenv/pyenv#installation
|
||||
#- env:
|
||||
# PYENV_ROOT: /home/runner/work/pyenv/pyenv
|
||||
# run: |
|
||||
# echo $PYENV_ROOT
|
||||
# echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH
|
||||
# macos-11 Github Actions env has an old `readlink` and lacks `greadlink` which causes Bats to break
|
||||
- run: |
|
||||
if [[ $RUNNER_OS == "macOS" ]] && [[ $(sw_vers -productVersion | awk -F. '{print $1}') -lt 12 ]]; then
|
||||
brew install coreutils
|
||||
fi
|
||||
- run: git clone https://github.com/bats-core/bats-core.git --depth=1 -b v1.2.0 bats
|
||||
- run: bats/bin/bats --tap test
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
/bats/
|
||||
/libexec/pyenv-virtualenv/*/*.class
|
||||
/libexec/pyenv-virtualenv/*/*.pyc
|
||||
/libexec/pyenv-virtualenv/*/*.pyo
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
sudo: false
|
||||
install: git clone https://github.com/sstephenson/bats.git
|
||||
install: git clone --depth=1 https://github.com/sstephenson/bats.git
|
||||
script: bats/bin/bats --tap test
|
||||
language: c
|
||||
notifications:
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#### 1.1.4
|
||||
|
||||
* Support newer conda (#290)
|
||||
* Prefer `python3.x` executable if avaialble (#206, #282, #296)
|
||||
* Prefer `python3.x` executable if available (#206, #282, #296)
|
||||
|
||||
#### 1.1.3
|
||||
|
||||
|
||||
17
README.md
17
README.md
@@ -37,19 +37,16 @@ From inside that directory you can:
|
||||
2. (OPTIONAL) **Add `pyenv virtualenv-init` to your shell** to enable auto-activation of virtualenvs. This is entirely optional but pretty useful. See "Activate virtualenv" below.
|
||||
|
||||
```sh
|
||||
$ echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile
|
||||
$ echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
|
||||
```
|
||||
|
||||
**Fish shell note**: Add this to your `~/.config/fish/config.fish`
|
||||
|
||||
```sh
|
||||
status --is-interactive; and pyenv init - | source
|
||||
status --is-interactive; and pyenv virtualenv-init - | source
|
||||
```
|
||||
|
||||
**Zsh note**: Modify your `~/.zshenv` file instead of `~/.bash_profile`.
|
||||
|
||||
**Pyenv note**: You may also need to add `eval "$(pyenv init -)"` to your profile if you haven't done so already.
|
||||
**Zsh note**: Modify your `~/.zshrc` file instead of `~/.bashrc`.
|
||||
|
||||
3. **Restart your shell to enable pyenv-virtualenv**
|
||||
|
||||
@@ -78,12 +75,13 @@ Or, if you would like to install the latest development release:
|
||||
$ brew install --HEAD pyenv-virtualenv
|
||||
```
|
||||
|
||||
After installation, you'll still need to add
|
||||
After installation, you'll still need to do
|
||||
[Pyenv shell setup steps](https://github.com/pyenv/pyenv#basic-github-checkout)
|
||||
then add
|
||||
```sh
|
||||
eval "$(pyenv init -)"
|
||||
eval "$(pyenv virtualenv-init -)"
|
||||
```
|
||||
to your profile (as stated in the caveats). You'll only ever have to do this once.
|
||||
to your shell's `.rc` file (as stated in the caveats). You'll only ever have to do this once.
|
||||
|
||||
|
||||
## Usage
|
||||
@@ -101,6 +99,9 @@ $ pyenv virtualenv 2.7.10 my-virtual-env-2.7.10
|
||||
will create a virtualenv based on Python 2.7.10 under `$(pyenv root)/versions` in a
|
||||
folder called `my-virtual-env-2.7.10`.
|
||||
|
||||
`pyenv virtualenv` forwards any options to the underlying command that actually
|
||||
creates the virtual environment (`conda`, `virtualenv`, or `python -m venv`).
|
||||
See the output of `pyenv virtualenv --help` for details.
|
||||
|
||||
### Create virtualenv from current version
|
||||
|
||||
|
||||
@@ -52,13 +52,18 @@ while [ $# -gt 0 ]; do
|
||||
shift 1
|
||||
done
|
||||
|
||||
get_current_versions() {
|
||||
local IFS=:
|
||||
current_versions=($(pyenv-version-name 2>/dev/null))
|
||||
}
|
||||
|
||||
no_shell=
|
||||
versions=("$@")
|
||||
current_versions=()
|
||||
if [ -z "${versions}" ]; then
|
||||
no_shell=1
|
||||
OLDIFS="$IFS"
|
||||
IFS=: versions=($(pyenv-version-name 2>/dev/null))
|
||||
IFS="$OLDIFS"
|
||||
get_current_versions
|
||||
versions=("${current_versions[@]}")
|
||||
fi
|
||||
|
||||
if [ -z "${PYENV_VIRTUALENV_INIT}" ]; then
|
||||
@@ -84,9 +89,7 @@ fi
|
||||
|
||||
if ! pyenv-virtualenv-prefix "${venv}" 1>/dev/null 2>&1; then
|
||||
# fallback to virtualenv of current version
|
||||
OLDIFS="$IFS"
|
||||
IFS=: current_versions=($(pyenv-version-name))
|
||||
IFS="$OLDIFS"
|
||||
[ -n "${current_versions}" ] || get_current_versions
|
||||
new_venv="${current_versions%/envs/*}/envs/${venv}"
|
||||
if pyenv-virtualenv-prefix "${new_venv}" 1>/dev/null 2>&1; then
|
||||
venv="${new_venv}"
|
||||
@@ -228,8 +231,8 @@ if [ -z "${PYENV_VIRTUALENV_DISABLE_PROMPT}" ]; then
|
||||
echo "pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior." 1>&2
|
||||
fi
|
||||
cat <<EOS
|
||||
export _OLD_VIRTUAL_PS1="\${PS1}";
|
||||
export PS1="(${venv}) \${PS1}";
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(${venv}) \${PS1:-}";
|
||||
EOS
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -134,7 +134,7 @@ EOS
|
||||
;;
|
||||
* )
|
||||
cat <<EOS
|
||||
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PATH:-}" ]; then
|
||||
export PATH="\${_OLD_VIRTUAL_PATH}";
|
||||
unset _OLD_VIRTUAL_PATH;
|
||||
fi;
|
||||
@@ -153,7 +153,7 @@ EOS
|
||||
;;
|
||||
* )
|
||||
cat <<EOS
|
||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME:-}" ]; then
|
||||
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
||||
unset _OLD_VIRTUAL_PYTHONHOME;
|
||||
fi;
|
||||
@@ -167,7 +167,7 @@ fish )
|
||||
;;
|
||||
* )
|
||||
cat <<EOS
|
||||
if [ -n "\${_OLD_VIRTUAL_PS1}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PS1:-}" ]; then
|
||||
export PS1="\${_OLD_VIRTUAL_PS1}";
|
||||
unset _OLD_VIRTUAL_PS1;
|
||||
fi;
|
||||
|
||||
@@ -6,7 +6,11 @@
|
||||
# pyenv virtualenv --version
|
||||
# pyenv virtualenv --help
|
||||
#
|
||||
# -f/--force Install even if the version appears to be installed already
|
||||
# -f/--force Install even if the version appears to be installed already. Skip
|
||||
# prompting for confirmation
|
||||
#
|
||||
# Notable VIRTUALENV_OPTIONS passed to venv-creating executable, if applicable:
|
||||
# -u/--upgrade Imply --force
|
||||
#
|
||||
|
||||
PYENV_VIRTUALENV_VERSION="1.1.5"
|
||||
@@ -145,7 +149,7 @@ detect_venv() {
|
||||
if [ -x "${prefix}/bin/virtualenv" ]; then
|
||||
HAS_VIRTUALENV=1
|
||||
fi
|
||||
# Prefer `python3.x` executable if avaialble (#206, #282)
|
||||
# Prefer `python3.x` executable if available (#206, #282)
|
||||
local python
|
||||
for python in "python${PYENV_VERSION%.*}" "python${PYENV_VERSION%%.*}" "python"; do
|
||||
if pyenv-exec "${python}" -m venv --help 1>/dev/null 2>&1; then
|
||||
@@ -479,16 +483,28 @@ if [ -z "${GET_PIP_URL}" ]; then
|
||||
# Use custom get-pip URL based on the target version (#1127)
|
||||
case "${PYENV_VERSION}" in
|
||||
2.6 | 2.6.* )
|
||||
GET_PIP_URL="https://bootstrap.pypa.io/2.6/get-pip.py"
|
||||
GET_PIP_URL="https://bootstrap.pypa.io/pip/2.6/get-pip.py"
|
||||
;;
|
||||
2.7 | 2.7.* )
|
||||
GET_PIP_URL="https://bootstrap.pypa.io/pip/2.7/get-pip.py"
|
||||
;;
|
||||
3.2 | 3.2.* )
|
||||
GET_PIP_URL="https://bootstrap.pypa.io/3.2/get-pip.py"
|
||||
GET_PIP_URL="https://bootstrap.pypa.io/pip/3.2/get-pip.py"
|
||||
;;
|
||||
3.3 | 3.3.* )
|
||||
GET_PIP_URL="https://bootstrap.pypa.io/3.3/get-pip.py"
|
||||
GET_PIP_URL="https://bootstrap.pypa.io/pip/3.3/get-pip.py"
|
||||
;;
|
||||
3.4 | 3.4.* )
|
||||
GET_PIP_URL="https://bootstrap.pypa.io/pip/3.4/get-pip.py"
|
||||
;;
|
||||
3.5 | 3.5.* )
|
||||
GET_PIP_URL="https://bootstrap.pypa.io/pip/3.5/get-pip.py"
|
||||
;;
|
||||
3.6 | 3.6.* )
|
||||
GET_PIP_URL="https://bootstrap.pypa.io/pip/3.6/get-pip.py"
|
||||
;;
|
||||
* )
|
||||
GET_PIP_URL="https://bootstrap.pypa.io/get-pip.py"
|
||||
GET_PIP_URL="https://bootstrap.pypa.io/pip/get-pip.py"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
@@ -75,7 +75,7 @@ else
|
||||
if pyenv-virtualenv-prefix "${VERSION_NAME}" 1>/dev/null 2>&1; then
|
||||
PREFIX="${PYENV_ROOT}/versions/${VERSION_NAME}"
|
||||
unset COMPAT_PREFIX
|
||||
else
|
||||
elif [ -z "$FORCE" ]; then
|
||||
echo "pyenv-virtualenv: \`${DEFINITION}' is not a virtualenv." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
@@ -88,7 +88,7 @@ if [ -z "$FORCE" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
read -p "pyenv-virtualenv: remove $PREFIX? "
|
||||
read -p "pyenv-virtualenv: remove $PREFIX? (y/N) "
|
||||
case "$REPLY" in
|
||||
y* | Y* ) ;;
|
||||
* ) exit 1 ;;
|
||||
|
||||
@@ -50,7 +50,7 @@ fi
|
||||
if [ -z "$print" ]; then
|
||||
case "$shell" in
|
||||
bash )
|
||||
profile='~/.bash_profile'
|
||||
profile='~/.bashrc'
|
||||
;;
|
||||
zsh )
|
||||
profile='~/.zshrc'
|
||||
@@ -86,6 +86,8 @@ fi
|
||||
case "$shell" in
|
||||
fish )
|
||||
cat <<EOS
|
||||
while set index (contains -i -- "${PYENV_VIRTUALENV_ROOT:-${PYENV_VIRTUALENV_INSTALL_PREFIX}}/shims" \$PATH)
|
||||
set -eg PATH[\$index]; end; set -e index
|
||||
set -gx PATH '${PYENV_VIRTUALENV_ROOT:-${PYENV_VIRTUALENV_INSTALL_PREFIX}}/shims' \$PATH;
|
||||
set -gx PYENV_VIRTUALENV_INIT 1;
|
||||
EOS
|
||||
@@ -127,7 +129,7 @@ esac
|
||||
if [[ "$shell" != "fish" ]]; then
|
||||
cat <<EOS
|
||||
local ret=\$?
|
||||
if [ -n "\$VIRTUAL_ENV" ]; then
|
||||
if [ -n "\${VIRTUAL_ENV-}" ]; then
|
||||
eval "\$(pyenv sh-activate --quiet || pyenv sh-deactivate --quiet || true)" || true
|
||||
else
|
||||
eval "\$(pyenv sh-activate --quiet || true)" || true
|
||||
@@ -139,8 +141,8 @@ EOS
|
||||
case "$shell" in
|
||||
bash )
|
||||
cat <<EOS
|
||||
if ! [[ "\$PROMPT_COMMAND" =~ _pyenv_virtualenv_hook ]]; then
|
||||
PROMPT_COMMAND="_pyenv_virtualenv_hook;\$PROMPT_COMMAND";
|
||||
if ! [[ "\${PROMPT_COMMAND-}" =~ _pyenv_virtualenv_hook ]]; then
|
||||
PROMPT_COMMAND="_pyenv_virtualenv_hook;\${PROMPT_COMMAND-}"
|
||||
fi
|
||||
EOS
|
||||
;;
|
||||
|
||||
@@ -6,7 +6,21 @@
|
||||
|
||||
set -e
|
||||
[ -n "$PYENV_DEBUG" ] && set -x
|
||||
. "${BASH_SOURCE%/*}"/../libexec/pyenv-virtualenv-realpath
|
||||
if [ -L "${BASH_SOURCE}" ]; then
|
||||
READLINK=$(type -p greadlink readlink | head -1)
|
||||
if [ -z "$READLINK" ]; then
|
||||
echo "pyenv: cannot find readlink - are you missing GNU coreutils?" >&2
|
||||
exit 1
|
||||
fi
|
||||
resolve_link() {
|
||||
$READLINK -f "$1"
|
||||
}
|
||||
script_path=$(resolve_link ${BASH_SOURCE})
|
||||
else
|
||||
script_path=${BASH_SOURCE}
|
||||
fi
|
||||
|
||||
. ${script_path%/*}/../libexec/pyenv-virtualenv-realpath
|
||||
|
||||
if [ -z "$PYENV_ROOT" ]; then
|
||||
PYENV_ROOT="${HOME}/.pyenv"
|
||||
|
||||
@@ -7,7 +7,21 @@
|
||||
|
||||
set -e
|
||||
[ -n "$PYENV_DEBUG" ] && set -x
|
||||
. "${BASH_SOURCE%/*}"/../libexec/pyenv-virtualenv-realpath
|
||||
if [ -L "${BASH_SOURCE}" ]; then
|
||||
READLINK=$(type -p greadlink readlink | head -1)
|
||||
if [ -z "$READLINK" ]; then
|
||||
echo "pyenv: cannot find readlink - are you missing GNU coreutils?" >&2
|
||||
exit 1
|
||||
fi
|
||||
resolve_link() {
|
||||
$READLINK -f "$1"
|
||||
}
|
||||
script_path=$(resolve_link ${BASH_SOURCE})
|
||||
else
|
||||
script_path=${BASH_SOURCE}
|
||||
fi
|
||||
|
||||
. ${script_path%/*}/../libexec/pyenv-virtualenv-realpath
|
||||
|
||||
if [ -z "$PYENV_ROOT" ]; then
|
||||
PYENV_ROOT="${HOME}/.pyenv"
|
||||
@@ -76,6 +90,7 @@ print_version() {
|
||||
num_versions=$((num_versions + 1))
|
||||
}
|
||||
|
||||
shopt -s dotglob
|
||||
shopt -s nullglob
|
||||
for path in "$versions_dir"/*; do
|
||||
if [ -d "$path" ]; then
|
||||
@@ -96,6 +111,7 @@ for path in "$versions_dir"/*; do
|
||||
done
|
||||
fi
|
||||
done
|
||||
shopt -u dotglob
|
||||
shopt -u nullglob
|
||||
|
||||
if [ "$num_versions" -eq 0 ] && [ -n "$include_system" ]; then
|
||||
|
||||
@@ -2,11 +2,11 @@ resolve_link() {
|
||||
$(type -p greadlink readlink | head -1) "$1"
|
||||
}
|
||||
|
||||
if [ -n "${DEFINITION}" ]; then
|
||||
uninstall_related_virtual_env() {
|
||||
if [ -n "${DEFINITION}" ]; then
|
||||
if [[ "${DEFINITION}" != "${DEFINITION%/envs/*}" ]]; then
|
||||
# Uninstall virtualenv by long name
|
||||
exec pyenv-virtualenv-delete ${FORCE+-f} "${DEFINITION}"
|
||||
exit 128
|
||||
pyenv-virtualenv-delete ${FORCE+-f} "${DEFINITION}"
|
||||
else
|
||||
VERSION_NAME="${VERSION_NAME:-${DEFINITION##*/}}"
|
||||
PREFIX="${PREFIX:-${PYENV_ROOT}/versions/${VERSION_NAME}}"
|
||||
@@ -15,8 +15,7 @@ if [ -n "${DEFINITION}" ]; then
|
||||
REAL_DEFINITION="${REAL_PREFIX#${PYENV_ROOT}/versions/}"
|
||||
if [[ "${REAL_DEFINITION}" != "${REAL_DEFINITION%/envs/*}" ]]; then
|
||||
# Uninstall virtualenv by short name
|
||||
exec pyenv-virtualenv-delete ${FORCE+-f} "${REAL_DEFINITION}"
|
||||
exit 128
|
||||
pyenv-virtualenv-delete ${FORCE+-f} "${REAL_DEFINITION}"
|
||||
fi
|
||||
else
|
||||
# Uninstall all virtualenvs inside `envs` directory too
|
||||
@@ -27,4 +26,7 @@ if [ -n "${DEFINITION}" ]; then
|
||||
shopt -u nullglob
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
before_uninstall "uninstall_related_virtual_env"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Usage: . pyenv-virtualenv-realpath
|
||||
|
||||
if ! {
|
||||
enable -f "${BASH_SOURCE%/*}"/../libexec/pyenv-realpath.dylib realpath ||
|
||||
enable -f "${BASH_SOURCE%/*}"/../../../libexec/pyenv-realpath.dylib realpath ||
|
||||
type realpath
|
||||
} >/dev/null 2>&1; then
|
||||
if [ -n "$PYENV_NATIVE_EXT" ]; then
|
||||
|
||||
@@ -34,8 +34,8 @@ deactivated
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
|
||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
|
||||
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
|
||||
export _OLD_VIRTUAL_PS1="\${PS1}";
|
||||
export PS1="(venv) \${PS1}";
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(venv) \${PS1:-}";
|
||||
EOS
|
||||
|
||||
unstub pyenv-version-name
|
||||
@@ -59,8 +59,8 @@ 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) \${PS1}";
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(venv) \${PS1:-}";
|
||||
EOS
|
||||
|
||||
unstub pyenv-version-name
|
||||
@@ -87,8 +87,8 @@ pyenv-virtualenv: activate venv
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
|
||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
|
||||
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
|
||||
export _OLD_VIRTUAL_PS1="\${PS1}";
|
||||
export PS1="(venv) \${PS1}";
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(venv) \${PS1:-}";
|
||||
EOS
|
||||
|
||||
unstub pyenv-version-name
|
||||
@@ -115,8 +115,8 @@ export PYENV_ACTIVATE_SHELL=1;
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
|
||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
|
||||
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
|
||||
export _OLD_VIRTUAL_PS1="\${PS1}";
|
||||
export PS1="(venv) \${PS1}";
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(venv) \${PS1:-}";
|
||||
EOS
|
||||
|
||||
unstub pyenv-version-name
|
||||
@@ -192,8 +192,8 @@ export PYENV_ACTIVATE_SHELL=1;
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
|
||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
|
||||
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
|
||||
export _OLD_VIRTUAL_PS1="\${PS1}";
|
||||
export PS1="(venv27) \${PS1}";
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(venv27) \${PS1:-}";
|
||||
EOS
|
||||
|
||||
unstub pyenv-virtualenv-prefix
|
||||
@@ -218,8 +218,8 @@ export PYENV_ACTIVATE_SHELL=1;
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
|
||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
|
||||
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
|
||||
export _OLD_VIRTUAL_PS1="\${PS1}";
|
||||
export PS1="(venv27) \${PS1}";
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(venv27) \${PS1:-}";
|
||||
EOS
|
||||
|
||||
unstub pyenv-virtualenv-prefix
|
||||
@@ -391,8 +391,8 @@ export PYENV_ACTIVATE_SHELL=1;
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
|
||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
|
||||
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
|
||||
export _OLD_VIRTUAL_PS1="\${PS1}";
|
||||
export PS1="(venv27) \${PS1}";
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(venv27) \${PS1:-}";
|
||||
EOS
|
||||
|
||||
unstub pyenv-sh-deactivate
|
||||
|
||||
@@ -37,8 +37,8 @@ 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";
|
||||
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
|
||||
export _OLD_VIRTUAL_PS1="\${PS1}";
|
||||
export PS1="(anaconda-2.3.0) \${PS1}";
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(anaconda-2.3.0) \${PS1:-}";
|
||||
export CONDA_PREFIX="${TMP}/pyenv/versions/anaconda-2.3.0";
|
||||
EOS
|
||||
|
||||
@@ -96,8 +96,8 @@ export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/miniconda-3.9.1";
|
||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/miniconda-3.9.1";
|
||||
export CONDA_DEFAULT_ENV="root";
|
||||
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
|
||||
export _OLD_VIRTUAL_PS1="\${PS1}";
|
||||
export PS1="(miniconda-3.9.1) \${PS1}";
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(miniconda-3.9.1) \${PS1:-}";
|
||||
export CONDA_PREFIX="${TMP}/pyenv/versions/miniconda-3.9.1";
|
||||
EOS
|
||||
|
||||
@@ -126,8 +126,8 @@ export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo";
|
||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo";
|
||||
export CONDA_DEFAULT_ENV="foo";
|
||||
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
|
||||
export _OLD_VIRTUAL_PS1="\${PS1}";
|
||||
export PS1="(anaconda-2.3.0/envs/foo) \${PS1}";
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(anaconda-2.3.0/envs/foo) \${PS1:-}";
|
||||
export CONDA_PREFIX="${TMP}/pyenv/versions/anaconda-2.3.0/envs/foo";
|
||||
. "${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo/etc/conda/activate.d/activate.sh";
|
||||
EOS
|
||||
@@ -159,8 +159,8 @@ export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/miniconda-3.9.1/envs/bar";
|
||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/miniconda-3.9.1/envs/bar";
|
||||
export CONDA_DEFAULT_ENV="bar";
|
||||
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
|
||||
export _OLD_VIRTUAL_PS1="\${PS1}";
|
||||
export PS1="(miniconda-3.9.1/envs/bar) \${PS1}";
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(miniconda-3.9.1/envs/bar) \${PS1:-}";
|
||||
export CONDA_PREFIX="${TMP}/pyenv/versions/miniconda-3.9.1/envs/bar";
|
||||
. "${PYENV_ROOT}/versions/miniconda-3.9.1/envs/bar/etc/conda/activate.d/activate.sh";
|
||||
EOS
|
||||
|
||||
@@ -34,15 +34,15 @@ unset CONDA_PREFIX
|
||||
unset PYENV_VIRTUAL_ENV;
|
||||
unset VIRTUAL_ENV;
|
||||
unset CONDA_DEFAULT_ENV;
|
||||
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PATH:-}" ]; then
|
||||
export PATH="\${_OLD_VIRTUAL_PATH}";
|
||||
unset _OLD_VIRTUAL_PATH;
|
||||
fi;
|
||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME:-}" ]; then
|
||||
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
||||
unset _OLD_VIRTUAL_PYTHONHOME;
|
||||
fi;
|
||||
if [ -n "\${_OLD_VIRTUAL_PS1}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PS1:-}" ]; then
|
||||
export PS1="\${_OLD_VIRTUAL_PS1}";
|
||||
unset _OLD_VIRTUAL_PS1;
|
||||
fi;
|
||||
@@ -102,15 +102,15 @@ unset CONDA_PREFIX
|
||||
unset PYENV_VIRTUAL_ENV;
|
||||
unset VIRTUAL_ENV;
|
||||
unset CONDA_DEFAULT_ENV;
|
||||
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PATH:-}" ]; then
|
||||
export PATH="\${_OLD_VIRTUAL_PATH}";
|
||||
unset _OLD_VIRTUAL_PATH;
|
||||
fi;
|
||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME:-}" ]; then
|
||||
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
||||
unset _OLD_VIRTUAL_PYTHONHOME;
|
||||
fi;
|
||||
if [ -n "\${_OLD_VIRTUAL_PS1}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PS1:-}" ]; then
|
||||
export PS1="\${_OLD_VIRTUAL_PS1}";
|
||||
unset _OLD_VIRTUAL_PS1;
|
||||
fi;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bats
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
@@ -30,15 +30,15 @@ setup() {
|
||||
assert_output <<EOS
|
||||
unset PYENV_VIRTUAL_ENV;
|
||||
unset VIRTUAL_ENV;
|
||||
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PATH:-}" ]; then
|
||||
export PATH="\${_OLD_VIRTUAL_PATH}";
|
||||
unset _OLD_VIRTUAL_PATH;
|
||||
fi;
|
||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME:-}" ]; then
|
||||
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
||||
unset _OLD_VIRTUAL_PYTHONHOME;
|
||||
fi;
|
||||
if [ -n "\${_OLD_VIRTUAL_PS1}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PS1:-}" ]; then
|
||||
export PS1="\${_OLD_VIRTUAL_PS1}";
|
||||
unset _OLD_VIRTUAL_PS1;
|
||||
fi;
|
||||
@@ -54,21 +54,21 @@ EOS
|
||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
|
||||
export PYENV_ACTIVATE_SHELL=
|
||||
|
||||
PYENV_SHELL="bash" run pyenv-sh-deactivate --quit
|
||||
PYENV_SHELL="bash" run pyenv-sh-deactivate --quiet
|
||||
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
unset PYENV_VIRTUAL_ENV;
|
||||
unset VIRTUAL_ENV;
|
||||
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PATH:-}" ]; then
|
||||
export PATH="\${_OLD_VIRTUAL_PATH}";
|
||||
unset _OLD_VIRTUAL_PATH;
|
||||
fi;
|
||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME:-}" ]; then
|
||||
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
||||
unset _OLD_VIRTUAL_PYTHONHOME;
|
||||
fi;
|
||||
if [ -n "\${_OLD_VIRTUAL_PS1}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PS1:-}" ]; then
|
||||
export PS1="\${_OLD_VIRTUAL_PS1}";
|
||||
unset _OLD_VIRTUAL_PS1;
|
||||
fi;
|
||||
@@ -92,45 +92,15 @@ EOS
|
||||
pyenv-virtualenv: deactivate venv
|
||||
unset PYENV_VIRTUAL_ENV;
|
||||
unset VIRTUAL_ENV;
|
||||
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PATH:-}" ]; then
|
||||
export PATH="\${_OLD_VIRTUAL_PATH}";
|
||||
unset _OLD_VIRTUAL_PATH;
|
||||
fi;
|
||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME:-}" ]; then
|
||||
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
||||
unset _OLD_VIRTUAL_PYTHONHOME;
|
||||
fi;
|
||||
if [ -n "\${_OLD_VIRTUAL_PS1}" ]; then
|
||||
export PS1="\${_OLD_VIRTUAL_PS1}";
|
||||
unset _OLD_VIRTUAL_PS1;
|
||||
fi;
|
||||
if declare -f deactivate 1>/dev/null 2>&1; then
|
||||
unset -f deactivate;
|
||||
fi;
|
||||
EOS
|
||||
}
|
||||
|
||||
@test "deactivate virtualenv (quiet)" {
|
||||
export PYENV_VIRTUALENV_INIT=1
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
|
||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
|
||||
export PYENV_ACTIVATE_SHELL=
|
||||
|
||||
PYENV_SHELL="bash" run pyenv-sh-deactivate --quiet
|
||||
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
unset PYENV_VIRTUAL_ENV;
|
||||
unset VIRTUAL_ENV;
|
||||
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
|
||||
export PATH="\${_OLD_VIRTUAL_PATH}";
|
||||
unset _OLD_VIRTUAL_PATH;
|
||||
fi;
|
||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME}" ]; then
|
||||
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
||||
unset _OLD_VIRTUAL_PYTHONHOME;
|
||||
fi;
|
||||
if [ -n "\${_OLD_VIRTUAL_PS1}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PS1:-}" ]; then
|
||||
export PS1="\${_OLD_VIRTUAL_PS1}";
|
||||
unset _OLD_VIRTUAL_PS1;
|
||||
fi;
|
||||
@@ -154,15 +124,15 @@ unset PYENV_VERSION;
|
||||
unset PYENV_ACTIVATE_SHELL;
|
||||
unset PYENV_VIRTUAL_ENV;
|
||||
unset VIRTUAL_ENV;
|
||||
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PATH:-}" ]; then
|
||||
export PATH="\${_OLD_VIRTUAL_PATH}";
|
||||
unset _OLD_VIRTUAL_PATH;
|
||||
fi;
|
||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME:-}" ]; then
|
||||
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
||||
unset _OLD_VIRTUAL_PYTHONHOME;
|
||||
fi;
|
||||
if [ -n "\${_OLD_VIRTUAL_PS1}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PS1:-}" ]; then
|
||||
export PS1="\${_OLD_VIRTUAL_PS1}";
|
||||
unset _OLD_VIRTUAL_PS1;
|
||||
fi;
|
||||
@@ -186,15 +156,15 @@ unset PYENV_VERSION;
|
||||
unset PYENV_ACTIVATE_SHELL;
|
||||
unset PYENV_VIRTUAL_ENV;
|
||||
unset VIRTUAL_ENV;
|
||||
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PATH:-}" ]; then
|
||||
export PATH="\${_OLD_VIRTUAL_PATH}";
|
||||
unset _OLD_VIRTUAL_PATH;
|
||||
fi;
|
||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME:-}" ]; then
|
||||
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
||||
unset _OLD_VIRTUAL_PYTHONHOME;
|
||||
fi;
|
||||
if [ -n "\${_OLD_VIRTUAL_PS1}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PS1:-}" ]; then
|
||||
export PS1="\${_OLD_VIRTUAL_PS1}";
|
||||
unset _OLD_VIRTUAL_PS1;
|
||||
fi;
|
||||
@@ -216,15 +186,15 @@ EOS
|
||||
assert_output <<EOS
|
||||
unset PYENV_VIRTUAL_ENV;
|
||||
unset VIRTUAL_ENV;
|
||||
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PATH:-}" ]; then
|
||||
export PATH="\${_OLD_VIRTUAL_PATH}";
|
||||
unset _OLD_VIRTUAL_PATH;
|
||||
fi;
|
||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME:-}" ]; then
|
||||
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
||||
unset _OLD_VIRTUAL_PYTHONHOME;
|
||||
fi;
|
||||
if [ -n "\${_OLD_VIRTUAL_PS1}" ]; then
|
||||
if [ -n "\${_OLD_VIRTUAL_PS1:-}" ]; then
|
||||
export PS1="\${_OLD_VIRTUAL_PS1}";
|
||||
unset _OLD_VIRTUAL_PS1;
|
||||
fi;
|
||||
|
||||
@@ -6,7 +6,7 @@ load test_helper
|
||||
unset PYENV_SHELL
|
||||
SHELL=/bin/false run pyenv-virtualenv-init -
|
||||
assert_success
|
||||
assert_output_contains ' PROMPT_COMMAND="_pyenv_virtualenv_hook;$PROMPT_COMMAND";'
|
||||
assert_output_contains ' PROMPT_COMMAND="_pyenv_virtualenv_hook;${PROMPT_COMMAND-}"'
|
||||
}
|
||||
|
||||
@test "detect parent shell from script (sh)" {
|
||||
@@ -15,7 +15,7 @@ load test_helper
|
||||
chmod +x ${TMP}/script.sh
|
||||
run ${TMP}/script.sh
|
||||
assert_success
|
||||
assert_output_contains_not ' PROMPT_COMMAND="_pyenv_virtualenv_hook;$PROMPT_COMMAND";'
|
||||
assert_output_contains_not ' PROMPT_COMMAND="_pyenv_virtualenv_hook;${PROMPT_COMMAND-}"'
|
||||
rm -f "${TMP}/script.sh"
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ load test_helper
|
||||
chmod +x ${TMP}/script.sh
|
||||
run ${TMP}/script.sh
|
||||
assert_success
|
||||
assert_output_contains ' PROMPT_COMMAND="_pyenv_virtualenv_hook;$PROMPT_COMMAND";'
|
||||
assert_output_contains ' PROMPT_COMMAND="_pyenv_virtualenv_hook;${PROMPT_COMMAND-}"'
|
||||
rm -f "${TMP}/script.sh"
|
||||
}
|
||||
|
||||
@@ -54,15 +54,15 @@ export PATH="${TMP}/pyenv/plugins/pyenv-virtualenv/shims:\${PATH}";
|
||||
export PYENV_VIRTUALENV_INIT=1;
|
||||
_pyenv_virtualenv_hook() {
|
||||
local ret=\$?
|
||||
if [ -n "\$VIRTUAL_ENV" ]; then
|
||||
if [ -n "\${VIRTUAL_ENV-}" ]; then
|
||||
eval "\$(pyenv sh-activate --quiet || pyenv sh-deactivate --quiet || true)" || true
|
||||
else
|
||||
eval "\$(pyenv sh-activate --quiet || true)" || true
|
||||
fi
|
||||
return \$ret
|
||||
};
|
||||
if ! [[ "\$PROMPT_COMMAND" =~ _pyenv_virtualenv_hook ]]; then
|
||||
PROMPT_COMMAND="_pyenv_virtualenv_hook;\$PROMPT_COMMAND";
|
||||
if ! [[ "\${PROMPT_COMMAND-}" =~ _pyenv_virtualenv_hook ]]; then
|
||||
PROMPT_COMMAND="_pyenv_virtualenv_hook;\${PROMPT_COMMAND-}"
|
||||
fi
|
||||
EOS
|
||||
}
|
||||
@@ -72,6 +72,8 @@ EOS
|
||||
run pyenv-virtualenv-init - fish
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
while set index (contains -i -- "${TMP}/pyenv/plugins/pyenv-virtualenv/shims" \$PATH)
|
||||
set -eg PATH[\$index]; end; set -e index
|
||||
set -gx PATH '${TMP}/pyenv/plugins/pyenv-virtualenv/shims' \$PATH;
|
||||
set -gx PYENV_VIRTUALENV_INIT 1;
|
||||
function _pyenv_virtualenv_hook --on-event fish_prompt;
|
||||
@@ -95,7 +97,7 @@ export PATH="${TMP}/pyenv/plugins/pyenv-virtualenv/shims:\${PATH}";
|
||||
export PYENV_VIRTUALENV_INIT=1;
|
||||
_pyenv_virtualenv_hook() {
|
||||
local ret=\$?
|
||||
if [ -n "\$VIRTUAL_ENV" ]; then
|
||||
if [ -n "\${VIRTUAL_ENV-}" ]; then
|
||||
eval "\$(pyenv sh-activate --quiet || pyenv sh-deactivate --quiet || true)" || true
|
||||
else
|
||||
eval "\$(pyenv sh-activate --quiet || true)" || true
|
||||
|
||||
@@ -63,7 +63,7 @@ OUT
|
||||
assert_success
|
||||
assert_output <<OUT
|
||||
PYENV_VERSION=3.3.6 python3.3 -m venv ${PYENV_ROOT}/versions/3.3.6/envs/venv
|
||||
Installing pip from https://bootstrap.pypa.io/3.3/get-pip.py...
|
||||
Installing pip from https://bootstrap.pypa.io/pip/3.3/get-pip.py...
|
||||
PYENV_VERSION=3.3.6/envs/venv python -s ${TMP}/pyenv/cache/get-pip.py
|
||||
rehashed
|
||||
OUT
|
||||
|
||||
@@ -74,8 +74,10 @@ assert_failure() {
|
||||
|
||||
assert_equal() {
|
||||
if [ "$1" != "$2" ]; then
|
||||
{ echo "expected: $1"
|
||||
echo "actual: $2"
|
||||
{ echo "expected:"
|
||||
echo "$1"
|
||||
echo "actual:"
|
||||
echo "$2"
|
||||
} | flunk
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ unstub_pyenv() {
|
||||
|
||||
assert_output <<OUT
|
||||
PYENV_VERSION=2.7.11 virtualenv ${PYENV_ROOT}/versions/2.7.11/envs/venv
|
||||
Installing pip from https://bootstrap.pypa.io/get-pip.py...
|
||||
Installing pip from https://bootstrap.pypa.io/pip/2.7/get-pip.py...
|
||||
rehashed
|
||||
OUT
|
||||
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc" ]
|
||||
@@ -67,7 +67,7 @@ OUT
|
||||
|
||||
assert_output <<OUT
|
||||
PYENV_VERSION=2.7.11 virtualenv ${PYENV_ROOT}/versions/2.7.11/envs/venv
|
||||
Installing pip from https://bootstrap.pypa.io/get-pip.py...
|
||||
Installing pip from https://bootstrap.pypa.io/pip/2.7/get-pip.py...
|
||||
rehashed
|
||||
OUT
|
||||
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc" ]
|
||||
@@ -97,7 +97,7 @@ OUT
|
||||
|
||||
assert_output <<OUT
|
||||
PYENV_VERSION=2.7.11 virtualenv --verbose --python=${TMP}/python ${PYENV_ROOT}/versions/2.7.11/envs/venv
|
||||
Installing pip from https://bootstrap.pypa.io/get-pip.py...
|
||||
Installing pip from https://bootstrap.pypa.io/pip/2.7/get-pip.py...
|
||||
rehashed
|
||||
OUT
|
||||
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc" ]
|
||||
@@ -127,7 +127,7 @@ OUT
|
||||
|
||||
assert_output <<OUT
|
||||
PYENV_VERSION=2.7.11 virtualenv --verbose --python=${TMP}/python ${PYENV_ROOT}/versions/2.7.11/envs/venv
|
||||
Installing pip from https://bootstrap.pypa.io/get-pip.py...
|
||||
Installing pip from https://bootstrap.pypa.io/pip/2.7/get-pip.py...
|
||||
rehashed
|
||||
OUT
|
||||
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc" ]
|
||||
@@ -192,7 +192,7 @@ OUT
|
||||
|
||||
assert_output <<OUT
|
||||
PYENV_VERSION=2.7.11 virtualenv ${PYENV_ROOT}/versions/2.7.11/envs/foo
|
||||
Installing pip from https://bootstrap.pypa.io/get-pip.py...
|
||||
Installing pip from https://bootstrap.pypa.io/pip/2.7/get-pip.py...
|
||||
rehashed
|
||||
OUT
|
||||
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/foo/bin/pydoc" ]
|
||||
|
||||
Reference in New Issue
Block a user