1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add detection of python3 to hacking/env-setup (#17357)

People can still override the detection using PYTHON_BIN
This commit is contained in:
Michael Scherer 2016-09-02 21:11:38 +02:00 committed by Toshio Kuratomi
parent 7728d70bea
commit 619f3d13ef

View file

@ -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