From e535faea4dc4f8e70c582aa8e3f525fec312fd15 Mon Sep 17 00:00:00 2001 From: "Yamashita, Yuu" Date: Mon, 20 Jul 2015 19:05:52 +0900 Subject: [PATCH 1/2] Ignore user's site-packages on ensurepip/get-pip (#89) https://www.python.org/dev/peps/pep-0370/ --- bin/pyenv-virtualenv | 6 +++--- test/pip.bats | 10 +++++----- test/pyvenv.bats | 16 ++++++++-------- test/virtualenv.bats | 16 ++++++++-------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/bin/pyenv-virtualenv b/bin/pyenv-virtualenv index 382f13a..90aa712 100755 --- a/bin/pyenv-virtualenv +++ b/bin/pyenv-virtualenv @@ -157,7 +157,7 @@ build_package_ez_setup() { http get "${EZ_SETUP_URL}" fi } 1> "${ez_setup}" - pyenv-exec python "${ez_setup}" ${EZ_SETUP_OPTS} 1>&2 || { + pyenv-exec python -s "${ez_setup}" ${EZ_SETUP_OPTS} 1>&2 || { echo "error: failed to install setuptools via ez_setup.py" >&2 return 1 } @@ -175,14 +175,14 @@ build_package_get_pip() { http get "${GET_PIP_URL}" fi } 1> "${get_pip}" - pyenv-exec python "${get_pip}" ${GET_PIP_OPTS} 1>&2 || { + pyenv-exec python -s "${get_pip}" ${GET_PIP_OPTS} 1>&2 || { echo "error: failed to install pip via get-pip.py" >&2 return 1 } } build_package_ensurepip() { - pyenv-exec python -m ensurepip 2>/dev/null || build_package_get_pip "$@" || return 1 + pyenv-exec python -s -m ensurepip 2>/dev/null || build_package_get_pip "$@" || return 1 } prepare_requirements() { diff --git a/test/pip.bats b/test/pip.bats index 909a0f3..b7337d5 100644 --- a/test/pip.bats +++ b/test/pip.bats @@ -26,7 +26,7 @@ unstub_pyenv() { stub pyenv-prefix " : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'" stub pyenv-prefix " : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'" stub pyenv-exec "pyvenv ${PYENV_ROOT}/versions/venv : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";mkdir -p \${PYENV_ROOT}/versions/venv/bin" - stub pyenv-exec "python -m ensurepip : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";touch \${PYENV_ROOT}/versions/venv/bin/pip" + stub pyenv-exec "python -s -m ensurepip : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";touch \${PYENV_ROOT}/versions/venv/bin/pip" remove_executable "3.4.1" "virtualenv" create_executable "3.4.1" "pyvenv" @@ -36,7 +36,7 @@ unstub_pyenv() { assert_success assert_output < Date: Mon, 20 Jul 2015 19:14:57 +0900 Subject: [PATCH 2/2] Fix broken test --- test/virtualenv.bats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/virtualenv.bats b/test/virtualenv.bats index 2fe84db..e169430 100644 --- a/test/virtualenv.bats +++ b/test/virtualenv.bats @@ -99,7 +99,7 @@ OUT stub pyenv-version-name "echo \${PYENV_VERSION}" stub pyenv-exec "virtualenv --verbose --python=python ${PYENV_ROOT}/versions/venv : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\"" stub pyenv-exec "python -s -m ensurepip : false" - stub pyenv-exec "python -s t */get-pip.py : true" + stub pyenv-exec "python -s */get-pip.py : true" stub curl true run pyenv-virtualenv --verbose --python=python venv