mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 04:41:11 +00:00
Bug 1700419 - Remove py2commands logic from mach driver.r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D109654
This commit is contained in:
parent
1f5055fa54
commit
1a42e404f2
38
mach
38
mach
@ -10,9 +10,6 @@
|
||||
# Embeds a shell script inside a Python triple quote. This pattern is valid
|
||||
# shell because `''':'`, `':'` and `:` are all equivalent, and `:` is a no-op.
|
||||
''':'
|
||||
# Commands that are to be run with Python 2.
|
||||
py2commands="
|
||||
"
|
||||
|
||||
# Commands that are to be run with the system Python 3 instead of the
|
||||
# virtualenv.
|
||||
@ -32,7 +29,7 @@ run_py() {
|
||||
else
|
||||
echo "This mach command requires $py_executable, which wasn't found on the system!"
|
||||
case "$py_executable" in
|
||||
python2.7|python3) ;;
|
||||
python3) ;;
|
||||
*)
|
||||
echo "Consider running 'mach bootstrap' or 'mach create-mach-environment' to create the mach virtualenvs, or set MACH_USE_SYSTEM_PYTHON to use the system Python installation over a virtualenv."
|
||||
;;
|
||||
@ -72,12 +69,6 @@ get_command() {
|
||||
shift 2
|
||||
fi
|
||||
;;
|
||||
# When running `./mach help <command>`, the correct Python for <command>
|
||||
# needs to be used.
|
||||
help) echo $2; break;;
|
||||
# When running `./mach mach-completion /path/to/mach <command>`, the
|
||||
# correct Python for <command> needs to be used.
|
||||
mach-completion) echo $3; break;;
|
||||
"") echo; break;;
|
||||
*) echo $1; break;;
|
||||
esac
|
||||
@ -88,17 +79,15 @@ state_dir=${MOZBUILD_STATE_PATH:-~/.mozbuild}
|
||||
command=$(get_command "$@")
|
||||
|
||||
# If MACH_USE_SYSTEM_PYTHON or MOZ_AUTOMATION are set, always use the
|
||||
# python{2.7,3} executables and not the virtualenv locations.
|
||||
# python 3 executables and not the virtualenv locations.
|
||||
if [ -z ${MACH_USE_SYSTEM_PYTHON} ] && [ -z ${MOZ_AUTOMATION} ]
|
||||
then
|
||||
case "$OSTYPE" in
|
||||
cygwin|msys|win32) bin_path=Scripts;;
|
||||
*) bin_path=bin;;
|
||||
esac
|
||||
py2executable=$state_dir/_virtualenvs/mach_py2/$bin_path/python
|
||||
py3executable=$state_dir/_virtualenvs/mach/$bin_path/python
|
||||
else
|
||||
py2executable=python2.7
|
||||
py3executable=python3
|
||||
fi
|
||||
|
||||
@ -109,28 +98,7 @@ case " $(echo $nativecmds) " in
|
||||
;;
|
||||
esac
|
||||
|
||||
# Check for the mach subcommand in the Python 2 commands list and run it
|
||||
# with the correct interpreter.
|
||||
case " $(echo $py2commands) " in
|
||||
*\ $command\ *)
|
||||
run_py "$py2executable" "$@"
|
||||
;;
|
||||
*)
|
||||
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
|
||||
|
||||
# Run Python 3 for everything else.
|
||||
# # Use the mach virtualenv's Python 3 for the rest of the commands.
|
||||
run_py "$py3executable" "$@"
|
||||
'''
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user