mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-08 19:43:54 -05:00
Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6ab660b72 | ||
|
|
d5f2878a97 | ||
|
|
c4de2555b7 | ||
|
|
633711a0bc | ||
|
|
177eb67af3 | ||
|
|
0a1839d22a | ||
|
|
4054162a1c | ||
|
|
9a57cd7711 | ||
|
|
3c0edf888e | ||
|
|
057b9be9d8 | ||
|
|
7932bb4cc0 | ||
|
|
a911a2223f | ||
|
|
c6ff093344 | ||
|
|
cc9d5f168e | ||
|
|
017ea60cd3 | ||
|
|
1ee7ca6346 | ||
|
|
91609e25f3 | ||
|
|
5509c25ac1 | ||
|
|
c3110d874e | ||
|
|
f95d6a9bee | ||
|
|
afa008ec95 | ||
|
|
6fa056912b | ||
|
|
2648a4af29 | ||
|
|
ce08a8ee72 | ||
|
|
29fb3c7cd1 | ||
|
|
c537bfff26 | ||
|
|
b334dde5ef | ||
|
|
582b693c11 | ||
|
|
6742d0ef10 | ||
|
|
8c7ef734f9 | ||
|
|
90f7b999ff |
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/*/*.class
|
||||||
/libexec/pyenv-virtualenv/*/*.pyc
|
/libexec/pyenv-virtualenv/*/*.pyc
|
||||||
/libexec/pyenv-virtualenv/*/*.pyo
|
/libexec/pyenv-virtualenv/*/*.pyo
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
sudo: false
|
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
|
script: bats/bin/bats --tap test
|
||||||
language: c
|
language: c
|
||||||
notifications:
|
notifications:
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#### 1.1.4
|
#### 1.1.4
|
||||||
|
|
||||||
* Support newer conda (#290)
|
* 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
|
#### 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.
|
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
|
```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`
|
**Fish shell note**: Add this to your `~/.config/fish/config.fish`
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
status --is-interactive; and pyenv init - | source
|
|
||||||
status --is-interactive; and pyenv virtualenv-init - | source
|
status --is-interactive; and pyenv virtualenv-init - | source
|
||||||
```
|
```
|
||||||
|
|
||||||
**Zsh note**: Modify your `~/.zshenv` file instead of `~/.bash_profile`.
|
**Zsh note**: Modify your `~/.zshrc` file instead of `~/.bashrc`.
|
||||||
|
|
||||||
**Pyenv note**: You may also need to add `eval "$(pyenv init -)"` to your profile if you haven't done so already.
|
|
||||||
|
|
||||||
3. **Restart your shell to enable pyenv-virtualenv**
|
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
|
$ 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
|
```sh
|
||||||
eval "$(pyenv init -)"
|
|
||||||
eval "$(pyenv virtualenv-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
|
## 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
|
will create a virtualenv based on Python 2.7.10 under `$(pyenv root)/versions` in a
|
||||||
folder called `my-virtual-env-2.7.10`.
|
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
|
### Create virtualenv from current version
|
||||||
|
|
||||||
|
|||||||
@@ -52,13 +52,18 @@ while [ $# -gt 0 ]; do
|
|||||||
shift 1
|
shift 1
|
||||||
done
|
done
|
||||||
|
|
||||||
|
get_current_versions() {
|
||||||
|
local IFS=:
|
||||||
|
current_versions=($(pyenv-version-name 2>/dev/null))
|
||||||
|
}
|
||||||
|
|
||||||
no_shell=
|
no_shell=
|
||||||
versions=("$@")
|
versions=("$@")
|
||||||
|
current_versions=()
|
||||||
if [ -z "${versions}" ]; then
|
if [ -z "${versions}" ]; then
|
||||||
no_shell=1
|
no_shell=1
|
||||||
OLDIFS="$IFS"
|
get_current_versions
|
||||||
IFS=: versions=($(pyenv-version-name 2>/dev/null))
|
versions=("${current_versions[@]}")
|
||||||
IFS="$OLDIFS"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${PYENV_VIRTUALENV_INIT}" ]; then
|
if [ -z "${PYENV_VIRTUALENV_INIT}" ]; then
|
||||||
@@ -84,9 +89,7 @@ fi
|
|||||||
|
|
||||||
if ! pyenv-virtualenv-prefix "${venv}" 1>/dev/null 2>&1; then
|
if ! pyenv-virtualenv-prefix "${venv}" 1>/dev/null 2>&1; then
|
||||||
# fallback to virtualenv of current version
|
# fallback to virtualenv of current version
|
||||||
OLDIFS="$IFS"
|
[ -n "${current_versions}" ] || get_current_versions
|
||||||
IFS=: current_versions=($(pyenv-version-name))
|
|
||||||
IFS="$OLDIFS"
|
|
||||||
new_venv="${current_versions%/envs/*}/envs/${venv}"
|
new_venv="${current_versions%/envs/*}/envs/${venv}"
|
||||||
if pyenv-virtualenv-prefix "${new_venv}" 1>/dev/null 2>&1; then
|
if pyenv-virtualenv-prefix "${new_venv}" 1>/dev/null 2>&1; then
|
||||||
venv="${new_venv}"
|
venv="${new_venv}"
|
||||||
@@ -226,8 +229,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
|
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
|
fi
|
||||||
cat <<EOS
|
cat <<EOS
|
||||||
export _OLD_VIRTUAL_PS1="\${PS1}";
|
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||||
export PS1="(${venv}) \${PS1}";
|
export PS1="(${venv}) \${PS1:-}";
|
||||||
EOS
|
EOS
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ EOS
|
|||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
cat <<EOS
|
cat <<EOS
|
||||||
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PATH:-}" ]; then
|
||||||
export PATH="\${_OLD_VIRTUAL_PATH}";
|
export PATH="\${_OLD_VIRTUAL_PATH}";
|
||||||
unset _OLD_VIRTUAL_PATH;
|
unset _OLD_VIRTUAL_PATH;
|
||||||
fi;
|
fi;
|
||||||
@@ -153,7 +153,7 @@ EOS
|
|||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
cat <<EOS
|
cat <<EOS
|
||||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME:-}" ]; then
|
||||||
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
||||||
unset _OLD_VIRTUAL_PYTHONHOME;
|
unset _OLD_VIRTUAL_PYTHONHOME;
|
||||||
fi;
|
fi;
|
||||||
@@ -167,7 +167,7 @@ fish )
|
|||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
cat <<EOS
|
cat <<EOS
|
||||||
if [ -n "\${_OLD_VIRTUAL_PS1}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PS1:-}" ]; then
|
||||||
export PS1="\${_OLD_VIRTUAL_PS1}";
|
export PS1="\${_OLD_VIRTUAL_PS1}";
|
||||||
unset _OLD_VIRTUAL_PS1;
|
unset _OLD_VIRTUAL_PS1;
|
||||||
fi;
|
fi;
|
||||||
|
|||||||
@@ -6,7 +6,11 @@
|
|||||||
# pyenv virtualenv --version
|
# pyenv virtualenv --version
|
||||||
# pyenv virtualenv --help
|
# 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"
|
PYENV_VIRTUALENV_VERSION="1.1.5"
|
||||||
@@ -145,7 +149,7 @@ detect_venv() {
|
|||||||
if [ -x "${prefix}/bin/virtualenv" ]; then
|
if [ -x "${prefix}/bin/virtualenv" ]; then
|
||||||
HAS_VIRTUALENV=1
|
HAS_VIRTUALENV=1
|
||||||
fi
|
fi
|
||||||
# Prefer `python3.x` executable if avaialble (#206, #282)
|
# Prefer `python3.x` executable if available (#206, #282)
|
||||||
local python
|
local python
|
||||||
for python in "python${PYENV_VERSION%.*}" "python${PYENV_VERSION%%.*}" "python"; do
|
for python in "python${PYENV_VERSION%.*}" "python${PYENV_VERSION%%.*}" "python"; do
|
||||||
if pyenv-exec "${python}" -m venv --help 1>/dev/null 2>&1; then
|
if pyenv-exec "${python}" -m venv --help 1>/dev/null 2>&1; then
|
||||||
@@ -306,6 +310,10 @@ else
|
|||||||
VIRTUALENV_NAME="${ARGUMENTS[1]}"
|
VIRTUALENV_NAME="${ARGUMENTS[1]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${VERSION_NAME}" ]] && command -v pyenv-latest >/dev/null; then
|
||||||
|
VERSION_NAME="$(pyenv-latest -q "${VERSION_NAME}" || echo "${VERSION_NAME}")"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "${VERSION_NAME}" ] || [ -z "${VIRTUALENV_NAME}" ]; then
|
if [ -z "${VERSION_NAME}" ] || [ -z "${VIRTUALENV_NAME}" ]; then
|
||||||
usage 1
|
usage 1
|
||||||
fi
|
fi
|
||||||
@@ -479,16 +487,28 @@ if [ -z "${GET_PIP_URL}" ]; then
|
|||||||
# Use custom get-pip URL based on the target version (#1127)
|
# Use custom get-pip URL based on the target version (#1127)
|
||||||
case "${PYENV_VERSION}" in
|
case "${PYENV_VERSION}" in
|
||||||
2.6 | 2.6.* )
|
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.* )
|
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.* )
|
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
|
esac
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ else
|
|||||||
if pyenv-virtualenv-prefix "${VERSION_NAME}" 1>/dev/null 2>&1; then
|
if pyenv-virtualenv-prefix "${VERSION_NAME}" 1>/dev/null 2>&1; then
|
||||||
PREFIX="${PYENV_ROOT}/versions/${VERSION_NAME}"
|
PREFIX="${PYENV_ROOT}/versions/${VERSION_NAME}"
|
||||||
unset COMPAT_PREFIX
|
unset COMPAT_PREFIX
|
||||||
else
|
elif [ -z "$FORCE" ]; then
|
||||||
echo "pyenv-virtualenv: \`${DEFINITION}' is not a virtualenv." 1>&2
|
echo "pyenv-virtualenv: \`${DEFINITION}' is not a virtualenv." 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -88,7 +88,7 @@ if [ -z "$FORCE" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -p "pyenv-virtualenv: remove $PREFIX? "
|
read -p "pyenv-virtualenv: remove $PREFIX? (y/N) "
|
||||||
case "$REPLY" in
|
case "$REPLY" in
|
||||||
y* | Y* ) ;;
|
y* | Y* ) ;;
|
||||||
* ) exit 1 ;;
|
* ) exit 1 ;;
|
||||||
|
|||||||
@@ -45,12 +45,13 @@ if [ -z "$shell" ]; then
|
|||||||
shell="${shell%% *}"
|
shell="${shell%% *}"
|
||||||
shell="${shell:-$SHELL}"
|
shell="${shell:-$SHELL}"
|
||||||
shell="${shell##*/}"
|
shell="${shell##*/}"
|
||||||
|
shell="${shell%%-*}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$print" ]; then
|
if [ -z "$print" ]; then
|
||||||
case "$shell" in
|
case "$shell" in
|
||||||
bash )
|
bash )
|
||||||
profile='~/.bash_profile'
|
profile='~/.bashrc'
|
||||||
;;
|
;;
|
||||||
zsh )
|
zsh )
|
||||||
profile='~/.zshrc'
|
profile='~/.zshrc'
|
||||||
@@ -86,6 +87,8 @@ fi
|
|||||||
case "$shell" in
|
case "$shell" in
|
||||||
fish )
|
fish )
|
||||||
cat <<EOS
|
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 PATH '${PYENV_VIRTUALENV_ROOT:-${PYENV_VIRTUALENV_INSTALL_PREFIX}}/shims' \$PATH;
|
||||||
set -gx PYENV_VIRTUALENV_INIT 1;
|
set -gx PYENV_VIRTUALENV_INIT 1;
|
||||||
EOS
|
EOS
|
||||||
@@ -127,7 +130,7 @@ esac
|
|||||||
if [[ "$shell" != "fish" ]]; then
|
if [[ "$shell" != "fish" ]]; then
|
||||||
cat <<EOS
|
cat <<EOS
|
||||||
local ret=\$?
|
local ret=\$?
|
||||||
if [ -n "\$VIRTUAL_ENV" ]; then
|
if [ -n "\${VIRTUAL_ENV-}" ]; then
|
||||||
eval "\$(pyenv sh-activate --quiet || pyenv sh-deactivate --quiet || true)" || true
|
eval "\$(pyenv sh-activate --quiet || pyenv sh-deactivate --quiet || true)" || true
|
||||||
else
|
else
|
||||||
eval "\$(pyenv sh-activate --quiet || true)" || true
|
eval "\$(pyenv sh-activate --quiet || true)" || true
|
||||||
@@ -139,8 +142,8 @@ EOS
|
|||||||
case "$shell" in
|
case "$shell" in
|
||||||
bash )
|
bash )
|
||||||
cat <<EOS
|
cat <<EOS
|
||||||
if ! [[ "\$PROMPT_COMMAND" =~ _pyenv_virtualenv_hook ]]; then
|
if ! [[ "\${PROMPT_COMMAND-}" =~ _pyenv_virtualenv_hook ]]; then
|
||||||
PROMPT_COMMAND="_pyenv_virtualenv_hook;\$PROMPT_COMMAND";
|
PROMPT_COMMAND="_pyenv_virtualenv_hook;\${PROMPT_COMMAND-}"
|
||||||
fi
|
fi
|
||||||
EOS
|
EOS
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -6,7 +6,21 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
[ -n "$PYENV_DEBUG" ] && set -x
|
[ -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
|
if [ -z "$PYENV_ROOT" ]; then
|
||||||
PYENV_ROOT="${HOME}/.pyenv"
|
PYENV_ROOT="${HOME}/.pyenv"
|
||||||
|
|||||||
@@ -7,7 +7,21 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
[ -n "$PYENV_DEBUG" ] && set -x
|
[ -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
|
if [ -z "$PYENV_ROOT" ]; then
|
||||||
PYENV_ROOT="${HOME}/.pyenv"
|
PYENV_ROOT="${HOME}/.pyenv"
|
||||||
@@ -76,6 +90,7 @@ print_version() {
|
|||||||
num_versions=$((num_versions + 1))
|
num_versions=$((num_versions + 1))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shopt -s dotglob
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
for path in "$versions_dir"/*; do
|
for path in "$versions_dir"/*; do
|
||||||
if [ -d "$path" ]; then
|
if [ -d "$path" ]; then
|
||||||
@@ -96,6 +111,7 @@ for path in "$versions_dir"/*; do
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
shopt -u dotglob
|
||||||
shopt -u nullglob
|
shopt -u nullglob
|
||||||
|
|
||||||
if [ "$num_versions" -eq 0 ] && [ -n "$include_system" ]; then
|
if [ "$num_versions" -eq 0 ] && [ -n "$include_system" ]; then
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ resolve_link() {
|
|||||||
$(type -p greadlink readlink | head -1) "$1"
|
$(type -p greadlink readlink | head -1) "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uninstall_related_virtual_env() {
|
||||||
if [ -n "${DEFINITION}" ]; then
|
if [ -n "${DEFINITION}" ]; then
|
||||||
if [[ "${DEFINITION}" != "${DEFINITION%/envs/*}" ]]; then
|
if [[ "${DEFINITION}" != "${DEFINITION%/envs/*}" ]]; then
|
||||||
# Uninstall virtualenv by long name
|
# Uninstall virtualenv by long name
|
||||||
exec pyenv-virtualenv-delete ${FORCE+-f} "${DEFINITION}"
|
pyenv-virtualenv-delete ${FORCE+-f} "${DEFINITION}"
|
||||||
exit 128
|
|
||||||
else
|
else
|
||||||
VERSION_NAME="${VERSION_NAME:-${DEFINITION##*/}}"
|
VERSION_NAME="${VERSION_NAME:-${DEFINITION##*/}}"
|
||||||
PREFIX="${PREFIX:-${PYENV_ROOT}/versions/${VERSION_NAME}}"
|
PREFIX="${PREFIX:-${PYENV_ROOT}/versions/${VERSION_NAME}}"
|
||||||
@@ -15,8 +15,7 @@ if [ -n "${DEFINITION}" ]; then
|
|||||||
REAL_DEFINITION="${REAL_PREFIX#${PYENV_ROOT}/versions/}"
|
REAL_DEFINITION="${REAL_PREFIX#${PYENV_ROOT}/versions/}"
|
||||||
if [[ "${REAL_DEFINITION}" != "${REAL_DEFINITION%/envs/*}" ]]; then
|
if [[ "${REAL_DEFINITION}" != "${REAL_DEFINITION%/envs/*}" ]]; then
|
||||||
# Uninstall virtualenv by short name
|
# Uninstall virtualenv by short name
|
||||||
exec pyenv-virtualenv-delete ${FORCE+-f} "${REAL_DEFINITION}"
|
pyenv-virtualenv-delete ${FORCE+-f} "${REAL_DEFINITION}"
|
||||||
exit 128
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Uninstall all virtualenvs inside `envs` directory too
|
# Uninstall all virtualenvs inside `envs` directory too
|
||||||
@@ -28,3 +27,6 @@ if [ -n "${DEFINITION}" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
before_uninstall "uninstall_related_virtual_env"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# Usage: . pyenv-virtualenv-realpath
|
# Usage: . pyenv-virtualenv-realpath
|
||||||
|
|
||||||
if ! {
|
if ! {
|
||||||
enable -f "${BASH_SOURCE%/*}"/../libexec/pyenv-realpath.dylib realpath ||
|
enable -f "${BASH_SOURCE%/*}"/../../../libexec/pyenv-realpath.dylib realpath ||
|
||||||
type realpath
|
type realpath
|
||||||
} >/dev/null 2>&1; then
|
} >/dev/null 2>&1; then
|
||||||
if [ -n "$PYENV_NATIVE_EXT" ]; then
|
if [ -n "$PYENV_NATIVE_EXT" ]; then
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ deactivated
|
|||||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
|
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
|
||||||
export 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.
|
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 _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||||
export PS1="(venv) \${PS1}";
|
export PS1="(venv) \${PS1:-}";
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
unstub pyenv-version-name
|
unstub pyenv-version-name
|
||||||
@@ -59,8 +59,8 @@ EOS
|
|||||||
deactivated
|
deactivated
|
||||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
|
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
|
||||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
|
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
|
||||||
export _OLD_VIRTUAL_PS1="\${PS1}";
|
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||||
export PS1="(venv) \${PS1}";
|
export PS1="(venv) \${PS1:-}";
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
unstub pyenv-version-name
|
unstub pyenv-version-name
|
||||||
@@ -87,8 +87,8 @@ pyenv-virtualenv: activate venv
|
|||||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
|
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
|
||||||
export 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.
|
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 _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||||
export PS1="(venv) \${PS1}";
|
export PS1="(venv) \${PS1:-}";
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
unstub pyenv-version-name
|
unstub pyenv-version-name
|
||||||
@@ -115,8 +115,8 @@ export PYENV_ACTIVATE_SHELL=1;
|
|||||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
|
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
|
||||||
export 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.
|
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 _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||||
export PS1="(venv) \${PS1}";
|
export PS1="(venv) \${PS1:-}";
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
unstub pyenv-version-name
|
unstub pyenv-version-name
|
||||||
@@ -192,8 +192,8 @@ export PYENV_ACTIVATE_SHELL=1;
|
|||||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
|
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
|
||||||
export 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.
|
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 _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||||
export PS1="(venv27) \${PS1}";
|
export PS1="(venv27) \${PS1:-}";
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
unstub pyenv-virtualenv-prefix
|
unstub pyenv-virtualenv-prefix
|
||||||
@@ -218,8 +218,8 @@ export PYENV_ACTIVATE_SHELL=1;
|
|||||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
|
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
|
||||||
export 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.
|
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 _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||||
export PS1="(venv27) \${PS1}";
|
export PS1="(venv27) \${PS1:-}";
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
unstub pyenv-virtualenv-prefix
|
unstub pyenv-virtualenv-prefix
|
||||||
@@ -391,8 +391,8 @@ export PYENV_ACTIVATE_SHELL=1;
|
|||||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
|
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
|
||||||
export 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.
|
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 _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||||
export PS1="(venv27) \${PS1}";
|
export PS1="(venv27) \${PS1:-}";
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
unstub pyenv-sh-deactivate
|
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 VIRTUAL_ENV="${PYENV_ROOT}/versions/anaconda-2.3.0";
|
||||||
export CONDA_DEFAULT_ENV="root";
|
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.
|
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 _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||||
export PS1="(anaconda-2.3.0) \${PS1}";
|
export PS1="(anaconda-2.3.0) \${PS1:-}";
|
||||||
export CONDA_PREFIX="${TMP}/pyenv/versions/anaconda-2.3.0";
|
export CONDA_PREFIX="${TMP}/pyenv/versions/anaconda-2.3.0";
|
||||||
EOS
|
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 VIRTUAL_ENV="${PYENV_ROOT}/versions/miniconda-3.9.1";
|
||||||
export CONDA_DEFAULT_ENV="root";
|
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.
|
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 _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||||
export PS1="(miniconda-3.9.1) \${PS1}";
|
export PS1="(miniconda-3.9.1) \${PS1:-}";
|
||||||
export CONDA_PREFIX="${TMP}/pyenv/versions/miniconda-3.9.1";
|
export CONDA_PREFIX="${TMP}/pyenv/versions/miniconda-3.9.1";
|
||||||
EOS
|
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 VIRTUAL_ENV="${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo";
|
||||||
export CONDA_DEFAULT_ENV="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.
|
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 _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||||
export PS1="(anaconda-2.3.0/envs/foo) \${PS1}";
|
export PS1="(anaconda-2.3.0/envs/foo) \${PS1:-}";
|
||||||
export CONDA_PREFIX="${TMP}/pyenv/versions/anaconda-2.3.0/envs/foo";
|
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";
|
. "${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo/etc/conda/activate.d/activate.sh";
|
||||||
EOS
|
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 VIRTUAL_ENV="${PYENV_ROOT}/versions/miniconda-3.9.1/envs/bar";
|
||||||
export CONDA_DEFAULT_ENV="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.
|
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 _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||||
export PS1="(miniconda-3.9.1/envs/bar) \${PS1}";
|
export PS1="(miniconda-3.9.1/envs/bar) \${PS1:-}";
|
||||||
export CONDA_PREFIX="${TMP}/pyenv/versions/miniconda-3.9.1/envs/bar";
|
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";
|
. "${PYENV_ROOT}/versions/miniconda-3.9.1/envs/bar/etc/conda/activate.d/activate.sh";
|
||||||
EOS
|
EOS
|
||||||
|
|||||||
@@ -34,15 +34,15 @@ unset CONDA_PREFIX
|
|||||||
unset PYENV_VIRTUAL_ENV;
|
unset PYENV_VIRTUAL_ENV;
|
||||||
unset VIRTUAL_ENV;
|
unset VIRTUAL_ENV;
|
||||||
unset CONDA_DEFAULT_ENV;
|
unset CONDA_DEFAULT_ENV;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PATH:-}" ]; then
|
||||||
export PATH="\${_OLD_VIRTUAL_PATH}";
|
export PATH="\${_OLD_VIRTUAL_PATH}";
|
||||||
unset _OLD_VIRTUAL_PATH;
|
unset _OLD_VIRTUAL_PATH;
|
||||||
fi;
|
fi;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME:-}" ]; then
|
||||||
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
||||||
unset _OLD_VIRTUAL_PYTHONHOME;
|
unset _OLD_VIRTUAL_PYTHONHOME;
|
||||||
fi;
|
fi;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PS1}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PS1:-}" ]; then
|
||||||
export PS1="\${_OLD_VIRTUAL_PS1}";
|
export PS1="\${_OLD_VIRTUAL_PS1}";
|
||||||
unset _OLD_VIRTUAL_PS1;
|
unset _OLD_VIRTUAL_PS1;
|
||||||
fi;
|
fi;
|
||||||
@@ -102,15 +102,15 @@ unset CONDA_PREFIX
|
|||||||
unset PYENV_VIRTUAL_ENV;
|
unset PYENV_VIRTUAL_ENV;
|
||||||
unset VIRTUAL_ENV;
|
unset VIRTUAL_ENV;
|
||||||
unset CONDA_DEFAULT_ENV;
|
unset CONDA_DEFAULT_ENV;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PATH:-}" ]; then
|
||||||
export PATH="\${_OLD_VIRTUAL_PATH}";
|
export PATH="\${_OLD_VIRTUAL_PATH}";
|
||||||
unset _OLD_VIRTUAL_PATH;
|
unset _OLD_VIRTUAL_PATH;
|
||||||
fi;
|
fi;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME:-}" ]; then
|
||||||
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
||||||
unset _OLD_VIRTUAL_PYTHONHOME;
|
unset _OLD_VIRTUAL_PYTHONHOME;
|
||||||
fi;
|
fi;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PS1}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PS1:-}" ]; then
|
||||||
export PS1="\${_OLD_VIRTUAL_PS1}";
|
export PS1="\${_OLD_VIRTUAL_PS1}";
|
||||||
unset _OLD_VIRTUAL_PS1;
|
unset _OLD_VIRTUAL_PS1;
|
||||||
fi;
|
fi;
|
||||||
|
|||||||
@@ -30,15 +30,15 @@ setup() {
|
|||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
unset PYENV_VIRTUAL_ENV;
|
unset PYENV_VIRTUAL_ENV;
|
||||||
unset VIRTUAL_ENV;
|
unset VIRTUAL_ENV;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PATH:-}" ]; then
|
||||||
export PATH="\${_OLD_VIRTUAL_PATH}";
|
export PATH="\${_OLD_VIRTUAL_PATH}";
|
||||||
unset _OLD_VIRTUAL_PATH;
|
unset _OLD_VIRTUAL_PATH;
|
||||||
fi;
|
fi;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME:-}" ]; then
|
||||||
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
||||||
unset _OLD_VIRTUAL_PYTHONHOME;
|
unset _OLD_VIRTUAL_PYTHONHOME;
|
||||||
fi;
|
fi;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PS1}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PS1:-}" ]; then
|
||||||
export PS1="\${_OLD_VIRTUAL_PS1}";
|
export PS1="\${_OLD_VIRTUAL_PS1}";
|
||||||
unset _OLD_VIRTUAL_PS1;
|
unset _OLD_VIRTUAL_PS1;
|
||||||
fi;
|
fi;
|
||||||
@@ -54,21 +54,21 @@ EOS
|
|||||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
|
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
|
||||||
export PYENV_ACTIVATE_SHELL=
|
export PYENV_ACTIVATE_SHELL=
|
||||||
|
|
||||||
PYENV_SHELL="bash" run pyenv-sh-deactivate --quit
|
PYENV_SHELL="bash" run pyenv-sh-deactivate --quiet
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
unset PYENV_VIRTUAL_ENV;
|
unset PYENV_VIRTUAL_ENV;
|
||||||
unset VIRTUAL_ENV;
|
unset VIRTUAL_ENV;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PATH:-}" ]; then
|
||||||
export PATH="\${_OLD_VIRTUAL_PATH}";
|
export PATH="\${_OLD_VIRTUAL_PATH}";
|
||||||
unset _OLD_VIRTUAL_PATH;
|
unset _OLD_VIRTUAL_PATH;
|
||||||
fi;
|
fi;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME:-}" ]; then
|
||||||
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
||||||
unset _OLD_VIRTUAL_PYTHONHOME;
|
unset _OLD_VIRTUAL_PYTHONHOME;
|
||||||
fi;
|
fi;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PS1}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PS1:-}" ]; then
|
||||||
export PS1="\${_OLD_VIRTUAL_PS1}";
|
export PS1="\${_OLD_VIRTUAL_PS1}";
|
||||||
unset _OLD_VIRTUAL_PS1;
|
unset _OLD_VIRTUAL_PS1;
|
||||||
fi;
|
fi;
|
||||||
@@ -92,45 +92,15 @@ EOS
|
|||||||
pyenv-virtualenv: deactivate venv
|
pyenv-virtualenv: deactivate venv
|
||||||
unset PYENV_VIRTUAL_ENV;
|
unset PYENV_VIRTUAL_ENV;
|
||||||
unset VIRTUAL_ENV;
|
unset VIRTUAL_ENV;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PATH:-}" ]; then
|
||||||
export PATH="\${_OLD_VIRTUAL_PATH}";
|
export PATH="\${_OLD_VIRTUAL_PATH}";
|
||||||
unset _OLD_VIRTUAL_PATH;
|
unset _OLD_VIRTUAL_PATH;
|
||||||
fi;
|
fi;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME:-}" ]; then
|
||||||
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
||||||
unset _OLD_VIRTUAL_PYTHONHOME;
|
unset _OLD_VIRTUAL_PYTHONHOME;
|
||||||
fi;
|
fi;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PS1}" ]; then
|
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
|
|
||||||
export PS1="\${_OLD_VIRTUAL_PS1}";
|
export PS1="\${_OLD_VIRTUAL_PS1}";
|
||||||
unset _OLD_VIRTUAL_PS1;
|
unset _OLD_VIRTUAL_PS1;
|
||||||
fi;
|
fi;
|
||||||
@@ -154,15 +124,15 @@ unset PYENV_VERSION;
|
|||||||
unset PYENV_ACTIVATE_SHELL;
|
unset PYENV_ACTIVATE_SHELL;
|
||||||
unset PYENV_VIRTUAL_ENV;
|
unset PYENV_VIRTUAL_ENV;
|
||||||
unset VIRTUAL_ENV;
|
unset VIRTUAL_ENV;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PATH:-}" ]; then
|
||||||
export PATH="\${_OLD_VIRTUAL_PATH}";
|
export PATH="\${_OLD_VIRTUAL_PATH}";
|
||||||
unset _OLD_VIRTUAL_PATH;
|
unset _OLD_VIRTUAL_PATH;
|
||||||
fi;
|
fi;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME:-}" ]; then
|
||||||
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
||||||
unset _OLD_VIRTUAL_PYTHONHOME;
|
unset _OLD_VIRTUAL_PYTHONHOME;
|
||||||
fi;
|
fi;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PS1}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PS1:-}" ]; then
|
||||||
export PS1="\${_OLD_VIRTUAL_PS1}";
|
export PS1="\${_OLD_VIRTUAL_PS1}";
|
||||||
unset _OLD_VIRTUAL_PS1;
|
unset _OLD_VIRTUAL_PS1;
|
||||||
fi;
|
fi;
|
||||||
@@ -186,15 +156,15 @@ unset PYENV_VERSION;
|
|||||||
unset PYENV_ACTIVATE_SHELL;
|
unset PYENV_ACTIVATE_SHELL;
|
||||||
unset PYENV_VIRTUAL_ENV;
|
unset PYENV_VIRTUAL_ENV;
|
||||||
unset VIRTUAL_ENV;
|
unset VIRTUAL_ENV;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PATH:-}" ]; then
|
||||||
export PATH="\${_OLD_VIRTUAL_PATH}";
|
export PATH="\${_OLD_VIRTUAL_PATH}";
|
||||||
unset _OLD_VIRTUAL_PATH;
|
unset _OLD_VIRTUAL_PATH;
|
||||||
fi;
|
fi;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME:-}" ]; then
|
||||||
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
||||||
unset _OLD_VIRTUAL_PYTHONHOME;
|
unset _OLD_VIRTUAL_PYTHONHOME;
|
||||||
fi;
|
fi;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PS1}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PS1:-}" ]; then
|
||||||
export PS1="\${_OLD_VIRTUAL_PS1}";
|
export PS1="\${_OLD_VIRTUAL_PS1}";
|
||||||
unset _OLD_VIRTUAL_PS1;
|
unset _OLD_VIRTUAL_PS1;
|
||||||
fi;
|
fi;
|
||||||
@@ -216,15 +186,15 @@ EOS
|
|||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
unset PYENV_VIRTUAL_ENV;
|
unset PYENV_VIRTUAL_ENV;
|
||||||
unset VIRTUAL_ENV;
|
unset VIRTUAL_ENV;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PATH:-}" ]; then
|
||||||
export PATH="\${_OLD_VIRTUAL_PATH}";
|
export PATH="\${_OLD_VIRTUAL_PATH}";
|
||||||
unset _OLD_VIRTUAL_PATH;
|
unset _OLD_VIRTUAL_PATH;
|
||||||
fi;
|
fi;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME:-}" ]; then
|
||||||
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
||||||
unset _OLD_VIRTUAL_PYTHONHOME;
|
unset _OLD_VIRTUAL_PYTHONHOME;
|
||||||
fi;
|
fi;
|
||||||
if [ -n "\${_OLD_VIRTUAL_PS1}" ]; then
|
if [ -n "\${_OLD_VIRTUAL_PS1:-}" ]; then
|
||||||
export PS1="\${_OLD_VIRTUAL_PS1}";
|
export PS1="\${_OLD_VIRTUAL_PS1}";
|
||||||
unset _OLD_VIRTUAL_PS1;
|
unset _OLD_VIRTUAL_PS1;
|
||||||
fi;
|
fi;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ load test_helper
|
|||||||
unset PYENV_SHELL
|
unset PYENV_SHELL
|
||||||
SHELL=/bin/false run pyenv-virtualenv-init -
|
SHELL=/bin/false run pyenv-virtualenv-init -
|
||||||
assert_success
|
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)" {
|
@test "detect parent shell from script (sh)" {
|
||||||
@@ -15,7 +15,7 @@ load test_helper
|
|||||||
chmod +x ${TMP}/script.sh
|
chmod +x ${TMP}/script.sh
|
||||||
run ${TMP}/script.sh
|
run ${TMP}/script.sh
|
||||||
assert_success
|
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"
|
rm -f "${TMP}/script.sh"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ load test_helper
|
|||||||
chmod +x ${TMP}/script.sh
|
chmod +x ${TMP}/script.sh
|
||||||
run ${TMP}/script.sh
|
run ${TMP}/script.sh
|
||||||
assert_success
|
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"
|
rm -f "${TMP}/script.sh"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,15 +54,15 @@ export PATH="${TMP}/pyenv/plugins/pyenv-virtualenv/shims:\${PATH}";
|
|||||||
export PYENV_VIRTUALENV_INIT=1;
|
export PYENV_VIRTUALENV_INIT=1;
|
||||||
_pyenv_virtualenv_hook() {
|
_pyenv_virtualenv_hook() {
|
||||||
local ret=\$?
|
local ret=\$?
|
||||||
if [ -n "\$VIRTUAL_ENV" ]; then
|
if [ -n "\${VIRTUAL_ENV-}" ]; then
|
||||||
eval "\$(pyenv sh-activate --quiet || pyenv sh-deactivate --quiet || true)" || true
|
eval "\$(pyenv sh-activate --quiet || pyenv sh-deactivate --quiet || true)" || true
|
||||||
else
|
else
|
||||||
eval "\$(pyenv sh-activate --quiet || true)" || true
|
eval "\$(pyenv sh-activate --quiet || true)" || true
|
||||||
fi
|
fi
|
||||||
return \$ret
|
return \$ret
|
||||||
};
|
};
|
||||||
if ! [[ "\$PROMPT_COMMAND" =~ _pyenv_virtualenv_hook ]]; then
|
if ! [[ "\${PROMPT_COMMAND-}" =~ _pyenv_virtualenv_hook ]]; then
|
||||||
PROMPT_COMMAND="_pyenv_virtualenv_hook;\$PROMPT_COMMAND";
|
PROMPT_COMMAND="_pyenv_virtualenv_hook;\${PROMPT_COMMAND-}"
|
||||||
fi
|
fi
|
||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
@@ -72,6 +72,8 @@ EOS
|
|||||||
run pyenv-virtualenv-init - fish
|
run pyenv-virtualenv-init - fish
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<EOS
|
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 PATH '${TMP}/pyenv/plugins/pyenv-virtualenv/shims' \$PATH;
|
||||||
set -gx PYENV_VIRTUALENV_INIT 1;
|
set -gx PYENV_VIRTUALENV_INIT 1;
|
||||||
function _pyenv_virtualenv_hook --on-event fish_prompt;
|
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;
|
export PYENV_VIRTUALENV_INIT=1;
|
||||||
_pyenv_virtualenv_hook() {
|
_pyenv_virtualenv_hook() {
|
||||||
local ret=\$?
|
local ret=\$?
|
||||||
if [ -n "\$VIRTUAL_ENV" ]; then
|
if [ -n "\${VIRTUAL_ENV-}" ]; then
|
||||||
eval "\$(pyenv sh-activate --quiet || pyenv sh-deactivate --quiet || true)" || true
|
eval "\$(pyenv sh-activate --quiet || pyenv sh-deactivate --quiet || true)" || true
|
||||||
else
|
else
|
||||||
eval "\$(pyenv sh-activate --quiet || true)" || true
|
eval "\$(pyenv sh-activate --quiet || true)" || true
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ OUT
|
|||||||
assert_success
|
assert_success
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
PYENV_VERSION=3.3.6 python3.3 -m venv ${PYENV_ROOT}/versions/3.3.6/envs/venv
|
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
|
PYENV_VERSION=3.3.6/envs/venv python -s ${TMP}/pyenv/cache/get-pip.py
|
||||||
rehashed
|
rehashed
|
||||||
OUT
|
OUT
|
||||||
|
|||||||
@@ -74,8 +74,10 @@ assert_failure() {
|
|||||||
|
|
||||||
assert_equal() {
|
assert_equal() {
|
||||||
if [ "$1" != "$2" ]; then
|
if [ "$1" != "$2" ]; then
|
||||||
{ echo "expected: $1"
|
{ echo "expected:"
|
||||||
echo "actual: $2"
|
echo "$1"
|
||||||
|
echo "actual:"
|
||||||
|
echo "$2"
|
||||||
} | flunk
|
} | flunk
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ unstub_pyenv() {
|
|||||||
|
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
PYENV_VERSION=2.7.11 virtualenv ${PYENV_ROOT}/versions/2.7.11/envs/venv
|
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
|
rehashed
|
||||||
OUT
|
OUT
|
||||||
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc" ]
|
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc" ]
|
||||||
@@ -50,6 +50,35 @@ OUT
|
|||||||
unstub curl
|
unstub curl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "create virtualenv from a given prefix" {
|
||||||
|
stub_pyenv "2.7.11"
|
||||||
|
stub pyenv-virtualenv-prefix " : false"
|
||||||
|
stub pyenv-exec "python2.7 -m venv --help : false"
|
||||||
|
stub pyenv-exec "python2 -m venv --help : false"
|
||||||
|
stub pyenv-exec "python -m venv --help : false"
|
||||||
|
stub pyenv-exec "virtualenv * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||||
|
stub pyenv-exec "python -s -m ensurepip : false"
|
||||||
|
stub pyenv-exec "python -s */get-pip.py : true"
|
||||||
|
stub curl true
|
||||||
|
stub pyenv-latest "-q 2.7 : echo 2.7.11"
|
||||||
|
|
||||||
|
run pyenv-virtualenv "2.7" "venv"
|
||||||
|
|
||||||
|
assert_output <<OUT
|
||||||
|
PYENV_VERSION=2.7.11 virtualenv ${PYENV_ROOT}/versions/2.7.11/envs/venv
|
||||||
|
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" ]
|
||||||
|
assert [ ! -e "${PYENV_ROOT}/versions/2.7" ]
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
unstub_pyenv
|
||||||
|
unstub pyenv-virtualenv-prefix
|
||||||
|
unstub pyenv-exec
|
||||||
|
unstub curl
|
||||||
|
}
|
||||||
|
|
||||||
@test "create virtualenv from current version" {
|
@test "create virtualenv from current version" {
|
||||||
export PYENV_VERSION="2.7.11"
|
export PYENV_VERSION="2.7.11"
|
||||||
stub_pyenv "${PYENV_VERSION}"
|
stub_pyenv "${PYENV_VERSION}"
|
||||||
@@ -67,7 +96,7 @@ OUT
|
|||||||
|
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
PYENV_VERSION=2.7.11 virtualenv ${PYENV_ROOT}/versions/2.7.11/envs/venv
|
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
|
rehashed
|
||||||
OUT
|
OUT
|
||||||
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc" ]
|
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc" ]
|
||||||
@@ -97,7 +126,7 @@ OUT
|
|||||||
|
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
PYENV_VERSION=2.7.11 virtualenv --verbose --python=${TMP}/python ${PYENV_ROOT}/versions/2.7.11/envs/venv
|
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
|
rehashed
|
||||||
OUT
|
OUT
|
||||||
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc" ]
|
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc" ]
|
||||||
@@ -127,7 +156,7 @@ OUT
|
|||||||
|
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
PYENV_VERSION=2.7.11 virtualenv --verbose --python=${TMP}/python ${PYENV_ROOT}/versions/2.7.11/envs/venv
|
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
|
rehashed
|
||||||
OUT
|
OUT
|
||||||
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc" ]
|
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc" ]
|
||||||
@@ -192,7 +221,7 @@ OUT
|
|||||||
|
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
PYENV_VERSION=2.7.11 virtualenv ${PYENV_ROOT}/versions/2.7.11/envs/foo
|
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
|
rehashed
|
||||||
OUT
|
OUT
|
||||||
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/foo/bin/pydoc" ]
|
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/foo/bin/pydoc" ]
|
||||||
|
|||||||
Reference in New Issue
Block a user