OLD | NEW |
(Empty) | |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import sys |
| 6 import os |
| 7 import subprocess |
| 8 |
| 9 SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) |
| 10 BUILD = os.path.abspath(os.path.join(SCRIPT_DIR, '..', '..')) |
| 11 |
| 12 def main(argv): |
| 13 path = os.environ.get('PYTHONPATH', '') |
| 14 path = path.split(':') |
| 15 def add(new_path): |
| 16 if new_path not in path: |
| 17 path.append(new_path) |
| 18 |
| 19 third_party = os.path.join(BUILD, 'third_party') |
| 20 for d in os.listdir(third_party): |
| 21 full = os.path.join(third_party, d) |
| 22 if os.path.isdir(full): |
| 23 add(full) |
| 24 add(os.path.join(BUILD, 'scripts')) |
| 25 add(third_party) |
| 26 add(os.path.join(BUILD, 'site_config')) |
| 27 add(os.path.join(BUILD, '..', 'build_internal', 'site_config')) |
| 28 add('.') |
| 29 os.environ['PYTHONPATH'] = os.pathsep.join(path) |
| 30 print 'Set PYTHONPATH: %s' % os.environ['PYTHONPATH'] |
| 31 |
| 32 # Use subprocess instead of execv because otherwise windows destroys quoting. |
| 33 p = subprocess.Popen(argv[1:]) |
| 34 p.wait() |
| 35 return p.returncode |
| 36 |
| 37 |
| 38 if __name__ == '__main__': |
| 39 sys.exit(main(sys.argv)) |
OLD | NEW |