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

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: always append path and absolutify it 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..45f0c41569d31622721eca109943d6dafca0abc0 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 so add the default
+ # location of depot_tools in a standard checkout to the environment the hooks
+ # run in.
+ default_depot_tools_path = os.path.abspath(os.path.join(gclient_path,
+ "depot_tools"))
+ env["PATH"] = env["PATH"] + ":" + default_depot_tools_path
viettrungluu 2016/03/04 20:46:09 += ? (Also, I'd suggest os.pathsep instead of ":"
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