Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: tools/run_hooks.py

Issue 1760353002: Make tools/run_hooks.py work when depot_tools is not in PATH (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
print
return 0
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698