Bug 1662787 - Provide an environment variable to force running `mach python-test` command with Python 2 r=froydnj,firefox-build-system-reviewers,mhentges

This is only useful for `mach` commands that we want to run with Python 3 by default, but for which running with Python 2 is still useful. We now have one such command: `python-test`.

In `mach`, switch on the presence of the `MACH_PY2` environment variable. We only want to allow this for `python-test`, so do that sanity check in `mach` as well.

Differential Revision: https://phabricator.services.mozilla.com/D89162
This commit is contained in:
Ricky Stewart 2020-09-02 16:21:42 +00:00
Родитель b7689303c8
Коммит 1a65ffc115
1 изменённых файлов: 11 добавлений и 1 удалений

12
mach
Просмотреть файл

@ -151,7 +151,17 @@ case " $(echo $py2commands) " in
run_py "$py2executable" "$@"
;;
*)
run_py "$py3executable" "$@"
if [ -z ${MACH_PY2} ]
then
run_py "$py3executable" "$@"
else
if [ $command != "python-test" ]
then
echo "MACH_PY2 is only valid for mach python-test; please unset MACH_PY2 to continue."
exit 1
fi
run_py "$py2executable" "$@"
fi
;;
esac