1#!/usr/bin/env python 2# Copyright (c) 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 6import os 7import sys 8 9_CATAPULT_PATH = os.path.abspath( 10 os.path.join(os.path.dirname(__file__), '..', '..', '..')) 11 12_PY_UTILS_PATH = os.path.abspath( 13 os.path.join(_CATAPULT_PATH, 'common', 'py_utils')) 14 15 16def _RunTestsOrDie(top_level_dir): 17 exit_code = run_with_typ.Run(top_level_dir, path=[_PY_UTILS_PATH]) 18 if exit_code: 19 sys.exit(exit_code) 20 21 22def _AddToPathIfNeeded(path): 23 if path not in sys.path: 24 sys.path.insert(0, path) 25 26 27if __name__ == '__main__': 28 _AddToPathIfNeeded(_CATAPULT_PATH) 29 30 from hooks import install 31 if '--no-install-hooks' in sys.argv: 32 sys.argv.remove('--no-install-hooks') 33 else: 34 install.InstallHooks() 35 36 from catapult_build import run_with_typ 37 _RunTestsOrDie(_PY_UTILS_PATH) 38 sys.exit(0) 39