From 50289c267b7af0a14b29b0365a47792dd360bed8 Mon Sep 17 00:00:00 2001 From: "akuegel@chromium.org" Date: Wed, 28 Oct 2015 15:41:25 +0000 Subject: [PATCH] Revert of Generalize python_git_runner for use in non-git scripts. (patchset #1 id:1 of https://codereview.chromium.org/1415993003/ ) Reason for revert: Speculative revert in case this caused the bots to fail bot_update. Original issue's description: > Generalize python_git_runner for use in non-git scripts. > > Also fixes an msys (git-bash) incompatibility, similar to the one > fixed in crrev.com/4845f0ed694ff071da5f6ee937a0bce2ea4e6fd2. > > This change doesn't actually use the wrapper in any new places, but > subsequent changes will be made to use it in places where > 'exec python' is called directly, like gclient and fetch. > > BUG=411518 > R=iannucci@google.com > > Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=297357 TBR=iannucci@google.com,iannucci@chromium.org,mmoss@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=411518 Review URL: https://codereview.chromium.org/1414923008 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@297358 0039d316-1c4b-4281-b951-d872f2087c98 --- git-auto-svn | 2 +- git-cache | 2 +- git-cherry-pick-upload | 2 +- git-cl | 2 +- git-drover | 2 +- git-find-releases | 2 +- git-footers | 2 +- git-freeze | 2 +- git-map | 2 +- git-map-branches | 2 +- git-mark-merge-base | 2 +- git-nav-downstream | 2 +- git-new-branch | 2 +- git-number | 2 +- git-rebase-update | 2 +- git-rename-branch | 2 +- git-reparent-branch | 2 +- git-retry | 2 +- git-squash-branch | 2 +- git-thaw | 2 +- git-try | 2 +- git-upstream-diff | 2 +- python_runner.sh => python_git_runner.sh | 22 +++++++++++----------- 23 files changed, 33 insertions(+), 33 deletions(-) rename python_runner.sh => python_git_runner.sh (60%) diff --git a/git-auto-svn b/git-auto-svn index 6b1a88a79..6a079620f 100755 --- a/git-auto-svn +++ b/git-auto-svn @@ -3,4 +3,4 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -. $(type -P python_runner.sh) +. $(type -P python_git_runner.sh) diff --git a/git-cache b/git-cache index 6b1a88a79..6a079620f 100755 --- a/git-cache +++ b/git-cache @@ -3,4 +3,4 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -. $(type -P python_runner.sh) +. $(type -P python_git_runner.sh) diff --git a/git-cherry-pick-upload b/git-cherry-pick-upload index 6b1a88a79..6a079620f 100755 --- a/git-cherry-pick-upload +++ b/git-cherry-pick-upload @@ -3,4 +3,4 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -. $(type -P python_runner.sh) +. $(type -P python_git_runner.sh) diff --git a/git-cl b/git-cl index 935365f97..12b19e30f 100755 --- a/git-cl +++ b/git-cl @@ -3,4 +3,4 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -. $(type -P python_runner.sh) +. $(type -P python_git_runner.sh) diff --git a/git-drover b/git-drover index 817b6b8dc..ff4eba7a3 100755 --- a/git-drover +++ b/git-drover @@ -3,4 +3,4 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -. $(type -P python_runner.sh) +. $(type -P python_git_runner.sh) diff --git a/git-find-releases b/git-find-releases index 6b1a88a79..6a079620f 100755 --- a/git-find-releases +++ b/git-find-releases @@ -3,4 +3,4 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -. $(type -P python_runner.sh) +. $(type -P python_git_runner.sh) diff --git a/git-footers b/git-footers index 6b1a88a79..6a079620f 100755 --- a/git-footers +++ b/git-footers @@ -3,4 +3,4 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -. $(type -P python_runner.sh) +. $(type -P python_git_runner.sh) diff --git a/git-freeze b/git-freeze index ffba0cbe7..5e485bb28 100755 --- a/git-freeze +++ b/git-freeze @@ -5,4 +5,4 @@ SCRIPT=git_freezer.py set -- freeze "$@" -. $(type -P python_runner.sh) +. $(type -P python_git_runner.sh) diff --git a/git-map b/git-map index 21cffeabb..03e8418ed 100755 --- a/git-map +++ b/git-map @@ -3,4 +3,4 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -. $(type -P python_runner.sh) | less -R +. $(type -P python_git_runner.sh) | less -R diff --git a/git-map-branches b/git-map-branches index 6b1a88a79..6a079620f 100755 --- a/git-map-branches +++ b/git-map-branches @@ -3,4 +3,4 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -. $(type -P python_runner.sh) +. $(type -P python_git_runner.sh) diff --git a/git-mark-merge-base b/git-mark-merge-base index 6b1a88a79..6a079620f 100755 --- a/git-mark-merge-base +++ b/git-mark-merge-base @@ -3,4 +3,4 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -. $(type -P python_runner.sh) +. $(type -P python_git_runner.sh) diff --git a/git-nav-downstream b/git-nav-downstream index 6b1a88a79..6a079620f 100755 --- a/git-nav-downstream +++ b/git-nav-downstream @@ -3,4 +3,4 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -. $(type -P python_runner.sh) +. $(type -P python_git_runner.sh) diff --git a/git-new-branch b/git-new-branch index 6b1a88a79..6a079620f 100755 --- a/git-new-branch +++ b/git-new-branch @@ -3,4 +3,4 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -. $(type -P python_runner.sh) +. $(type -P python_git_runner.sh) diff --git a/git-number b/git-number index 2b9c996d7..a5037a438 100755 --- a/git-number +++ b/git-number @@ -3,4 +3,4 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -. $(type -P python_runner.sh) +. $(type -P python_git_runner.sh) diff --git a/git-rebase-update b/git-rebase-update index 6b1a88a79..6a079620f 100755 --- a/git-rebase-update +++ b/git-rebase-update @@ -3,4 +3,4 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -. $(type -P python_runner.sh) +. $(type -P python_git_runner.sh) diff --git a/git-rename-branch b/git-rename-branch index 6b1a88a79..6a079620f 100755 --- a/git-rename-branch +++ b/git-rename-branch @@ -3,4 +3,4 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -. $(type -P python_runner.sh) +. $(type -P python_git_runner.sh) diff --git a/git-reparent-branch b/git-reparent-branch index 6b1a88a79..6a079620f 100755 --- a/git-reparent-branch +++ b/git-reparent-branch @@ -3,4 +3,4 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -. $(type -P python_runner.sh) +. $(type -P python_git_runner.sh) diff --git a/git-retry b/git-retry index 014743a6a..beb0976d3 100755 --- a/git-retry +++ b/git-retry @@ -5,4 +5,4 @@ SCRIPT=git_retry.py set -- retry "$@" -. $(type -P python_runner.sh) +. $(type -P python_git_runner.sh) diff --git a/git-squash-branch b/git-squash-branch index 6b1a88a79..6a079620f 100755 --- a/git-squash-branch +++ b/git-squash-branch @@ -3,4 +3,4 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -. $(type -P python_runner.sh) +. $(type -P python_git_runner.sh) diff --git a/git-thaw b/git-thaw index 8f6a4e364..74716f1ce 100755 --- a/git-thaw +++ b/git-thaw @@ -10,4 +10,4 @@ SCRIPT=git_freezer.py set -- thaw "$@" -. $(type -P python_runner.sh) +. $(type -P python_git_runner.sh) diff --git a/git-try b/git-try index f847754af..63c7d56fd 100755 --- a/git-try +++ b/git-try @@ -6,4 +6,4 @@ # git_try.py - Commits a patch to the SVN try patch repo. # It is highly recommended to use `git cl try` instead. -. $(type -P python_runner.sh) +. $(type -P python_git_runner.sh) diff --git a/git-upstream-diff b/git-upstream-diff index ba16876d0..7d44073e9 100755 --- a/git-upstream-diff +++ b/git-upstream-diff @@ -6,4 +6,4 @@ # git_upstream_diff.py -- Provide the diff between the current branch and its # upstream. -. $(type -P python_runner.sh) +. $(type -P python_git_runner.sh) diff --git a/python_runner.sh b/python_git_runner.sh similarity index 60% rename from python_runner.sh rename to python_git_runner.sh index fc21bd75f..2dbda0aad 100755 --- a/python_runner.sh +++ b/python_git_runner.sh @@ -1,14 +1,14 @@ -# Copyright 2015 The Chromium Authors. All rights reserved. +# 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 file is designed to be sourced from a bash script whose name takes the -## form 'command-name'. This script will then instead invoke -## '[depot_tools]/command_name.py' correctly under mingw as well +## form 'git-sub-command'. This script will then instead invoke +## '[depot_tools]/git_sub_command.py' correctly under mingw as well ## as posix-ey systems, passing along all other command line flags. ## Example: -## echo ". python_runner.sh" > git-foo-command +## echo ". python_git_runner.sh" > git-foo-command ## ./git-foo-command #=> runs `python git_foo_command.py` ## Constants @@ -19,14 +19,14 @@ PYTHONDONTWRITEBYTECODE=1 # # SCRIPT defaults to the basename of $0, with dashes replaced with underscores -DEPOT_TOOLS="${0%/*}" -# Sometimes commands will run with no path (e.g. a git command run from within -# the depot_tools dir itself). In that case, treat it like it was run like: -# "./command" -if [[ "$DEPOT_TOOLS" = "$0" ]]; then - DEPOT_TOOLS="." +if [[ $OSTYPE = msys ]] +then + DEPOT_TOOLS="${0%\\*}" + BASENAME="${0##*\\}" +else + DEPOT_TOOLS="${0%/*}" + BASENAME="${0##*/}" fi -BASENAME="${0##*/}" SCRIPT="${SCRIPT-${BASENAME//-/_}.py}" if [[ -e "$DEPOT_TOOLS/python.bat" && $OSTYPE = msys ]]; then