Commit f05e97fa authored by Laurent Bachelier's avatar Laurent Bachelier 🐧
Browse files

tools: Make Python 3 options consistent

Always run Python scripts through the same interpreter.
Also simplify the running of pyflakes and flake8, as recent versions all
support execution through python -m. Due do the many variations among
distributions, it makes the whole thing much simpler.
parent 273be803
#!/bin/sh
set -e
VER=2
if [ "$1" = -3 ]; then
VER=3
shift
fi
if [ -z "${PYTHON}" ]; then
which python >/dev/null 2>&1 && PYTHON=$(which python)
which python2 >/dev/null 2>&1 && PYTHON=$(which python2)
which python2.7 >/dev/null 2>&1 && PYTHON=$(which python2.7)
which python$VER >/dev/null 2>&1 && PYTHON=$(which python$VER)
if [ $VER -eq 2 ]; then
which python2.7 >/dev/null 2>&1 && PYTHON=$(which python2.7)
else
which python3.4 >/dev/null 2>&1 && PYTHON=$(which python3.4)
fi
fi
${PYTHON} "$(dirname $0)/stale_pyc.py"
$PYTHON "$(dirname $0)/stale_pyc.py"
exec "${PYTHON}" "$(dirname $0)/local_install.py" "$@"
exec $PYTHON "$(dirname $0)/local_install.py" "$@"
#!/bin/sh
set -e
VER=2
if [ "$1" = -3 ]; then
VER=3
shift
fi
if [ -z "${PYTHON}" ]; then
which python >/dev/null 2>&1 && PYTHON=$(which python)
which python2 >/dev/null 2>&1 && PYTHON=$(which python2)
which python2.7 >/dev/null 2>&1 && PYTHON=$(which python2.7)
which python$VER >/dev/null 2>&1 && PYTHON=$(which python$VER)
if [ $VER -eq 2 ]; then
which python2.7 >/dev/null 2>&1 && PYTHON=$(which python2.7)
else
which python3.4 >/dev/null 2>&1 && PYTHON=$(which python3.4)
fi
fi
${PYTHON} "$(dirname $0)/stale_pyc.py"
$PYTHON "$(dirname $0)/stale_pyc.py"
exec "${PYTHON}" "$(dirname $0)/local_run.py" "$@"
exec $PYTHON "$(dirname $0)/local_run.py" "$@"
......@@ -3,6 +3,22 @@
# stop on failure
set -e
VER=2
if [ "$1" = -3 ]; then
VER=3
shift
fi
if [ -z "${PYTHON}" ]; then
which python >/dev/null 2>&1 && PYTHON=$(which python)
which python$VER >/dev/null 2>&1 && PYTHON=$(which python$VER)
if [ $VER -eq 2 ]; then
which python2.7 >/dev/null 2>&1 && PYTHON=$(which python2.7)
else
which python3.4 >/dev/null 2>&1 && PYTHON=$(which python3.4)
fi
fi
# Use C local to avoid local dates in headers
export LANG=en_US.utf8
......@@ -24,9 +40,9 @@ echo "file://$WEBOOB_DIR/modules" > "${WEBOOB_TMPDIR}/sources.list"
export WEBOOB_WORKDIR="${WEBOOB_TMPDIR}"
export WEBOOB_DATADIR="${WEBOOB_TMPDIR}"
export PYTHONPATH="${WEBOOB_DIR}"
"${WEBOOB_DIR}/scripts/weboob-config" update
$PYTHON "${WEBOOB_DIR}/scripts/weboob-config" update
"${WEBOOB_DIR}/tools/make_man.py"
$PYTHON "${WEBOOB_DIR}/tools/make_man.py"
# allow failing commands past this point
STATUS=$?
......
......@@ -3,6 +3,22 @@
# stop on failure
set -e
VER=2
if [ "$1" = -3 ]; then
VER=3
shift
fi
if [ -z "${PYTHON}" ]; then
which python >/dev/null 2>&1 && PYTHON=$(which python)
which python$VER >/dev/null 2>&1 && PYTHON=$(which python$VER)
if [ $VER -eq 2 ]; then
which python2.7 >/dev/null 2>&1 && PYTHON=$(which python2.7)
else
which python3.4 >/dev/null 2>&1 && PYTHON=$(which python3.4)
fi
fi
[ -z "${TMPDIR}" ] && TMPDIR="/tmp"
# do not allow undefined variables anymore
......@@ -18,9 +34,9 @@ echo "file://$WEBOOB_DIR/modules" > "${WEBOOB_TMPDIR}/sources.list"
export WEBOOB_WORKDIR="${WEBOOB_TMPDIR}"
export WEBOOB_DATADIR="${WEBOOB_TMPDIR}"
export PYTHONPATH="${WEBOOB_DIR}"
"${WEBOOB_DIR}/scripts/weboob-config" update
$PYTHON "${WEBOOB_DIR}/scripts/weboob-config" update
"${WEBOOB_DIR}/tools/weboob_lint.py"
$PYTHON "${WEBOOB_DIR}/tools/weboob_lint.py"
# allow failing commands past this point
STATUS=$?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment