From 877aba8ae77b1d1e6db6620666a3314ccef8818b Mon Sep 17 00:00:00 2001 From: Yamashita Yuu Date: Sat, 21 Jun 2014 02:05:14 +0900 Subject: [PATCH] Refactoring around `SETUPTOOLS_VERSION` and `PIP_VERSION` --- bin/pyenv-virtualenv | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/bin/pyenv-virtualenv b/bin/pyenv-virtualenv index fd40b04..8ac0370 100755 --- a/bin/pyenv-virtualenv +++ b/bin/pyenv-virtualenv @@ -158,13 +158,7 @@ install_setuptools() { fi cat "${EZ_SETUP}" else - [ -n "${EZ_SETUP_URL}" ] || { - if [ -n "${SETUPTOOLS_VERSION}" ]; then - EZ_SETUP_URL="https://bitbucket.org/pypa/setuptools/raw/${SETUPTOOLS_VERSION}/ez_setup.py" - else - EZ_SETUP_URL="https://bootstrap.pypa.io/ez_setup.py" - fi - } + [ -n "${EZ_SETUP_URL}" ] || EZ_SETUP_URL="https://bootstrap.pypa.io/ez_setup.py" if [ -n "$VERBOSE" ]; then echo "Installing setuptools from ${EZ_SETUP_URL}..." 1>&2 fi @@ -181,13 +175,7 @@ install_pip() { fi cat "${GET_PIP}" else - [ -n "${GET_PIP_URL}" ] || { - if [ -n "${PIP_VERSION}" ]; then - GET_PIP_URL="https://raw.githubusercontent.com/pypa/pip/${PIP_VERSION}/contrib/get-pip.py" - else - GET_PIP_URL="https://bootstrap.pypa.io/get-pip.py" - fi - } + [ -n "${GET_PIP_URL}" ] || GET_PIP_URL="https://bootstrap.pypa.io/get-pip.py" if [ -n "$VERBOSE" ]; then echo "Installing pip from ${GET_PIP_URL}..." 1>&2 fi @@ -372,6 +360,15 @@ fi unset VIRTUALENV_VERSION +# Download specified version of ez_setup.py/get-pip.py +if [ -n "${SETUPTOOLS_VERSION}" ]; then + EZ_SETUP_URL="https://bitbucket.org/pypa/setuptools/raw/${SETUPTOOLS_VERSION}/ez_setup.py" +fi +if [ -n "${PIP_VERSION}" ]; then + GET_PIP_URL="https://raw.githubusercontent.com/pypa/pip/${PIP_VERSION}/contrib/get-pip.py" +fi + + # Define `before_virtualenv` and `after_virtualenv` functions that allow # plugin hooks to register a string of code for execution before or # after the installation process.