From cb1beaa79fbeb9f480a9838480f846ed4e0ea19f Mon Sep 17 00:00:00 2001 From: Nodir Turakulov Date: Wed, 16 Nov 2016 21:05:41 -0800 Subject: [PATCH] deprecate depot_tools path Use depot_tools module's methods or package_repo_resource function to determine paths of tools that live in depot_tools R=iannucci@chromium.org, martiniss@chromium.org BUG=662586 Change-Id: Ic3172308c140f7f19e982ec6ec5a4b1b83261e1b Reviewed-on: https://chromium-review.googlesource.com/411936 Reviewed-by: Erik Staab Reviewed-by: Robbie Iannucci Commit-Queue: Nodir Turakulov --- recipe_modules/bot_update/example.py | 2 +- recipe_modules/depot_tools/api.py | 4 ++++ recipe_modules/depot_tools/example.expected/basic.json | 7 +++++++ recipe_modules/depot_tools/example.expected/win.json | 7 +++++++ recipe_modules/depot_tools/example.py | 3 +++ recipe_modules/gclient/api.py | 5 +++-- recipe_modules/rietveld/api.py | 4 ++-- recipe_modules/rietveld/example.expected/basic.json | 2 +- .../tryserver/example.expected/with_rietveld_patch.json | 2 +- .../example.expected/with_rietveld_patch_new.json | 2 +- 10 files changed, 30 insertions(+), 8 deletions(-) diff --git a/recipe_modules/bot_update/example.py b/recipe_modules/bot_update/example.py index fb8d6ba9e..9f86e41ed 100644 --- a/recipe_modules/bot_update/example.py +++ b/recipe_modules/bot_update/example.py @@ -5,8 +5,8 @@ DEPS = [ 'bot_update', 'gclient', - 'recipe_engine/platform', 'recipe_engine/path', + 'recipe_engine/platform', 'recipe_engine/properties', ] diff --git a/recipe_modules/depot_tools/api.py b/recipe_modules/depot_tools/api.py index 6b41e63d9..9d03ed48d 100644 --- a/recipe_modules/depot_tools/api.py +++ b/recipe_modules/depot_tools/api.py @@ -31,3 +31,7 @@ class DepotToolsApi(recipe_api.RecipeApi): def ninja_path(self): ninja_exe = 'ninja.exe' if self.m.platform.is_win else 'ninja' return self.package_repo_resource(ninja_exe) + + @property + def presubmit_support_py_path(self): + return self.package_repo_resource('presubmit_support.py') diff --git a/recipe_modules/depot_tools/example.expected/basic.json b/recipe_modules/depot_tools/example.expected/basic.json index c9e6befcc..954d9ab10 100644 --- a/recipe_modules/depot_tools/example.expected/basic.json +++ b/recipe_modules/depot_tools/example.expected/basic.json @@ -41,6 +41,13 @@ ], "name": "ninja_path" }, + { + "cmd": [ + "ls", + "RECIPE_PACKAGE_REPO[depot_tools]/presubmit_support.py" + ], + "name": "presubmit_support_py_path" + }, { "name": "$result", "recipe_result": null, diff --git a/recipe_modules/depot_tools/example.expected/win.json b/recipe_modules/depot_tools/example.expected/win.json index 6856c9122..ce6e12d92 100644 --- a/recipe_modules/depot_tools/example.expected/win.json +++ b/recipe_modules/depot_tools/example.expected/win.json @@ -41,6 +41,13 @@ ], "name": "ninja_path" }, + { + "cmd": [ + "ls", + "RECIPE_PACKAGE_REPO[depot_tools]\\presubmit_support.py" + ], + "name": "presubmit_support_py_path" + }, { "name": "$result", "recipe_result": null, diff --git a/recipe_modules/depot_tools/example.py b/recipe_modules/depot_tools/example.py index 10bdac1af..b867d5115 100644 --- a/recipe_modules/depot_tools/example.py +++ b/recipe_modules/depot_tools/example.py @@ -30,6 +30,9 @@ def RunSteps(api): api.step( 'ninja_path', ['ls', api.depot_tools.ninja_path]) + api.step( + 'presubmit_support_py_path', + ['ls', api.depot_tools.presubmit_support_py_path]) def GenTests(api): diff --git a/recipe_modules/gclient/api.py b/recipe_modules/gclient/api.py index 3338168bf..6cd99a60c 100644 --- a/recipe_modules/gclient/api.py +++ b/recipe_modules/gclient/api.py @@ -251,10 +251,11 @@ class GclientApi(recipe_api.RecipeApi): alias = self.spec_alias prefix = '%sgclient ' % (('[spec: %s] ' % alias) if alias else '') + gclient_path = self.package_repo_resource( + 'gclient.bat' if self.m.platform.is_win else 'gclient') return self.m.python(prefix + 'revert', self.m.path['build'].join('scripts', 'slave', 'gclient_safe_revert.py'), - ['.', self.m.path['depot_tools'].join('gclient', - platform_ext={'win': '.bat'})], + ['.', gclient_path], infra_step=True, **kwargs ) diff --git a/recipe_modules/rietveld/api.py b/recipe_modules/rietveld/api.py index b52ec0bc9..e563b18d6 100644 --- a/recipe_modules/rietveld/api.py +++ b/recipe_modules/rietveld/api.py @@ -67,7 +67,7 @@ class RietveldApi(recipe_api.RecipeApi): if authentication == 'oauth2': step_result = self.m.python( 'apply_issue', - self.m.path['depot_tools'].join('apply_issue.py'), [ + self.package_repo_resource('apply_issue.py'), [ '-r', self.m.path['checkout'].join(*root_pieces), '-i', issue_number, '-p', self.m.properties['patchset'], @@ -82,7 +82,7 @@ class RietveldApi(recipe_api.RecipeApi): else: step_result = self.m.python( 'apply_issue', - self.m.path['depot_tools'].join('apply_issue.py'), [ + self.package_repo_resource('apply_issue.py'), [ '-r', self.m.path['checkout'].join(*root_pieces), '-i', issue_number, '-p', self.m.properties['patchset'], diff --git a/recipe_modules/rietveld/example.expected/basic.json b/recipe_modules/rietveld/example.expected/basic.json index 8382a0111..0999dbca0 100644 --- a/recipe_modules/rietveld/example.expected/basic.json +++ b/recipe_modules/rietveld/example.expected/basic.json @@ -3,7 +3,7 @@ "cmd": [ "python", "-u", - "[DEPOT_TOOLS]/apply_issue.py", + "RECIPE_PACKAGE_REPO[depot_tools]/apply_issue.py", "-r", "[START_DIR]/foo/bar", "-i", diff --git a/recipe_modules/tryserver/example.expected/with_rietveld_patch.json b/recipe_modules/tryserver/example.expected/with_rietveld_patch.json index 45a0b6924..a10c036e0 100644 --- a/recipe_modules/tryserver/example.expected/with_rietveld_patch.json +++ b/recipe_modules/tryserver/example.expected/with_rietveld_patch.json @@ -3,7 +3,7 @@ "cmd": [ "python", "-u", - "[DEPOT_TOOLS]/apply_issue.py", + "RECIPE_PACKAGE_REPO[depot_tools]/apply_issue.py", "-r", "[START_DIR]", "-i", diff --git a/recipe_modules/tryserver/example.expected/with_rietveld_patch_new.json b/recipe_modules/tryserver/example.expected/with_rietveld_patch_new.json index 92729f6d6..0b6400ef5 100644 --- a/recipe_modules/tryserver/example.expected/with_rietveld_patch_new.json +++ b/recipe_modules/tryserver/example.expected/with_rietveld_patch_new.json @@ -3,7 +3,7 @@ "cmd": [ "python", "-u", - "[DEPOT_TOOLS]/apply_issue.py", + "RECIPE_PACKAGE_REPO[depot_tools]/apply_issue.py", "-r", "[START_DIR]", "-i",