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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 if not args: | 78 if not args: |
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 # Windows must call python as the subprocess executable. | |
89 if 'win' in sys.platform.lower(): | |
dnj
2015/02/12 00:55:22
The best way to check for Windows is probably
http
David Yen
2015/02/12 17:17:40
Only to be less intrusive, you're right that is is
| |
90 args = [sys.executable] + args | |
91 | |
88 # Use subprocess instead of execv because otherwise windows destroys quoting. | 92 # Use subprocess instead of execv because otherwise windows destroys quoting. |
89 p = subprocess.Popen(args) | 93 p = subprocess.Popen(args) |
90 p.wait() | 94 p.wait() |
91 return p.returncode | 95 return p.returncode |
92 | 96 |
93 | 97 |
94 if __name__ == '__main__': | 98 if __name__ == '__main__': |
95 sys.exit(main()) | 99 sys.exit(main()) |
OLD | NEW |