From 2f5f0b7a99c9df653b090e3ef00d13a2cab00a8d Mon Sep 17 00:00:00 2001 From: Dan Jacques Date: Mon, 29 May 2017 09:33:48 -0700 Subject: [PATCH] [.bat] Remove "depot_tools" override. Currently, all ".bat" entry points use "~dp0python" to ensure that the Python that is used to execute the tool is the one in depot_tools. This prevents any sort of system override. Remove this override so that PATH solely determines which Python is used. To accommodate users who invoked these tools without Python on the PATH, we still still add "depot_tools" as a catch-all PATH suffix. Some tools were also not using DOS-style line endings. This CL fixes this. BUG=chromium:714293, chromium:724902 TEST=None Change-Id: I06e9583a668c767196a2a335547aded868f2a2b5 Reviewed-on: https://chromium-review.googlesource.com/517236 Commit-Queue: Daniel Jacques Reviewed-by: Robbie Iannucci Reviewed-by: Marc-Antoine Ruel --- apply_issue.bat | 6 +++++- cit.bat | 20 ++++++++++++-------- clang-format.bat | 6 +++++- clang_format_merge_driver.bat | 20 ++++++++++++-------- commit_queue.bat | 6 +++++- cpplint.bat | 7 +++++++ depot-tools-auth.bat | 6 +++++- download_from_google_storage.bat | 7 ++++++- fetch.bat | 6 +++++- gclient.bat | 6 +++++- gn.bat | 6 +++++- roll-dep-svn.bat | 19 ++++++++++++------- roll-dep.bat | 7 ++++++- 13 files changed, 90 insertions(+), 32 deletions(-) diff --git a/apply_issue.bat b/apply_issue.bat index 2a035062b3..30bc306bcf 100755 --- a/apply_issue.bat +++ b/apply_issue.bat @@ -4,5 +4,9 @@ :: found in the LICENSE file. setlocal +:: Ensure that "depot_tools" is somewhere in PATH so this tool can be used +:: standalone, but allow other PATH manipulations to take priority. +set PATH=%PATH%;%~dp0 + :: Defer control. -%~dp0python "%~dp0\apply_issue.py" %* +python "%~dp0\apply_issue.py" %* diff --git a/cit.bat b/cit.bat index 8f79044aaf..82919b936d 100755 --- a/cit.bat +++ b/cit.bat @@ -1,8 +1,12 @@ -@echo off -:: Copyright (c) 2015 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. -setlocal - -:: Defer control. -%~dp0python "%~dp0\cit.py" %* +@echo off +:: Copyright (c) 2015 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. +setlocal + +:: Ensure that "depot_tools" is somewhere in PATH so this tool can be used +:: standalone, but allow other PATH manipulations to take priority. +set PATH=%PATH%;%~dp0 + +:: Defer control. +python "%~dp0\cit.py" %* diff --git a/clang-format.bat b/clang-format.bat index 884cd246a3..c3bb53bc44 100644 --- a/clang-format.bat +++ b/clang-format.bat @@ -4,5 +4,9 @@ :: found in the LICENSE file. setlocal +:: Ensure that "depot_tools" is somewhere in PATH so this tool can be used +:: standalone, but allow other PATH manipulations to take priority. +set PATH=%PATH%;%~dp0 + :: Defer control. -%~dp0python "%~dp0\clang_format.py" %* +python "%~dp0\clang_format.py" %* diff --git a/clang_format_merge_driver.bat b/clang_format_merge_driver.bat index 6f15dd749c..8e614b492d 100755 --- a/clang_format_merge_driver.bat +++ b/clang_format_merge_driver.bat @@ -1,8 +1,12 @@ -@echo off -:: Copyright 2016 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. -setlocal - -:: Defer control. -%~dp0python "%~dp0\clang_format_merge_driver.py" %* +@echo off +:: Copyright 2016 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. +setlocal + +:: Ensure that "depot_tools" is somewhere in PATH so this tool can be used +:: standalone, but allow other PATH manipulations to take priority. +set PATH=%PATH%;%~dp0 + +:: Defer control. +python "%~dp0\clang_format_merge_driver.py" %* diff --git a/commit_queue.bat b/commit_queue.bat index c1babf04cf..44639a64d8 100755 --- a/commit_queue.bat +++ b/commit_queue.bat @@ -4,5 +4,9 @@ :: found in the LICENSE file. setlocal +:: Ensure that "depot_tools" is somewhere in PATH so this tool can be used +:: standalone, but allow other PATH manipulations to take priority. +set PATH=%PATH%;%~dp0 + :: Defer control. -%~dp0python "%~dp0\commit_queue.py" %* +python "%~dp0\commit_queue.py" %* diff --git a/cpplint.bat b/cpplint.bat index 914eecf1a7..30faf8bbbf 100644 --- a/cpplint.bat +++ b/cpplint.bat @@ -1,4 +1,11 @@ @echo off +:: Copyright 2016 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. setlocal +:: Ensure that "depot_tools" is somewhere in PATH so this tool can be used +:: standalone, but allow other PATH manipulations to take priority. +set PATH=%PATH%;%~dp0 + call python "%~dp0cpplint.py" %* diff --git a/depot-tools-auth.bat b/depot-tools-auth.bat index 4770ed6fb4..37280b765f 100644 --- a/depot-tools-auth.bat +++ b/depot-tools-auth.bat @@ -4,5 +4,9 @@ :: found in the LICENSE file. setlocal +:: Ensure that "depot_tools" is somewhere in PATH so this tool can be used +:: standalone, but allow other PATH manipulations to take priority. +set PATH=%PATH%;%~dp0 + :: Defer control. -%~dp0python "%~dp0\depot-tools-auth.py" %* +python "%~dp0\depot-tools-auth.py" %* diff --git a/download_from_google_storage.bat b/download_from_google_storage.bat index 4c7971b426..f1f2d21616 100755 --- a/download_from_google_storage.bat +++ b/download_from_google_storage.bat @@ -2,6 +2,11 @@ :: Copyright (c) 2012 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. +setlocal + +:: Ensure that "depot_tools" is somewhere in PATH so this tool can be used +:: standalone, but allow other PATH manipulations to take priority. +set PATH=%PATH%;%~dp0 :: Defer control. -%~dp0python "%~dp0\download_from_google_storage.py" %* +python "%~dp0\download_from_google_storage.py" %* diff --git a/fetch.bat b/fetch.bat index d6ea944e26..5f8019a19d 100755 --- a/fetch.bat +++ b/fetch.bat @@ -7,5 +7,9 @@ setlocal :: Synchronize the root directory before deferring control back to gclient.py. call "%~dp0\update_depot_tools.bat" +:: Ensure that "depot_tools" is somewhere in PATH so this tool can be used +:: standalone, but allow other PATH manipulations to take priority. +set PATH=%PATH%;%~dp0 + :: Defer control. -%~dp0python "%~dp0\fetch.py" %* +python "%~dp0\fetch.py" %* diff --git a/gclient.bat b/gclient.bat index d66ce6a41a..3d2fe2627e 100755 --- a/gclient.bat +++ b/gclient.bat @@ -7,5 +7,9 @@ setlocal :: Synchronize the root directory before deferring control back to gclient.py. call "%~dp0update_depot_tools.bat" %* +:: Ensure that "depot_tools" is somewhere in PATH so this tool can be used +:: standalone, but allow other PATH manipulations to take priority. +set PATH=%PATH%;%~dp0 + :: Defer control. -"%~dp0python" "%~dp0gclient.py" %* +"python" "%~dp0gclient.py" %* diff --git a/gn.bat b/gn.bat index 0a42a0766e..9eb6b56a1f 100644 --- a/gn.bat +++ b/gn.bat @@ -4,5 +4,9 @@ :: found in the LICENSE file. setlocal +:: Ensure that "depot_tools" is somewhere in PATH so this tool can be used +:: standalone, but allow other PATH manipulations to take priority. +set PATH=%PATH%;%~dp0 + :: Defer control. -%~dp0python "%~dp0\gn.py" %* +python "%~dp0\gn.py" %* diff --git a/roll-dep-svn.bat b/roll-dep-svn.bat index b2aec795e8..6ff5db78f1 100755 --- a/roll-dep-svn.bat +++ b/roll-dep-svn.bat @@ -1,7 +1,12 @@ -@echo off -:: Copyright (c) 2012 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. - -:: Defer control. -%~dp0python "%~dp0\roll_dep_svn.py" %* +@echo off +:: Copyright (c) 2012 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. +setlocal + +:: Ensure that "depot_tools" is somewhere in PATH so this tool can be used +:: standalone, but allow other PATH manipulations to take priority. +set PATH=%PATH%;%~dp0 + +:: Defer control. +python "%~dp0\roll_dep_svn.py" %* diff --git a/roll-dep.bat b/roll-dep.bat index d5166dfa8b..c49c88dc51 100755 --- a/roll-dep.bat +++ b/roll-dep.bat @@ -2,6 +2,11 @@ :: Copyright (c) 2012 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. +setlocal + +:: Ensure that "depot_tools" is somewhere in PATH so this tool can be used +:: standalone, but allow other PATH manipulations to take priority. +set PATH=%PATH%;%~dp0 :: Defer control. -%~dp0python "%~dp0\roll_dep.py" %* +python "%~dp0\roll_dep.py" %*