From df01c5ad5be408cd157b879a1cce983f90762765 Mon Sep 17 00:00:00 2001 From: Josip Sokcevic Date: Fri, 4 Feb 2022 00:54:41 +0000 Subject: [PATCH] Invoke git_setup with py3 The script is already py3 compatible. Bug: 1289280 Recipe-Nontrivial-Roll: build Recipe-Nontrivial-Roll: build_limited Recipe-Nontrivial-Roll: chrome_release Recipe-Nontrivial-Roll: infra Change-Id: I2dfd202fcb7981e5129a777424f7f730f8f33998 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3438328 Reviewed-by: Gavin Mak Commit-Queue: Josip Sokcevic --- recipes/README.recipes.md | 14 +++++++------- recipes/recipe_modules/git/api.py | 5 ++--- .../git/examples/full.expected/basic.json | 2 +- .../git/examples/full.expected/basic_branch.json | 2 +- .../examples/full.expected/basic_file_name.json | 2 +- .../git/examples/full.expected/basic_hash.json | 2 +- .../git/examples/full.expected/basic_ref.json | 2 +- .../basic_submodule_update_force.json | 2 +- .../git/examples/full.expected/basic_tags.json | 2 +- .../git/examples/full.expected/can_fail_build.json | 2 +- .../examples/full.expected/cannot_fail_build.json | 2 +- .../git/examples/full.expected/cat-file_test.json | 2 +- .../full.expected/count-objects_delta.json | 2 +- .../full.expected/count-objects_failed.json | 2 +- .../count-objects_with_bad_output.json | 2 +- .../count-objects_with_bad_output_fails_build.json | 2 +- .../examples/full.expected/curl_trace_file.json | 2 +- .../examples/full.expected/git-cache-checkout.json | 2 +- .../examples/full.expected/new_branch_failed.json | 4 ++-- .../git/examples/full.expected/platform_win.json | 2 +- .../git/examples/full.expected/rebase_failed.json | 2 +- .../examples/full.expected/remote_not_origin.json | 2 +- .../examples/full.expected/set_got_revision.json | 2 +- recipes/recipe_modules/git/resources/git_setup.py | 2 +- 24 files changed, 32 insertions(+), 33 deletions(-) diff --git a/recipes/README.recipes.md b/recipes/README.recipes.md index 590b07d0f..f8a4a616a 100644 --- a/recipes/README.recipes.md +++ b/recipes/README.recipes.md @@ -384,7 +384,7 @@ PYTHON_VERSION_COMPATIBILITY: PY2+3 Returns a git command step. -— **def [bundle\_create](/recipes/recipe_modules/git/api.py#383)(self, bundle_path, rev_list_args=None, \*\*kwargs):** +— **def [bundle\_create](/recipes/recipe_modules/git/api.py#382)(self, bundle_path, rev_list_args=None, \*\*kwargs):** Runs 'git bundle create' on a Git repository. @@ -437,7 +437,7 @@ Args: Returns: If the checkout was successful, this returns the commit hash of the checked-out-repo. Otherwise this returns None. -— **def [config\_get](/recipes/recipe_modules/git/api.py#352)(self, prop_name, \*\*kwargs):** +— **def [config\_get](/recipes/recipe_modules/git/api.py#351)(self, prop_name, \*\*kwargs):** Returns git config output. @@ -464,7 +464,7 @@ Returns: Fetches all tags from the remote. -— **def [get\_remote\_url](/recipes/recipe_modules/git/api.py#371)(self, remote_name=None, \*\*kwargs):** +— **def [get\_remote\_url](/recipes/recipe_modules/git/api.py#370)(self, remote_name=None, \*\*kwargs):** Returns the remote Git repository URL, or None. @@ -474,11 +474,11 @@ Args: Returns: (str) The URL of the remote Git repository, or None. -— **def [get\_timestamp](/recipes/recipe_modules/git/api.py#323)(self, commit='HEAD', test_data=None, \*\*kwargs):** +— **def [get\_timestamp](/recipes/recipe_modules/git/api.py#322)(self, commit='HEAD', test_data=None, \*\*kwargs):** Find and return the timestamp of the given commit. -— **def [new\_branch](/recipes/recipe_modules/git/api.py#396)(self, branch, name=None, upstream=None, upstream_current=False, \*\*kwargs):** +— **def [new\_branch](/recipes/recipe_modules/git/api.py#395)(self, branch, name=None, upstream=None, upstream_current=False, \*\*kwargs):** Runs git new-branch on a Git repository, to be used before git cl upload. @@ -490,7 +490,7 @@ Args: * upstream_current (bool): whether to use '--upstream_current'. * kwargs: Forwarded to '__call__'. -— **def [number](/recipes/recipe_modules/git/api.py#427)(self, commitrefs=None, test_values=None):** +— **def [number](/recipes/recipe_modules/git/api.py#426)(self, commitrefs=None, test_values=None):** Computes the generation number of some commits. @@ -507,7 +507,7 @@ A list of strings containing the generation numbers of the commits. If non-empty commitrefs was provided, the order of the returned numbers will correspond to the order of the provided commitrefs. -— **def [rebase](/recipes/recipe_modules/git/api.py#332)(self, name_prefix, branch, dir_path, remote_name=None, \*\*kwargs):** +— **def [rebase](/recipes/recipe_modules/git/api.py#331)(self, name_prefix, branch, dir_path, remote_name=None, \*\*kwargs):** Runs rebase HEAD onto branch diff --git a/recipes/recipe_modules/git/api.py b/recipes/recipe_modules/git/api.py index 605e59b14..a29c8a5a8 100644 --- a/recipes/recipe_modules/git/api.py +++ b/recipes/recipe_modules/git/api.py @@ -186,10 +186,9 @@ class GitApi(recipe_api.RecipeApi): remote_name = 'origin' step_suffix = '' if step_suffix is None else ' (%s)' % step_suffix - self.m.python( + self.m.step( 'git setup%s' % step_suffix, - self.resource('git_setup.py'), - git_setup_args) + ['python3', '-u', self.resource('git_setup.py')] + git_setup_args) # Some of the commands below require depot_tools to be in PATH. path = self.m.path.pathsep.join([ diff --git a/recipes/recipe_modules/git/examples/full.expected/basic.json b/recipes/recipe_modules/git/examples/full.expected/basic.json index 6a022e63e..b3512b30c 100644 --- a/recipes/recipe_modules/git/examples/full.expected/basic.json +++ b/recipes/recipe_modules/git/examples/full.expected/basic.json @@ -1,7 +1,7 @@ [ { "cmd": [ - "python", + "python3", "-u", "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py", "--path", diff --git a/recipes/recipe_modules/git/examples/full.expected/basic_branch.json b/recipes/recipe_modules/git/examples/full.expected/basic_branch.json index c1d41627d..1b63209e8 100644 --- a/recipes/recipe_modules/git/examples/full.expected/basic_branch.json +++ b/recipes/recipe_modules/git/examples/full.expected/basic_branch.json @@ -1,7 +1,7 @@ [ { "cmd": [ - "python", + "python3", "-u", "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py", "--path", diff --git a/recipes/recipe_modules/git/examples/full.expected/basic_file_name.json b/recipes/recipe_modules/git/examples/full.expected/basic_file_name.json index 4eabc537e..4404a99f5 100644 --- a/recipes/recipe_modules/git/examples/full.expected/basic_file_name.json +++ b/recipes/recipe_modules/git/examples/full.expected/basic_file_name.json @@ -1,7 +1,7 @@ [ { "cmd": [ - "python", + "python3", "-u", "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py", "--path", diff --git a/recipes/recipe_modules/git/examples/full.expected/basic_hash.json b/recipes/recipe_modules/git/examples/full.expected/basic_hash.json index 8a6b804ca..bf22b7c09 100644 --- a/recipes/recipe_modules/git/examples/full.expected/basic_hash.json +++ b/recipes/recipe_modules/git/examples/full.expected/basic_hash.json @@ -1,7 +1,7 @@ [ { "cmd": [ - "python", + "python3", "-u", "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py", "--path", diff --git a/recipes/recipe_modules/git/examples/full.expected/basic_ref.json b/recipes/recipe_modules/git/examples/full.expected/basic_ref.json index 025c6b616..a68b85ae1 100644 --- a/recipes/recipe_modules/git/examples/full.expected/basic_ref.json +++ b/recipes/recipe_modules/git/examples/full.expected/basic_ref.json @@ -1,7 +1,7 @@ [ { "cmd": [ - "python", + "python3", "-u", "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py", "--path", diff --git a/recipes/recipe_modules/git/examples/full.expected/basic_submodule_update_force.json b/recipes/recipe_modules/git/examples/full.expected/basic_submodule_update_force.json index c72256fc0..a481b2c9c 100644 --- a/recipes/recipe_modules/git/examples/full.expected/basic_submodule_update_force.json +++ b/recipes/recipe_modules/git/examples/full.expected/basic_submodule_update_force.json @@ -1,7 +1,7 @@ [ { "cmd": [ - "python", + "python3", "-u", "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py", "--path", diff --git a/recipes/recipe_modules/git/examples/full.expected/basic_tags.json b/recipes/recipe_modules/git/examples/full.expected/basic_tags.json index b2926d733..521a75f0e 100644 --- a/recipes/recipe_modules/git/examples/full.expected/basic_tags.json +++ b/recipes/recipe_modules/git/examples/full.expected/basic_tags.json @@ -1,7 +1,7 @@ [ { "cmd": [ - "python", + "python3", "-u", "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py", "--path", diff --git a/recipes/recipe_modules/git/examples/full.expected/can_fail_build.json b/recipes/recipe_modules/git/examples/full.expected/can_fail_build.json index d1172b7f3..443629d78 100644 --- a/recipes/recipe_modules/git/examples/full.expected/can_fail_build.json +++ b/recipes/recipe_modules/git/examples/full.expected/can_fail_build.json @@ -1,7 +1,7 @@ [ { "cmd": [ - "python", + "python3", "-u", "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py", "--path", diff --git a/recipes/recipe_modules/git/examples/full.expected/cannot_fail_build.json b/recipes/recipe_modules/git/examples/full.expected/cannot_fail_build.json index 6d335830b..f7a4a252d 100644 --- a/recipes/recipe_modules/git/examples/full.expected/cannot_fail_build.json +++ b/recipes/recipe_modules/git/examples/full.expected/cannot_fail_build.json @@ -1,7 +1,7 @@ [ { "cmd": [ - "python", + "python3", "-u", "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py", "--path", diff --git a/recipes/recipe_modules/git/examples/full.expected/cat-file_test.json b/recipes/recipe_modules/git/examples/full.expected/cat-file_test.json index 7825e3f0d..47541d261 100644 --- a/recipes/recipe_modules/git/examples/full.expected/cat-file_test.json +++ b/recipes/recipe_modules/git/examples/full.expected/cat-file_test.json @@ -1,7 +1,7 @@ [ { "cmd": [ - "python", + "python3", "-u", "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py", "--path", diff --git a/recipes/recipe_modules/git/examples/full.expected/count-objects_delta.json b/recipes/recipe_modules/git/examples/full.expected/count-objects_delta.json index f42ff3aab..8d2f37409 100644 --- a/recipes/recipe_modules/git/examples/full.expected/count-objects_delta.json +++ b/recipes/recipe_modules/git/examples/full.expected/count-objects_delta.json @@ -1,7 +1,7 @@ [ { "cmd": [ - "python", + "python3", "-u", "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py", "--path", diff --git a/recipes/recipe_modules/git/examples/full.expected/count-objects_failed.json b/recipes/recipe_modules/git/examples/full.expected/count-objects_failed.json index 812c6fae0..5bd88892d 100644 --- a/recipes/recipe_modules/git/examples/full.expected/count-objects_failed.json +++ b/recipes/recipe_modules/git/examples/full.expected/count-objects_failed.json @@ -1,7 +1,7 @@ [ { "cmd": [ - "python", + "python3", "-u", "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py", "--path", diff --git a/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output.json b/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output.json index a89fa076b..4a73b43e1 100644 --- a/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output.json +++ b/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output.json @@ -1,7 +1,7 @@ [ { "cmd": [ - "python", + "python3", "-u", "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py", "--path", diff --git a/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output_fails_build.json b/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output_fails_build.json index 1f6635a5a..f1b351c7b 100644 --- a/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output_fails_build.json +++ b/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output_fails_build.json @@ -1,7 +1,7 @@ [ { "cmd": [ - "python", + "python3", "-u", "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py", "--path", diff --git a/recipes/recipe_modules/git/examples/full.expected/curl_trace_file.json b/recipes/recipe_modules/git/examples/full.expected/curl_trace_file.json index f017f64a6..d91b6e9e3 100644 --- a/recipes/recipe_modules/git/examples/full.expected/curl_trace_file.json +++ b/recipes/recipe_modules/git/examples/full.expected/curl_trace_file.json @@ -1,7 +1,7 @@ [ { "cmd": [ - "python", + "python3", "-u", "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py", "--path", diff --git a/recipes/recipe_modules/git/examples/full.expected/git-cache-checkout.json b/recipes/recipe_modules/git/examples/full.expected/git-cache-checkout.json index bd52292cb..f44e62516 100644 --- a/recipes/recipe_modules/git/examples/full.expected/git-cache-checkout.json +++ b/recipes/recipe_modules/git/examples/full.expected/git-cache-checkout.json @@ -1,7 +1,7 @@ [ { "cmd": [ - "python", + "python3", "-u", "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py", "--path", diff --git a/recipes/recipe_modules/git/examples/full.expected/new_branch_failed.json b/recipes/recipe_modules/git/examples/full.expected/new_branch_failed.json index 7ed7aa3ee..09be91141 100644 --- a/recipes/recipe_modules/git/examples/full.expected/new_branch_failed.json +++ b/recipes/recipe_modules/git/examples/full.expected/new_branch_failed.json @@ -1,7 +1,7 @@ [ { "cmd": [ - "python", + "python3", "-u", "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py", "--path", @@ -184,7 +184,7 @@ "Traceback (most recent call last):", " File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/git/examples/full.py\", line 81, in RunSteps", " api.git.new_branch('failed_new_branch', upstream='will_fail', upstream_current=True) #pylint: disable = line-too-long", - " File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/git/api.py\", line 413, in new_branch", + " File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/git/api.py\", line 412, in new_branch", " raise ValueError('Can not define both upstream and upstream_current')", "ValueError('Can not define both upstream and upstream_current')" ] diff --git a/recipes/recipe_modules/git/examples/full.expected/platform_win.json b/recipes/recipe_modules/git/examples/full.expected/platform_win.json index b8a3e5235..40c7c41e9 100644 --- a/recipes/recipe_modules/git/examples/full.expected/platform_win.json +++ b/recipes/recipe_modules/git/examples/full.expected/platform_win.json @@ -1,7 +1,7 @@ [ { "cmd": [ - "python", + "python3", "-u", "RECIPE_MODULE[depot_tools::git]\\resources\\git_setup.py", "--path", diff --git a/recipes/recipe_modules/git/examples/full.expected/rebase_failed.json b/recipes/recipe_modules/git/examples/full.expected/rebase_failed.json index ff83b4585..16937980f 100644 --- a/recipes/recipe_modules/git/examples/full.expected/rebase_failed.json +++ b/recipes/recipe_modules/git/examples/full.expected/rebase_failed.json @@ -1,7 +1,7 @@ [ { "cmd": [ - "python", + "python3", "-u", "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py", "--path", diff --git a/recipes/recipe_modules/git/examples/full.expected/remote_not_origin.json b/recipes/recipe_modules/git/examples/full.expected/remote_not_origin.json index f05334816..e7248bed1 100644 --- a/recipes/recipe_modules/git/examples/full.expected/remote_not_origin.json +++ b/recipes/recipe_modules/git/examples/full.expected/remote_not_origin.json @@ -1,7 +1,7 @@ [ { "cmd": [ - "python", + "python3", "-u", "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py", "--path", diff --git a/recipes/recipe_modules/git/examples/full.expected/set_got_revision.json b/recipes/recipe_modules/git/examples/full.expected/set_got_revision.json index cc19b5b9e..6c1b8d49f 100644 --- a/recipes/recipe_modules/git/examples/full.expected/set_got_revision.json +++ b/recipes/recipe_modules/git/examples/full.expected/set_got_revision.json @@ -1,7 +1,7 @@ [ { "cmd": [ - "python", + "python3", "-u", "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py", "--path", diff --git a/recipes/recipe_modules/git/resources/git_setup.py b/recipes/recipe_modules/git/resources/git_setup.py index 6d7e3e1ab..81bee6767 100755 --- a/recipes/recipe_modules/git/resources/git_setup.py +++ b/recipes/recipe_modules/git/resources/git_setup.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2013 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.