Browse Source

Reland "Reland "use python3 for goma related scripts""

This reverts commit fc3fb20e514c4360b8f27ab9b8124bffcc362ae3.

Reason for revert: Previous versions of this changed used %scriptdir% in
goma_ctl.bat and goma_auth.bat but never defined it. This eluded manual
testing because these scripts would work properly as long as they were
run from the depot_tools directory, but would fail when run from
elsewhere.

The fix to make this reland work can be found by comparing patchset 1 to
patchset 3.

Original change's description:
> Revert "Reland "use python3 for goma related scripts""
>
> This reverts commit 2a6dffaf4bc5eae2f76b6e56704b63fbcda92c55.
>
> Reason for revert: with this change in depot_tools when I run "goma_ctl ensure_start" from cmd.exe I get
> "The system cannot find the path specified."
>
> Original change's description:
> > Reland "use python3 for goma related scripts"
> >
> > This reverts commit 59140d436ad033ba607ad33e52c2abcd240dbf34.
> >
> > Reason for revert:
> > Make this works in git bash.
> >
> > Original change's description:
> > > Revert "use python3 for goma related scripts"
> > >
> > > This reverts commit 138ec7c56df78e18fd4f00e2289613aee2de8b95.
> > >
> > > Reason for revert:
> > > This might have caused the following issue:
> > > https://bugs.chromium.org/p/chromium/issues/detail?id=1221233
> > >
> > > Original change's description:
> > > > use python3 for goma related scripts
> > > >
> > > > This uses python3 like autoninja{,.bat}.
> > > > https://source.chromium.org/chromium/chromium/tools/depot_tools/+/main:autoninja
> > > > https://source.chromium.org/chromium/chromium/tools/depot_tools/+/main:autoninja.bat
> > > >
> > > > Change-Id: I4daf1892024358c5b7d88b1e32b15c82cb4411d2
> > > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2968069
> > > > Commit-Queue: Dirk Pranke <dpranke@google.com>
> > > > Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
> > > > Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@google.com>
> > > > Reviewed-by: Dirk Pranke <dpranke@google.com>
> > >
> > > Change-Id: Ideb5004cf18c91c1404066622244a8527f5248f3
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2972023
> > > Auto-Submit: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
> > > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> > > Commit-Queue: Dirk Pranke <dpranke@google.com>
> > > Reviewed-by: Dirk Pranke <dpranke@google.com>
> >
> > Bug: 1221233
> > Change-Id: I815a774faa2e4fbca0f262667ea89709a09e146b
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2979560
> > Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
> > Reviewed-by: Allen Bauer <kylixrd@chromium.org>
> > Reviewed-by: Dirk Pranke <dpranke@google.com>
> > Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
> > Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
>
> Bug: 1221233
> Change-Id: I5050b9199f3076e6d6f812b8bac01e8cd1dc53bf
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2992150
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Reviewed-by: Dirk Pranke <dpranke@google.com>
> Commit-Queue: Bruce Dawson <brucedawson@chromium.org>

Bug: 1221233
Change-Id: I50412a5ea62f1607660cb7a7ab8851251c3dfe91
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2992151
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Bruce Dawson 4 years ago
parent
commit
a806594b95
4 changed files with 20 additions and 4 deletions
  1. 7 1
      goma_auth
  2. 3 1
      goma_auth.bat
  3. 7 1
      goma_ctl
  4. 3 1
      goma_ctl.bat

+ 7 - 1
goma_auth

@@ -6,9 +6,15 @@
 
 
 # See revert instructions in cipd_manifest.txt
 # See revert instructions in cipd_manifest.txt
 
 
+# In git bash on Windows, invoke the batch file.
+if [ "$(expr "$(uname -s)" : "^MINGW64_NT")" == "10" ]; then
+    goma_auth.bat "$@"
+    exit
+fi
+
 MYPATH=$(dirname "${BASH_SOURCE[0]}")
 MYPATH=$(dirname "${BASH_SOURCE[0]}")
 
 
 source "$MYPATH/cipd_bin_setup.sh"
 source "$MYPATH/cipd_bin_setup.sh"
 cipd_bin_setup &> /dev/null
 cipd_bin_setup &> /dev/null
 
 
-PYTHONDONTWRITEBYTECODE=1 exec python "$MYPATH/.cipd_bin/goma_auth.py" "$@"
+PYTHONDONTWRITEBYTECODE=1 exec python3 "$MYPATH/.cipd_bin/goma_auth.py" "$@"

+ 3 - 1
goma_auth.bat

@@ -5,6 +5,8 @@
 
 
 :: See revert instructions in cipd_manifest.txt
 :: See revert instructions in cipd_manifest.txt
 
 
+set scriptdir=%~dp0
+
 @call "%~dp0\cipd_bin_setup.bat" > nul 2>&1
 @call "%~dp0\cipd_bin_setup.bat" > nul 2>&1
-@call python.bat %~dp0\.cipd_bin\goma_auth.py %*
+@call %scriptdir%python-bin\python3.bat %~dp0\.cipd_bin\goma_auth.py %*
 exit /b
 exit /b

+ 7 - 1
goma_ctl

@@ -6,9 +6,15 @@
 
 
 # See revert instructions in cipd_manifest.txt
 # See revert instructions in cipd_manifest.txt
 
 
+# In git bash on Windows, invoke the batch file.
+if [ "$(expr "$(uname -s)" : "^MINGW64_NT")" == "10" ]; then
+    goma_ctl.bat "$@"
+    exit
+fi
+
 MYPATH=$(dirname "${BASH_SOURCE[0]}")
 MYPATH=$(dirname "${BASH_SOURCE[0]}")
 
 
 source "$MYPATH/cipd_bin_setup.sh"
 source "$MYPATH/cipd_bin_setup.sh"
 cipd_bin_setup &> /dev/null
 cipd_bin_setup &> /dev/null
 
 
-PYTHONDONTWRITEBYTECODE=1 exec python "$MYPATH/.cipd_bin/goma_ctl.py" "$@"
+PYTHONDONTWRITEBYTECODE=1 exec python3 "$MYPATH/.cipd_bin/goma_ctl.py" "$@"

+ 3 - 1
goma_ctl.bat

@@ -5,6 +5,8 @@
 
 
 :: See revert instructions in cipd_manifest.txt
 :: See revert instructions in cipd_manifest.txt
 
 
+set scriptdir=%~dp0
+
 @call "%~dp0\cipd_bin_setup.bat" > nul 2>&1
 @call "%~dp0\cipd_bin_setup.bat" > nul 2>&1
-@call vpython.bat %~dp0\.cipd_bin\goma_ctl.py %*
+@call %scriptdir%python-bin\python3.bat %~dp0\.cipd_bin\goma_ctl.py %*
 exit /b
 exit /b