From 8ec27220c5c63de59f129c839eddf5380efe46a4 Mon Sep 17 00:00:00 2001 From: Vincent Untz Date: Thu, 29 Nov 2012 09:25:31 +0100 Subject: [PATCH] Add a get_pip_command function There are two places where we need to find the right command for pip, so instead of having one version we fix and a buggy version we forget, simply use a function :-) Change-Id: I728c17ad7be5c86690c4d7907f77f1f98ec2b815 --- functions | 19 ++++++++++++++----- tools/info.sh | 6 +----- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/functions b/functions index 9022675ad3..bc6fdc354b 100644 --- a/functions +++ b/functions @@ -645,11 +645,7 @@ function pip_install { SUDO_PIP="env" else SUDO_PIP="sudo" - if [[ "$os_PACKAGE" = "deb" ]] || is_suse; then - CMD_PIP=/usr/bin/pip - else - CMD_PIP=/usr/bin/pip-python - fi + CMD_PIP=$(get_pip_command) fi if [[ "$PIP_USE_MIRRORS" != "False" ]]; then PIP_MIRROR_OPT="--use-mirrors" @@ -1046,6 +1042,19 @@ function get_rootwrap_location() { fi } +# Get the path to the pip command. +# get_pip_command +function get_pip_command() { + if [[ -z "$os_PACKAGE" ]]; then + GetOSVersion + fi + + if [[ "$os_PACKAGE" = "deb" ]] || is_suse; then + echo "/usr/bin/pip" + else + echo "/usr/bin/pip-python" + fi +} # Check if qpid can be used on the current distro. # qpid_is_supported diff --git a/tools/info.sh b/tools/info.sh index 5c9a1d3d94..a872d59d18 100755 --- a/tools/info.sh +++ b/tools/info.sh @@ -107,11 +107,7 @@ done # Pips # ---- -if [[ "$os_PACKAGE" = "deb" ]]; then - CMD_PIP=/usr/bin/pip -else - CMD_PIP=/usr/bin/pip-python -fi +CMD_PIP=$(get_pip_command) # Pip tells us what is currently installed FREEZE_FILE=$(mktemp --tmpdir freeze.XXXXXX)