From c0f8642119883b921f206c12792c2acb19d69768 Mon Sep 17 00:00:00 2001 From: "iannucci@chromium.org" Date: Fri, 1 Apr 2016 01:01:43 +0000 Subject: [PATCH] Revert "Better tooling" This reverts commit eed06d620fa4814a596c359b2d8bba4ad524c934. Accidental dcommit git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@299615 0039d316-1c4b-4281-b951-d872f2087c98 --- .gitignore | 1 - bootstrap/win/git-bash.template.sh | 12 ------------ bootstrap/win/win_tools.bat | 26 +++++++++++--------------- depot-tools-auth.py | 3 +-- gclient.py | 2 +- git-bash | 11 +++++++++++ git_cl.py | 2 +- git_map_branches.py | 3 +-- python_runner.sh | 11 +++-------- 9 files changed, 29 insertions(+), 42 deletions(-) delete mode 100644 bootstrap/win/git-bash.template.sh create mode 100755 git-bash diff --git a/.gitignore b/.gitignore index 8ceec20b7..ca8808ab7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ *.pyc # Ignore the batch files produced by the Windows bootstrapping. -/git-bash /git.bat /gitk.bat /pylint.bat diff --git a/bootstrap/win/git-bash.template.sh b/bootstrap/win/git-bash.template.sh deleted file mode 100644 index b34b5dc56..000000000 --- a/bootstrap/win/git-bash.template.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -export EDITOR=${EDITOR:=notepad} -WIN_BASE=`dirname $0` -UNIX_BASE=`cygpath "$WIN_BASE"` -export PATH=$PATH:$UNIX_BASE/SVN_BIN_DIR:$UNIX_BASE/PYTHON_BIN_DIR:$UNIX_BASE/PYTHON_BIN_DIR/Scripts -export PYTHON_DIRECT=1 -export PYTHONUNBUFFERED=1 -if [[ $# > 1 ]]; then - $UNIX_BASE/GIT_BIN_DIR/bin/bash.exe "$@" -else - $UNIX_BASE/GIT_BIN_DIR/git-bash.exe & -fi diff --git a/bootstrap/win/win_tools.bat b/bootstrap/win/win_tools.bat index f092be431..ae9ccef09 100644 --- a/bootstrap/win/win_tools.bat +++ b/bootstrap/win/win_tools.bat @@ -89,18 +89,15 @@ for /d %%i in ("%WIN_TOOLS_ROOT_DIR%\git-*_bin") do ( if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL -if not exist "%GIT_EXE_PATH%" goto :GIT_INSTALL - -call "%GIT_EXE_PATH%" --version 2>nul 1>nul -if errorlevel 1 goto :GIT_INSTALL - -:: Several git versions can live side-by-side; check the top-level -:: batch script to make sure it points to the desired version. -for %%f in (git.bat gitk.bat ssh.bat ssh-keygen.bat git-bash) do ( - find "%GIT_BIN_DIR%" "%WIN_TOOLS_ROOT_DIR%\%%f" 2>nul 1>nul +if exist "%GIT_EXE_PATH%" ( + call "%GIT_EXE_PATH%" --version 2>nul 1>nul + if errorlevel 1 goto :GIT_INSTALL + rem Several git versions can live side-by-side; check the top-level + rem batch script to make sure it points to the desired version. + find "%GIT_BIN_DIR%" "%WIN_TOOLS_ROOT_DIR%\git.bat" 2>nul 1>nul if errorlevel 1 goto :GIT_MAKE_BATCH_FILES + goto :SYNC_GIT_HELP_FILES ) -goto :SYNC_GIT_HELP_FILES :GIT_INSTALL echo Installing git %GIT_VERSION% (avg 1-2 min download) ... @@ -131,11 +128,10 @@ if not exist "%GIT_INST_DIR%\." goto :GIT_FAIL :: Create the batch files. set GIT_TEMPL=%~dp0git.template.bat set SED=%GIT_INST_DIR%\usr\bin\sed.exe -call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/g" -e "s/GIT_PROGRAM/cmd\\\\git.exe/g" < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\git.bat" -call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/g" -e "s/GIT_PROGRAM/cmd\\\\gitk.exe/g" < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\gitk.bat" -call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/g" -e "s/GIT_PROGRAM/usr\\\\bin\\\\ssh.exe/g" < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\ssh.bat" -call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/g" -e "s/GIT_PROGRAM/usr\\\\bin\\\\ssh-keygen.exe/g" < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\ssh-keygen.bat" -call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/g" -e "s/PYTHON_BIN_DIR/python276_bin/g" -e "s/SVN_BIN_DIR/svn_bin/g" < %~dp0git-bash.template.sh > "%WIN_TOOLS_ROOT_DIR%\git-bash" +call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/" -e "s/GIT_PROGRAM/cmd\\\\git.exe/" < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\git.bat" +call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/" -e "s/GIT_PROGRAM/cmd\\\\gitk.exe/" < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\gitk.bat" +call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/" -e "s/GIT_PROGRAM/usr\\\\bin\\\\ssh.exe/" < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\ssh.bat" +call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/" -e "s/GIT_PROGRAM/usr\\\\bin\\\\ssh-keygen.exe/" < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\ssh-keygen.bat" :: Ensure various git configurations are set correctly at they system level. call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.autocrlf false diff --git a/depot-tools-auth.py b/depot-tools-auth.py index 87ec1ccf0..3ebc239d8 100755 --- a/depot-tools-auth.py +++ b/depot-tools-auth.py @@ -14,7 +14,6 @@ Usage: import logging import optparse import sys -import os from third_party import colorama @@ -95,7 +94,7 @@ def main(argv): if __name__ == '__main__': - colorama.init(wrap="TERM" not in os.environ) + colorama.init() try: sys.exit(main(sys.argv[1:])) except KeyboardInterrupt: diff --git a/gclient.py b/gclient.py index aae6783f4..528aadfcf 100755 --- a/gclient.py +++ b/gclient.py @@ -2303,7 +2303,7 @@ def main(argv): return 2 fix_encoding.fix_encoding() disable_buffering() - colorama.init(wrap="TERM" not in os.environ) + colorama.init() dispatcher = subcommand.CommandDispatcher(__name__) try: return dispatcher.execute(OptionParser(), argv) diff --git a/git-bash b/git-bash new file mode 100755 index 000000000..0a5be9321 --- /dev/null +++ b/git-bash @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# This apparently useless file enables windows users to get access to +# depot_tools' built-in bash.exe. When git executes this file as in `git bash`, +# it has bash and related tools pre-installed in the environment. Therefore even +# though 'bash' from cmd.exe doesn't work, bash here does work as you'd expect. + +bash "$@" diff --git a/git_cl.py b/git_cl.py index 278cd9ae8..6fe4c6a9b 100755 --- a/git_cl.py +++ b/git_cl.py @@ -4478,7 +4478,7 @@ if __name__ == '__main__': # These affect sys.stdout so do it outside of main() to simplify mocks in # unit testing. fix_encoding.fix_encoding() - colorama.init(wrap="TERM" not in os.environ) + colorama.init() try: sys.exit(main(sys.argv[1:])) except KeyboardInterrupt: diff --git a/git_map_branches.py b/git_map_branches.py index 50b403d4c..6105f5e87 100755 --- a/git_map_branches.py +++ b/git_map_branches.py @@ -27,7 +27,6 @@ Branches are colorized as follows: import argparse import collections -import os import sys import subprocess2 @@ -272,7 +271,7 @@ class BranchMapper(object): def main(argv): - colorama.init(wrap="TERM" not in os.environ) + colorama.init() if get_git_version() < MIN_UPSTREAM_TRACK_GIT_VERSION: print >> sys.stderr, ( 'This tool will not show all tracking information for git version ' diff --git a/python_runner.sh b/python_runner.sh index 2834d1409..bf9f624dd 100755 --- a/python_runner.sh +++ b/python_runner.sh @@ -41,15 +41,10 @@ if [[ "$DEPOT_TOOLS" = "$0" ]]; then else BASENAME="${0##*\\}" fi - SCRIPT="${SCRIPT-${BASENAME//-/_}.py}" -if [[ $PYTHON_DIRECT = 1 ]]; then - python.exe "$DEPOT_TOOLS\\$SCRIPT" "$@" +if [[ -e "$DEPOT_TOOLS/python.bat" && $OSTYPE = msys ]]; then + cmd.exe //c "$DEPOT_TOOLS\\python.bat" "$DEPOT_TOOLS\\$SCRIPT" "$@" else - if [[ -e "$DEPOT_TOOLS/python.bat" && $OSTYPE = msys ]]; then - cmd.exe //c "$DEPOT_TOOLS\\python.bat" "$DEPOT_TOOLS\\$SCRIPT" "$@" - else - exec "$DEPOT_TOOLS/$SCRIPT" "$@" - fi + exec "$DEPOT_TOOLS/$SCRIPT" "$@" fi