Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: scripts/tools/runit.py

Issue 914303007: Fix runit.py script on windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698