7 Commits

Author SHA1 Message Date
Yamashita, Yuu
4c8da67f02 v1.1.1 2017-08-24 00:30:36 +00:00
Yamashita, Yuu
c2ba4952ff Merge pull request #230 from pyenv/gen-pydoc-executable
Generate `pydoc` executable after creating new virtualenv
2017-08-23 20:17:57 +09:00
Yamashita, Yuu
927914b25f Make sure pydoc executable exists after creating virtualenv 2017-08-23 11:14:42 +00:00
Yamashita, Yuu
e339fde2f3 Create virtualenv's bin directory explicitly to avoid CI failures 2017-08-22 23:04:39 +00:00
Yamashita, Yuu
e83a1f12c2 Generate pydoc executable after creating new virtualenv (fixes #197, pyenv/pyenv#963) 2017-08-22 23:00:41 +00:00
Yamashita, Yuu
2727087757 Merge pull request #224 from cpaulik/support-conda-prefix
Set CONDA_PREFIX to make is useable in conda activate/deactivate scripts
2017-07-21 10:01:08 +09:00
Christoph Paulik
f64c8ed0dd Set CONDA_PREFIX to make is useable in conda activate/deactivate scripts. 2017-07-20 15:53:55 +02:00
8 changed files with 45 additions and 9 deletions

View File

@@ -1,5 +1,10 @@
## Version History ## Version History
#### 1.1.1
* Set `CONDA_PREFIX` to make is useable in conda activate/deactivate scripts (#224)
* Generate `pydoc` executable after creating new virtualenv (#197, #230)
#### 1.1.0 #### 1.1.0
* fish: use "set -gx" instead of "setenv" (#215, #216, #217, #218) * fish: use "set -gx" instead of "setenv" (#215, #216, #217, #218)

View File

@@ -240,6 +240,8 @@ if [ -x "${prefix}/bin/conda" ]; then
: # conda doesn't support fish : # conda doesn't support fish
;; ;;
* ) * )
CONDA_PREFIX="$prefix"
echo "export CONDA_PREFIX=\"${CONDA_PREFIX}\";"
for script in "${prefix}/etc/conda/activate.d"/*.sh; do for script in "${prefix}/etc/conda/activate.d"/*.sh; do
echo ". \"${script}\";" echo ". \"${script}\";"
done done

View File

@@ -69,6 +69,7 @@ if [ -x "${prefix}/bin/conda" ]; then
for script in "${prefix}/etc/conda/deactivate.d"/*.sh; do for script in "${prefix}/etc/conda/deactivate.d"/*.sh; do
echo ". \"${script}\";" echo ". \"${script}\";"
done done
echo "unset CONDA_PREFIX"
;; ;;
esac esac
shopt -u nullglob shopt -u nullglob

View File

@@ -9,7 +9,7 @@
# -f/--force Install even if the version appears to be installed already # -f/--force Install even if the version appears to be installed already
# #
PYENV_VIRTUALENV_VERSION="1.1.0" PYENV_VIRTUALENV_VERSION="1.1.1"
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
@@ -533,6 +533,17 @@ if [ -d "${VIRTUALENV_PATH}" ] && [ -n "${COMPAT_VIRTUALENV_PATH}" ]; then
ln -fs "${VIRTUALENV_PATH}" "${COMPAT_VIRTUALENV_PATH}" ln -fs "${VIRTUALENV_PATH}" "${COMPAT_VIRTUALENV_PATH}"
fi fi
if [ ! -e "${VIRTUALENV_PATH}/bin/pydoc" ]; then
mkdir -p "${VIRTUALENV_PATH}/bin"
cat <<EOS > "${VIRTUALENV_PATH}/bin/pydoc"
#!${VIRTUALENV_PATH}/bin/python
import pydoc
if __name__ == '__main__':
pydoc.cli()
EOS
chmod +x "${VIRTUALENV_PATH}/bin/pydoc"
fi
if [ -z "${NO_ENSUREPIP}" ]; then if [ -z "${NO_ENSUREPIP}" ]; then
## Install setuptools and pip. ## Install setuptools and pip.
PYENV_VERSION="${VIRTUALENV_NAME}" build_package_ensurepip PYENV_VERSION="${VIRTUALENV_NAME}" build_package_ensurepip

View File

@@ -39,6 +39,7 @@ 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";
EOS EOS
unstub pyenv-version-name unstub pyenv-version-name
@@ -97,6 +98,7 @@ 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";
EOS EOS
unstub pyenv-virtualenv-prefix unstub pyenv-virtualenv-prefix
@@ -126,6 +128,7 @@ 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";
. "${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
@@ -158,6 +161,7 @@ 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";
. "${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

View File

@@ -30,6 +30,7 @@ setup() {
assert_success assert_success
assert_output <<EOS assert_output <<EOS
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;
@@ -97,6 +98,7 @@ EOS
assert_success assert_success
assert_output <<EOS assert_output <<EOS
. "${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo/etc/conda/deactivate.d/deactivate.sh"; . "${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo/etc/conda/deactivate.d/deactivate.sh";
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;

View File

@@ -32,11 +32,12 @@ unstub_pyenv() {
run pyenv-virtualenv venv run pyenv-virtualenv venv
assert_success
assert_output <<OUT assert_output <<OUT
PYENV_VERSION=3.5.1 python -m venv ${PYENV_ROOT}/versions/3.5.1/envs/venv PYENV_VERSION=3.5.1 python -m venv ${PYENV_ROOT}/versions/3.5.1/envs/venv
rehashed rehashed
OUT OUT
assert [ -x "${PYENV_ROOT}/versions/3.5.1/envs/venv/bin/pydoc" ]
assert_success
unstub_pyenv unstub_pyenv
unstub pyenv-virtualenv-prefix unstub pyenv-virtualenv-prefix
@@ -57,11 +58,12 @@ OUT
run pyenv-virtualenv venv run pyenv-virtualenv venv
assert_success
assert_output <<OUT assert_output <<OUT
PYENV_VERSION=3.5.1 virtualenv ${PYENV_ROOT}/versions/3.5.1/envs/venv PYENV_VERSION=3.5.1 virtualenv ${PYENV_ROOT}/versions/3.5.1/envs/venv
rehashed rehashed
OUT OUT
assert [ -x "${PYENV_ROOT}/versions/3.5.1/envs/venv/bin/pydoc" ]
assert_success
unstub_pyenv unstub_pyenv
unstub pyenv-virtualenv-prefix unstub pyenv-virtualenv-prefix
@@ -69,7 +71,7 @@ OUT
teardown_m_venv "3.5.1" teardown_m_venv "3.5.1"
} }
@test "install virtualenv if venv is not avaialble" { @test "install virtualenv if venv is not available" {
export PYENV_VERSION="3.2.1" export PYENV_VERSION="3.2.1"
setup_version "3.2.1" setup_version "3.2.1"
stub_pyenv "${PYENV_VERSION}" stub_pyenv "${PYENV_VERSION}"
@@ -81,12 +83,13 @@ OUT
run pyenv-virtualenv venv run pyenv-virtualenv venv
assert_success
assert_output <<OUT assert_output <<OUT
PYENV_VERSION=3.2.1 pip install virtualenv==13.1.2 PYENV_VERSION=3.2.1 pip install virtualenv==13.1.2
PYENV_VERSION=3.2.1 virtualenv ${PYENV_ROOT}/versions/3.2.1/envs/venv PYENV_VERSION=3.2.1 virtualenv ${PYENV_ROOT}/versions/3.2.1/envs/venv
rehashed rehashed
OUT OUT
assert [ -x "${PYENV_ROOT}/versions/3.2.1/envs/venv/bin/pydoc" ]
assert_success
unstub_pyenv unstub_pyenv
unstub pyenv-virtualenv-prefix unstub pyenv-virtualenv-prefix
@@ -112,6 +115,7 @@ PYENV_VERSION=3.5.1 pip install virtualenv
PYENV_VERSION=3.5.1 virtualenv --python=${TMP}/python3 ${PYENV_ROOT}/versions/3.5.1/envs/venv PYENV_VERSION=3.5.1 virtualenv --python=${TMP}/python3 ${PYENV_ROOT}/versions/3.5.1/envs/venv
rehashed rehashed
OUT OUT
assert [ -x "${PYENV_ROOT}/versions/3.5.1/envs/venv/bin/pydoc" ]
assert_success assert_success
unstub_pyenv unstub_pyenv
@@ -138,6 +142,7 @@ PYENV_VERSION=3.5.1 pip install virtualenv
PYENV_VERSION=3.5.1 virtualenv --python=${TMP}/python3 ${PYENV_ROOT}/versions/3.5.1/envs/venv PYENV_VERSION=3.5.1 virtualenv --python=${TMP}/python3 ${PYENV_ROOT}/versions/3.5.1/envs/venv
rehashed rehashed
OUT OUT
assert [ -x "${PYENV_ROOT}/versions/3.5.1/envs/venv/bin/pydoc" ]
assert_success assert_success
unstub_pyenv unstub_pyenv
@@ -158,12 +163,13 @@ OUT
PIP_REQUIRE_VENV="true" run pyenv-virtualenv venv PIP_REQUIRE_VENV="true" run pyenv-virtualenv venv
assert_success
assert_output <<OUT assert_output <<OUT
PIP_REQUIRE_VENV= PYENV_VERSION=3.2.1 pip install virtualenv==13.1.2 PIP_REQUIRE_VENV= PYENV_VERSION=3.2.1 pip install virtualenv==13.1.2
PIP_REQUIRE_VENV= PYENV_VERSION=3.2.1 virtualenv ${PYENV_ROOT}/versions/3.2.1/envs/venv PIP_REQUIRE_VENV= PYENV_VERSION=3.2.1 virtualenv ${PYENV_ROOT}/versions/3.2.1/envs/venv
rehashed rehashed
OUT OUT
assert [ -x "${PYENV_ROOT}/versions/3.2.1/envs/venv/bin/pydoc" ]
assert_success
unstub_pyenv unstub_pyenv
unstub pyenv-virtualenv-prefix unstub pyenv-virtualenv-prefix

View File

@@ -34,12 +34,13 @@ unstub_pyenv() {
run pyenv-virtualenv "2.7.11" "venv" run pyenv-virtualenv "2.7.11" "venv"
assert_success
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/get-pip.py...
rehashed rehashed
OUT OUT
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc" ]
assert_success
unstub_pyenv unstub_pyenv
unstub pyenv-virtualenv-prefix unstub pyenv-virtualenv-prefix
@@ -60,12 +61,13 @@ OUT
run pyenv-virtualenv venv run pyenv-virtualenv venv
assert_success
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/get-pip.py...
rehashed rehashed
OUT OUT
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc" ]
assert_success
unstub_pyenv unstub_pyenv
unstub pyenv-version-name unstub pyenv-version-name
@@ -92,6 +94,7 @@ PYENV_VERSION=2.7.11 virtualenv --verbose --python=${TMP}/python ${PYENV_ROOT}/v
Installing pip from https://bootstrap.pypa.io/get-pip.py... Installing pip from https://bootstrap.pypa.io/get-pip.py...
rehashed rehashed
OUT OUT
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc" ]
assert_success assert_success
unstub_pyenv unstub_pyenv
@@ -119,6 +122,7 @@ PYENV_VERSION=2.7.11 virtualenv --verbose --python=${TMP}/python ${PYENV_ROOT}/v
Installing pip from https://bootstrap.pypa.io/get-pip.py... Installing pip from https://bootstrap.pypa.io/get-pip.py...
rehashed rehashed
OUT OUT
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc" ]
assert_success assert_success
unstub_pyenv unstub_pyenv
@@ -176,12 +180,13 @@ OUT
run pyenv-virtualenv "2.7.11" "2.7.11/envs/foo" run pyenv-virtualenv "2.7.11" "2.7.11/envs/foo"
assert_success
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/get-pip.py...
rehashed rehashed
OUT OUT
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/foo/bin/pydoc" ]
assert_success
unstub_pyenv unstub_pyenv
unstub pyenv-virtualenv-prefix unstub pyenv-virtualenv-prefix