From f239fe358f47c2aa423f7e0997a24540ef8d6a04 Mon Sep 17 00:00:00 2001 From: stephane Date: Mon, 15 Jun 2015 15:09:21 -0700 Subject: [PATCH] Refactor pip check/install & add dependency for CentOS Use easy_install to install pip to avoid additional dependencies on CentOS. Refactor the check for an installed pip since it will now be the same in both OS families. env-setup.sh was missing a package required if the user is starting from a very basic CentOS install. Also fix a minor typo in the script. Change-Id: I1ee783862b2bc5ad8b5df442ed7ca25732d8f706 --- scripts/env-setup.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/env-setup.sh b/scripts/env-setup.sh index c1cfb95d8..96c794e08 100755 --- a/scripts/env-setup.sh +++ b/scripts/env-setup.sh @@ -5,20 +5,21 @@ if [ -x '/usr/bin/apt-get' ]; then if ! $(git --version &>/dev/null) ; then sudo -H apt-get -y install git fi - if ! $(pip -v &>/dev/null); then - sudo easy_install pip - fi elif [ -x '/usr/bin/yum' ]; then + if ! yum -q list installed python-devel; then + sudo -H yum -y install python-devel + fi if ! $(git --version &>/dev/null); then sudo -H yum -y install git fi - if ! $(pip -v &>/dev/null); then - sudo -H yum -y install python-pip - fi else echo "ERROR: Supported package manager not found. Supported: apt,yum" fi +if ! $(pip -v &>/dev/null); then + sudo easy_install pip +fi + sudo -E pip install -r "$(dirname $0)/../requirements.txt" u=$(whoami) @@ -45,7 +46,7 @@ else fi echo -echo "If your using this script directly, execute the" +echo "If you're using this script directly, execute the" echo "following commands to update your shell." echo echo "source env-vars"