From 3b1e64245a0b29d8352d28a3c442482bcb5f2889 Mon Sep 17 00:00:00 2001 From: John Budorick Date: Wed, 13 Feb 2019 22:06:19 +0000 Subject: [PATCH] presubmit: use depot_tools.on_path rather than a handrolled equivalent. Noticed this while attempting to debug issues with the src-internal-presubmit builder. Not sure if this is the cause but would like to at least rule it out. Bug: 925774 Recipe-Nontrivial-Roll: build Recipe-Nontrivial-Roll: build_limited_scripts_slave Recipe-Nontrivial-Roll: release_scripts Change-Id: I323f49e23d2c8af11b374e22ebfbcf5bcd836ba3 Reviewed-on: https://chromium-review.googlesource.com/c/1464049 Commit-Queue: John Budorick Reviewed-by: Robbie Iannucci --- recipes/README.recipes.md | 2 +- recipes/recipe_modules/presubmit/__init__.py | 1 + recipes/recipe_modules/presubmit/api.py | 7 +------ .../presubmit/examples/full.expected/basic.json | 6 ++++-- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/recipes/README.recipes.md b/recipes/README.recipes.md index 807beee25..7aca8c7ac 100644 --- a/recipes/README.recipes.md +++ b/recipes/README.recipes.md @@ -723,7 +723,7 @@ Raises: StepFailure or InfraFailure. ### *recipe_modules* / [presubmit](/recipes/recipe_modules/presubmit) -[DEPS](/recipes/recipe_modules/presubmit/__init__.py#1): [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/python][recipe_engine/recipe_modules/python], [recipe\_engine/step][recipe_engine/recipe_modules/step] +[DEPS](/recipes/recipe_modules/presubmit/__init__.py#1): [depot\_tools](#recipe_modules-depot_tools), [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/python][recipe_engine/recipe_modules/python], [recipe\_engine/step][recipe_engine/recipe_modules/step] #### **class [PresubmitApi](/recipes/recipe_modules/presubmit/api.py#7)([RecipeApi][recipe_engine/wkt/RecipeApi]):** diff --git a/recipes/recipe_modules/presubmit/__init__.py b/recipes/recipe_modules/presubmit/__init__.py index 0f3dc6ecf..9c8bf20c7 100644 --- a/recipes/recipe_modules/presubmit/__init__.py +++ b/recipes/recipe_modules/presubmit/__init__.py @@ -1,4 +1,5 @@ DEPS = [ + 'depot_tools', 'recipe_engine/context', 'recipe_engine/path', 'recipe_engine/python', diff --git a/recipes/recipe_modules/presubmit/api.py b/recipes/recipe_modules/presubmit/api.py index 9db783b05..4bff17796 100644 --- a/recipes/recipe_modules/presubmit/api.py +++ b/recipes/recipe_modules/presubmit/api.py @@ -14,11 +14,6 @@ class PresubmitApi(recipe_api.RecipeApi): name = kwargs.pop('name', 'presubmit') - env = self.m.context.env - env.setdefault('PATH', '%(PATH)s') - env['PATH'] = self.m.path.pathsep.join([ - env['PATH'], str(self._module.PACKAGE_REPO_ROOT)]) - - with self.m.context(env=env): + with self.m.depot_tools.on_path(): return self.m.python( name, self.presubmit_support_path, list(args), **kwargs) diff --git a/recipes/recipe_modules/presubmit/examples/full.expected/basic.json b/recipes/recipe_modules/presubmit/examples/full.expected/basic.json index 90c281e89..273c2cacd 100644 --- a/recipes/recipe_modules/presubmit/examples/full.expected/basic.json +++ b/recipes/recipe_modules/presubmit/examples/full.expected/basic.json @@ -5,8 +5,10 @@ "-u", "RECIPE_PACKAGE_REPO[depot_tools]/presubmit_support.py" ], - "env": { - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "name": "presubmit" },