Skip to content

Commit

Permalink
Adds user prompt to specify whether or not they want a Python 2.x sym…
Browse files Browse the repository at this point in the history
…link created for them at /usr/local/bin/python2
  • Loading branch information
mdavid committed Apr 18, 2013
1 parent 6278045 commit 5c5922b
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions autogen.sh
Expand Up @@ -82,8 +82,29 @@ hash python2 2>&- || {
echo "$python2 binary found."
PYTHON2EXISTS=true
PYTHON2BIN=$(which $python2)
echo "Symlinking $PYTHON2BIN to /usr/local/bin/python2..."
ln -s $PYTHON2BIN /usr/local/bin/python2

#Terminal colors
RESTORE='\033[0m'
RED='\033[00;31m'
WHITE='\033[01;37m'
LYELLOW='\033[01;33m'

prompt=$(echo "${RED}Would you like to create a symlink from $PYTHON2BIN to /usr/local/bin/python2? ${WHITE}[${LYELLOW}Yes${RESTORE}|no${WHITE}]: ${RESTORE}")

read -e -p "$prompt" CREATESYMLINK
CREATESYMLINK=${CREATESYMLINK:-no}

if [[ "$CREATESYMLINK" == "Yes" ]]
then
echo "Symlinking $PYTHON2BIN to /usr/local/bin/python2"
ln -s $PYTHON2BIN /usr/local/bin/python2
else
echo "${RED}A python2 symlink to a Python 2.x binary (e.g. ${WHITE}$PYTHON2BIN${RED}) is required to continue."
echo "Please use a Python installation script of your choice that will create the required"
echo "symlink or manually create a symlink in a location accessible from your ${WHITE}\$PATH${RED} environment"
echo "variable and then rerun this script.${RESTORE}"
DIE=1
fi
break
fi
done
Expand Down

0 comments on commit 5c5922b

Please sign in to comment.