Chromium Code Reviews| 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) |
| + |
| +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
|