Chromium Code Reviews| Index: tools/run_hooks.py |
| diff --git a/tools/run_hooks.py b/tools/run_hooks.py |
| index 478391bbca482d5da9ea42424dff8001cfe40577..ed9671d32e884b35b0d78080221f4936108cd50f 100755 |
| --- a/tools/run_hooks.py |
| +++ b/tools/run_hooks.py |
| @@ -23,11 +23,18 @@ def main(args): |
| with open(deps_path) as deps_contents: |
| d = deps_contents.read() |
| exec(d, scope) |
| + env = os.environ |
| + # Some hooks expect depot_tools to be in the PATH already. If there is no |
| + # depot_tools in the current environment's PATH add the default location of |
| + # depot_tools in a standard checkout to the environment the hooks run in. |
| + if env["PATH"].find("depot_tools") == -1: |
|
lanechr
2016/03/04 17:35:41
why not just add the default_depot_tools_path to t
|
| + default_depot_tools_path = os.path.join(gclient_path, "depot_tools") |
| + env["PATH"] = env["PATH"] + ":" + default_depot_tools_path |
| for hook in scope["hooks"]: |
| name = hook["name"] |
| print "________ running '%s' in '%s'" % (" ".join(hook["action"]), |
| gclient_path) |
| - subprocess.check_call(hook["action"], cwd=gclient_path) |
| + subprocess.check_call(hook["action"], cwd=gclient_path, env=env) |
| return 0 |