OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 |
| 6 # This script runs all of the hooks specified in DEPS in order. |
| 7 |
| 8 import os |
| 9 import subprocess |
| 10 import sys |
| 11 |
| 12 scope = {} |
| 13 |
| 14 def Var(key): |
| 15 return scope["vars"][key] |
| 16 |
| 17 scope["Var"] = Var |
| 18 |
| 19 def main(args): |
| 20 gclient_path = os.path.abspath(os.path.join(os.path.dirname(__file__), |
| 21 os.pardir, os.pardir)) |
| 22 deps_path = os.path.join(gclient_path, "src", "DEPS") |
| 23 with open(deps_path) as deps_contents: |
| 24 d = deps_contents.read() |
| 25 exec(d, scope) |
| 26 env = os.environ |
| 27 # Some hooks expect depot_tools to be in the PATH already so add the default |
| 28 # location of depot_tools in a standard checkout to the environment the hooks |
| 29 # run in. |
| 30 default_depot_tools_path = os.path.abspath(os.path.join(gclient_path, |
| 31 "depot_tools")) |
| 32 env["PATH"] += os.pathsep + default_depot_tools_path |
| 33 for hook in scope["hooks"]: |
| 34 name = hook["name"] |
| 35 print "________ running '%s' in '%s'" % (" ".join(hook["action"]), |
| 36 gclient_path) |
| 37 subprocess.check_call(hook["action"], cwd=gclient_path, env=env) |
| 38 print |
| 39 return 0 |
| 40 |
| 41 if __name__ == '__main__': |
| 42 sys.exit(main(sys.argv[1:])) |
OLD | NEW |