commit 2a3b01ff68b99119689fb7d36ca60f62c810df2c Author: teor (Tim Wilson-Brown) teor2345@gmail.com Date: Thu Aug 27 10:35:37 2015 +1000
If $PYTHON isn't set, use python2 or python
If $PYTHON isn't set, use "command" to check for python2, then python. (python3 check is disabled due to #16904 - chutney doesn't work with python3.)
If neither of the "command" checks work, assume a strange shell or "command", and fall back to python2.
Fixes default install of chutney on OS X, which has neither $PYTHON set, nor python2; but does have python, which happens to be version 2.
Resolves #16902. --- chutney | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/chutney b/chutney index 4a26464..cbbc673 100755 --- a/chutney +++ b/chutney @@ -1,4 +1,12 @@ #!/bin/sh
export PYTHONPATH="`dirname $0`/lib:${PYTHONPATH}" +# Use python2, python, python3 in that order +[ -n "$PYTHON" ] || { + command -v python2 >/dev/null 2>&1 && PYTHON=python2 || \ + command -v python >/dev/null 2>&1 && PYTHON=python # || \ +# Not yet supported +# command -v python3 >/dev/null 2>&1 && PYTHON=python3 +} +# Use python2 if the checks that use "command" fail ${PYTHON:=python2} -m chutney.TorNet "$@"
tor-commits@lists.torproject.org