forked from mirrors/gecko-dev
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
1 changed files with 3 additions and 35 deletions
38
mach
38
mach
|
|
@ -10,9 +10,6 @@
|
||||||
# Embeds a shell script inside a Python triple quote. This pattern is valid
|
# Embeds a shell script inside a Python triple quote. This pattern is valid
|
||||||
# shell because `''':'`, `':'` and `:` are all equivalent, and `:` is a no-op.
|
# 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
|
# Commands that are to be run with the system Python 3 instead of the
|
||||||
# virtualenv.
|
# virtualenv.
|
||||||
|
|
@ -32,7 +29,7 @@ run_py() {
|
||||||
else
|
else
|
||||||
echo "This mach command requires $py_executable, which wasn't found on the system!"
|
echo "This mach command requires $py_executable, which wasn't found on the system!"
|
||||||
case "$py_executable" in
|
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."
|
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
|
shift 2
|
||||||
fi
|
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; break;;
|
||||||
*) echo $1; break;;
|
*) echo $1; break;;
|
||||||
esac
|
esac
|
||||||
|
|
@ -88,17 +79,15 @@ state_dir=${MOZBUILD_STATE_PATH:-~/.mozbuild}
|
||||||
command=$(get_command "$@")
|
command=$(get_command "$@")
|
||||||
|
|
||||||
# If MACH_USE_SYSTEM_PYTHON or MOZ_AUTOMATION are set, always use the
|
# 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} ]
|
if [ -z ${MACH_USE_SYSTEM_PYTHON} ] && [ -z ${MOZ_AUTOMATION} ]
|
||||||
then
|
then
|
||||||
case "$OSTYPE" in
|
case "$OSTYPE" in
|
||||||
cygwin|msys|win32) bin_path=Scripts;;
|
cygwin|msys|win32) bin_path=Scripts;;
|
||||||
*) bin_path=bin;;
|
*) bin_path=bin;;
|
||||||
esac
|
esac
|
||||||
py2executable=$state_dir/_virtualenvs/mach_py2/$bin_path/python
|
|
||||||
py3executable=$state_dir/_virtualenvs/mach/$bin_path/python
|
py3executable=$state_dir/_virtualenvs/mach/$bin_path/python
|
||||||
else
|
else
|
||||||
py2executable=python2.7
|
|
||||||
py3executable=python3
|
py3executable=python3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -109,28 +98,7 @@ case " $(echo $nativecmds) " in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Check for the mach subcommand in the Python 2 commands list and run it
|
# # Use the mach virtualenv's Python 3 for the rest of the commands.
|
||||||
# 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.
|
|
||||||
run_py "$py3executable" "$@"
|
run_py "$py3executable" "$@"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue