From 166ac05c0306bf223826c5a505d18ee5586daee0 Mon Sep 17 00:00:00 2001 From: "phajdan.jr@chromium.org" Date: Mon, 6 Jun 2016 12:13:30 +0000 Subject: [PATCH] depot_tools: expose paths to presubmit_support.py and upload_to_google_storage.py They're needed by infra recipes (https://codereview.chromium.org/2045493002). BUG=617565 Review-Url: https://codereview.chromium.org/2045473002 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@300695 0039d316-1c4b-4281-b951-d872f2087c98 --- 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 | 4 ++++ recipe_modules/presubmit/api.py | 7 +++++-- 5 files changed, 27 insertions(+), 2 deletions(-) diff --git a/recipe_modules/depot_tools/api.py b/recipe_modules/depot_tools/api.py index 53b7a2243..68b2bbdf2 100644 --- a/recipe_modules/depot_tools/api.py +++ b/recipe_modules/depot_tools/api.py @@ -9,6 +9,10 @@ class DepotToolsApi(recipe_api.RecipeApi): def download_from_google_storage_path(self): return self.package_repo_resource('download_from_google_storage.py') + @property + def upload_to_google_storage_path(self): + return self.package_repo_resource('upload_to_google_storage.py') + @property def cros_path(self): return self.package_repo_resource('cros') diff --git a/recipe_modules/depot_tools/example.expected/basic.json b/recipe_modules/depot_tools/example.expected/basic.json index e8ad01fe6..c9e6befcc 100644 --- a/recipe_modules/depot_tools/example.expected/basic.json +++ b/recipe_modules/depot_tools/example.expected/basic.json @@ -6,6 +6,13 @@ ], "name": "download_from_google_storage" }, + { + "cmd": [ + "ls", + "RECIPE_PACKAGE_REPO[depot_tools]/upload_to_google_storage.py" + ], + "name": "upload_to_google_storage" + }, { "cmd": [ "ls", diff --git a/recipe_modules/depot_tools/example.expected/win.json b/recipe_modules/depot_tools/example.expected/win.json index 3c47a3257..6856c9122 100644 --- a/recipe_modules/depot_tools/example.expected/win.json +++ b/recipe_modules/depot_tools/example.expected/win.json @@ -6,6 +6,13 @@ ], "name": "download_from_google_storage" }, + { + "cmd": [ + "ls", + "RECIPE_PACKAGE_REPO[depot_tools]\\upload_to_google_storage.py" + ], + "name": "upload_to_google_storage" + }, { "cmd": [ "ls", diff --git a/recipe_modules/depot_tools/example.py b/recipe_modules/depot_tools/example.py index e61785f10..10bdac1af 100644 --- a/recipe_modules/depot_tools/example.py +++ b/recipe_modules/depot_tools/example.py @@ -15,6 +15,10 @@ def RunSteps(api): 'download_from_google_storage', ['ls', api.depot_tools.download_from_google_storage_path]) + api.step( + 'upload_to_google_storage', + ['ls', api.depot_tools.upload_to_google_storage_path]) + api.step('cros', ['ls', api.depot_tools.cros_path]) api.step( diff --git a/recipe_modules/presubmit/api.py b/recipe_modules/presubmit/api.py index 1ecf12986..31fe1d976 100644 --- a/recipe_modules/presubmit/api.py +++ b/recipe_modules/presubmit/api.py @@ -5,6 +5,10 @@ from recipe_engine import recipe_api class PresubmitApi(recipe_api.RecipeApi): + @property + def presubmit_support_path(self): + return self.package_repo_resource('presubmit_support.py') + def __call__(self, *args, **kwargs): """Return a presubmit step.""" @@ -16,5 +20,4 @@ class PresubmitApi(recipe_api.RecipeApi): kwargs['env']['PATH'], str(self._module.PACKAGE_REPO_ROOT)]) return self.m.python( - name, self.package_repo_resource('presubmit_support.py'), list(args), - **kwargs) + name, self.presubmit_support_path, list(args), **kwargs)