diff options
author | Michael Scherer <mscherer@users.noreply.github.com> | 2016-09-02 21:11:38 +0200 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2016-09-02 21:11:38 +0200 |
commit | 619f3d13ef89a3bd3cf1e0dc6a8d91040371e980 (patch) | |
tree | 5b18b928cd7ea7de359c27f7974bfdb495c810ef /hacking/env-setup | |
parent | Replace long with int (#17368) (diff) | |
download | ansible-619f3d13ef89a3bd3cf1e0dc6a8d91040371e980.tar.xz ansible-619f3d13ef89a3bd3cf1e0dc6a8d91040371e980.zip |
Add detection of python3 to hacking/env-setup (#17357)
People can still override the detection using PYTHON_BIN
Diffstat (limited to 'hacking/env-setup')
-rw-r--r-- | hacking/env-setup | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/hacking/env-setup b/hacking/env-setup index 25255f13c5..869f3b6551 100644 --- a/hacking/env-setup +++ b/hacking/env-setup @@ -5,6 +5,9 @@ PYTHONPATH=${PYTHONPATH-""} PATH=${PATH-""} MANPATH=${MANPATH-""} +PYTHON=$(which python 2>/dev/null || which python3 2>/dev/null) +PYTHON_BIN=${PYTHON_BIN-$PYTHON} + verbosity=${1-info} # Defaults to `info' if unspecified if [ "$verbosity" = -q ]; then @@ -24,7 +27,7 @@ else fi # The below is an alternative to readlink -fn which doesn't exist on OS X # Source: http://stackoverflow.com/a/1678636 -FULL_PATH=$(python -c "import os; print(os.path.realpath('$HACKING_DIR'))") +FULL_PATH=$($PYTHON_BIN -c "import os; print(os.path.realpath('$HACKING_DIR'))") export ANSIBLE_HOME="$(dirname "$FULL_PATH")" PREFIX_PYTHONPATH="$ANSIBLE_HOME/lib" @@ -45,7 +48,7 @@ gen_egg_info() if [ -e "$PREFIX_PYTHONPATH/ansible.egg-info" ] ; then \rm -rf "$PREFIX_PYTHONPATH/ansible.egg-info" fi - python setup.py egg_info + $PYTHON_BIN setup.py egg_info } if [ "$ANSIBLE_HOME" != "$PWD" ] ; then |