Commit df70c815 authored by Edward Lesmes's avatar Edward Lesmes Committed by LUCI CQ

depot_tools: Simplify MinGW check.

Check `if [[ $(uname -s) = MINGW* ]]` instead of using
grepping and an additional variable.

Change-Id: I6f2cfbb6743357125e6672b77667ee5e36d3d81e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2127674
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: 's avatarJosip Sokcevic <sokcevic@google.com>
parent 50da7706
...@@ -9,16 +9,13 @@ base_dir=$(dirname "$0") ...@@ -9,16 +9,13 @@ base_dir=$(dirname "$0")
# standalone, but allow other PATH manipulations to take priority. # standalone, but allow other PATH manipulations to take priority.
PATH=$PATH:$base_dir PATH=$PATH:$base_dir
# MINGW will equal 0 if we're running on Windows under MinGW.
MINGW=$(uname -s | grep MINGW > /dev/null; echo $?)
if [[ $GCLIENT_PY3 == 1 ]]; then if [[ $GCLIENT_PY3 == 1 ]]; then
# Explicitly run on Python 3 # Explicitly run on Python 3
PYTHONDONTWRITEBYTECODE=1 exec vpython3 "$base_dir/fetch.py" "$@" PYTHONDONTWRITEBYTECODE=1 exec vpython3 "$base_dir/fetch.py" "$@"
elif [[ $GCLIENT_PY3 == 0 ]]; then elif [[ $GCLIENT_PY3 == 0 ]]; then
# Explicitly run on Python 2 # Explicitly run on Python 2
PYTHONDONTWRITEBYTECODE=1 exec vpython "$base_dir/fetch.py" "$@" PYTHONDONTWRITEBYTECODE=1 exec vpython "$base_dir/fetch.py" "$@"
elif [[ $MINGW = 0 ]]; then elif [[ $(uname -s) = MINGW* || $(uname -s) = CYGWIN* ]]; then
# Run on Python 2 on Windows for now, allows default to be flipped. # Run on Python 2 on Windows for now, allows default to be flipped.
PYTHONDONTWRITEBYTECODE=1 exec vpython "$base_dir/fetch.py" "$@" PYTHONDONTWRITEBYTECODE=1 exec vpython "$base_dir/fetch.py" "$@"
else else
......
...@@ -26,16 +26,13 @@ fi ...@@ -26,16 +26,13 @@ fi
# standalone, but allow other PATH manipulations to take priority. # standalone, but allow other PATH manipulations to take priority.
PATH=$PATH:$base_dir PATH=$PATH:$base_dir
# MINGW will equal 0 if we're running on Windows under MinGW.
MINGW=$(uname -s | grep MINGW > /dev/null; echo $?)
if [[ $GCLIENT_PY3 == 1 ]]; then if [[ $GCLIENT_PY3 == 1 ]]; then
# Explicitly run on Python 3 # Explicitly run on Python 3
PYTHONDONTWRITEBYTECODE=1 exec vpython3 "$base_dir/gclient.py" "$@" PYTHONDONTWRITEBYTECODE=1 exec vpython3 "$base_dir/gclient.py" "$@"
elif [[ $GCLIENT_PY3 == 0 ]]; then elif [[ $GCLIENT_PY3 == 0 ]]; then
# Explicitly run on Python 2 # Explicitly run on Python 2
PYTHONDONTWRITEBYTECODE=1 exec vpython "$base_dir/gclient.py" "$@" PYTHONDONTWRITEBYTECODE=1 exec vpython "$base_dir/gclient.py" "$@"
elif [[ $MINGW = 0 ]]; then elif [[ $(uname -s) = MINGW* || $(uname -s) = CYGWIN* ]]; then
# Run on Python 2 on Windows for now, allows default to be flipped. # Run on Python 2 on Windows for now, allows default to be flipped.
PYTHONDONTWRITEBYTECODE=1 exec vpython "$base_dir/gclient.py" "$@" PYTHONDONTWRITEBYTECODE=1 exec vpython "$base_dir/gclient.py" "$@"
else else
......
...@@ -48,16 +48,13 @@ SCRIPT="${SCRIPT-${BASENAME//-/_}.py}" ...@@ -48,16 +48,13 @@ SCRIPT="${SCRIPT-${BASENAME//-/_}.py}"
# standalone, but allow other PATH manipulations to take priority. # standalone, but allow other PATH manipulations to take priority.
PATH=$PATH:$DEPOT_TOOLS PATH=$PATH:$DEPOT_TOOLS
# MINGW will equal 0 if we're running on Windows under MinGW.
MINGW=$(uname -s | grep MINGW > /dev/null; echo $?)
if [[ $GCLIENT_PY3 = 1 ]]; then if [[ $GCLIENT_PY3 = 1 ]]; then
# Explicitly run on Python 3 # Explicitly run on Python 3
vpython3 "$DEPOT_TOOLS/$SCRIPT" "$@" vpython3 "$DEPOT_TOOLS/$SCRIPT" "$@"
elif [[ $GCLIENT_PY3 = 0 ]]; then elif [[ $GCLIENT_PY3 = 0 ]]; then
# Explicitly run on Python 2 # Explicitly run on Python 2
vpython "$DEPOT_TOOLS/$SCRIPT" "$@" vpython "$DEPOT_TOOLS/$SCRIPT" "$@"
elif [[ $MINGW = 0 ]]; then elif [[ $(uname -s) = MINGW* || $(uname -s) = CYGWIN* ]]; then
# Run on Python 2 on Windows for now, allows default to be flipped. # Run on Python 2 on Windows for now, allows default to be flipped.
vpython "$DEPOT_TOOLS/$SCRIPT" "$@" vpython "$DEPOT_TOOLS/$SCRIPT" "$@"
else else
......
...@@ -9,16 +9,13 @@ base_dir=$(dirname "$0") ...@@ -9,16 +9,13 @@ base_dir=$(dirname "$0")
# standalone, but allow other PATH manipulations to take priority. # standalone, but allow other PATH manipulations to take priority.
PATH=$PATH:$base_dir PATH=$PATH:$base_dir
# MINGW will equal 0 if we're running on Windows under MinGW.
MINGW=$(uname -s | grep MINGW > /dev/null; echo $?)
if [[ $GCLIENT_PY3 = 1 ]]; then if [[ $GCLIENT_PY3 = 1 ]]; then
# Explicitly run on Python 3 # Explicitly run on Python 3
PYTHONDONTWRITEBYTECODE=1 exec vpython3 "$base_dir/roll_dep.py" "$@" PYTHONDONTWRITEBYTECODE=1 exec vpython3 "$base_dir/roll_dep.py" "$@"
elif [[ $GCLIENT_PY3 = 0 ]]; then elif [[ $GCLIENT_PY3 = 0 ]]; then
# Explicitly run on Python 2 # Explicitly run on Python 2
PYTHONDONTWRITEBYTECODE=1 exec vpython "$base_dir/roll_dep.py" "$@" PYTHONDONTWRITEBYTECODE=1 exec vpython "$base_dir/roll_dep.py" "$@"
elif [[ $MINGW = 0 ]]; then elif [[ $(uname -s) = MINGW* || $(uname -s) = CYGWIN* ]]; then
# Run on Python 2 on Windows for now, allows default to be flipped. # Run on Python 2 on Windows for now, allows default to be flipped.
PYTHONDONTWRITEBYTECODE=1 exec vpython "$base_dir/roll_dep.py" "$@" PYTHONDONTWRITEBYTECODE=1 exec vpython "$base_dir/roll_dep.py" "$@"
else else
......
...@@ -39,12 +39,9 @@ base_dir=$(dirname "$0") ...@@ -39,12 +39,9 @@ base_dir=$(dirname "$0")
source "$base_dir/cipd_bin_setup.sh" source "$base_dir/cipd_bin_setup.sh"
cipd_bin_setup &> /dev/null cipd_bin_setup &> /dev/null
# MINGW will equal 0 if we're running on Windows under MinGW.
MINGW=$(uname -s | grep MINGW > /dev/null; echo $?)
# If Python bootstrapping is not disabled, make sure Python has been # If Python bootstrapping is not disabled, make sure Python has been
# bootstrapped and add it to the front of PATH. # bootstrapped and add it to the front of PATH.
if [[ $MINGW = 0 ]]; then if [[ $(uname -s) = MINGW* || $(uname -s) = CYGWIN* ]]; then
cmd.exe //c $0.bat "$@" cmd.exe //c $0.bat "$@"
elif [[ $DEPOT_TOOLS_BOOTSTRAP_PYTHON3 != 0 ]]; then elif [[ $DEPOT_TOOLS_BOOTSTRAP_PYTHON3 != 0 ]]; then
if [[ ! -e "$base_dir/python3_bin_reldir.txt" ]]; then if [[ ! -e "$base_dir/python3_bin_reldir.txt" ]]; then
......
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