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

Unified Diff: tools/run_hooks.py

Issue 1841863002: Update monet. (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: Created 4 years, 9 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 | « tools/resources/about_credits_entry.tmpl ('k') | tools/sort-headers.py » ('j') | 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..52e27a0e30fed9ba2644cd4bd79e2ff1285f8666
--- /dev/null
+++ b/tools/run_hooks.py
@@ -0,0 +1,42 @@
+#!/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)
+ 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"] += os.pathsep + 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, env=env)
+ print
+ return 0
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))
« no previous file with comments | « tools/resources/about_credits_entry.tmpl ('k') | tools/sort-headers.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698