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

Unified Diff: tools/run_hooks.py

Issue 1577373002: Add script to run gclient hooks for jiri (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 11 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
new file mode 100755
index 0000000000000000000000000000000000000000..b301e9c6c930e6403b65f0df0613299cc49790a2
--- /dev/null
+++ b/tools/run_hooks.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This script runs all of the hooks specified in DEPS in order.
+
+import os
+import subprocess
+import sys
+
+scope = {}
+
+def Var(key):
+ return scope["vars"][key]
+
+scope["Var"] = Var
+
+def main(args):
+ gclient_path = os.path.abspath(os.path.join(os.path.dirname(__file__),
+ os.pardir, os.pardir))
+ deps_path = os.path.join(gclient_path, "src", "DEPS")
+ with open(deps_path) as deps_contents:
+ d = deps_contents.read()
+ exec(d, scope)
+ 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)
+ print
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))
viettrungluu 2016/01/12 23:09:00 nit: If you're going to do this, |main()| should p
« 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