| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Runs a command with PYTHONPATH set up for the Chromium build setup. | 6 """Runs a command with PYTHONPATH set up for the Chromium build setup. |
| 7 | 7 |
| 8 This is helpful for running scripts locally on a development machine. | 8 This is helpful for running scripts locally on a development machine. |
| 9 | 9 |
| 10 Try `scripts/common/runit.py python` | 10 Try `scripts/common/runit.py python` |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 option_parser.error('Must provide a command to run.') | 79 option_parser.error('Must provide a command to run.') |
| 80 | 80 |
| 81 path = os.environ.get('PYTHONPATH', '').split(os.pathsep) | 81 path = os.environ.get('PYTHONPATH', '').split(os.pathsep) |
| 82 add_build_paths(path) | 82 add_build_paths(path) |
| 83 os.environ['PYTHONPATH'] = os.pathsep.join(path) | 83 os.environ['PYTHONPATH'] = os.pathsep.join(path) |
| 84 | 84 |
| 85 if options.show_path: | 85 if options.show_path: |
| 86 print 'Set PYTHONPATH: %s' % os.environ['PYTHONPATH'] | 86 print 'Set PYTHONPATH: %s' % os.environ['PYTHONPATH'] |
| 87 | 87 |
| 88 # Use subprocess instead of execv because otherwise windows destroys quoting. | 88 # Use subprocess instead of execv because otherwise windows destroys quoting. |
| 89 p = subprocess.Popen(args) | 89 p = subprocess.Popen([sys.executable] + args) |
| 90 p.wait() | 90 p.wait() |
| 91 return p.returncode | 91 return p.returncode |
| 92 | 92 |
| 93 | 93 |
| 94 if __name__ == '__main__': | 94 if __name__ == '__main__': |
| 95 sys.exit(main()) | 95 sys.exit(main()) |
| OLD | NEW |