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

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

Issue 1151423002: Move recipe engine to third_party/recipe_engine. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Moved field_composer_test with its buddies Created 5 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « scripts/slave/unittests/recipe_simulation_test.py ('k') | scripts/tools/show_me_the_modules.py » ('j') | 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`
11 or (in scripts/slave): `../common/runit.py runtest.py --help` 11 or (in scripts/slave): `../common/runit.py runtest.py --help`
12 """ 12 """
13 13
14 import optparse 14 import optparse
15 import os 15 import os
16 import subprocess 16 import subprocess
17 import sys 17 import sys
18 18
19 # Import 'common.env' to load our Infra PYTHONPATH 19 # Import 'common.env' to load our Infra PYTHONPATH
20 sys.path.insert(0, os.path.join( 20 sys.path.insert(0, os.path.join(
21 os.path.dirname(os.path.realpath(__file__)), os.pardir)) 21 os.path.dirname(os.path.realpath(__file__)), os.pardir))
22 import common.env 22 import common.env
23 23
24 USAGE = '%s [options] <command to run>' % os.path.basename(sys.argv[0]) 24 USAGE = '%s [options] <command to run>' % os.path.basename(sys.argv[0])
25 25
26 # These third_party libs interfere with other imports in PYTHONPATH and should
27 # be put last. Please file bugs to clean up each entry here.
28 troublemakers = []
29
30 26
31 def main(): 27 def main():
32 option_parser = optparse.OptionParser(usage=USAGE) 28 option_parser = optparse.OptionParser(usage=USAGE)
33 option_parser.add_option('-s', '--show-path', action='store_true', 29 option_parser.add_option('-s', '--show-path', action='store_true',
34 help='display new PYTHONPATH before running command') 30 help='display new PYTHONPATH before running command')
35 option_parser.disable_interspersed_args() 31 option_parser.disable_interspersed_args()
36 options, args = option_parser.parse_args() 32 options, args = option_parser.parse_args()
37 if not args: 33 if not args:
38 option_parser.error('Must provide a command to run.') 34 option_parser.error('Must provide a command to run.')
39 35
40 # If the first argument is 'python', replace it with the system executable. 36 # If the first argument is 'python', replace it with the system executable.
41 if args[0] == 'python': 37 if args[0] == 'python':
42 args[0] = sys.executable 38 args[0] = sys.executable
43 39
44 with common.env.GetInfraPythonPath().Enter(): 40 with common.env.GetInfraPythonPath().Enter():
45 if options.show_path: 41 if options.show_path:
46 print 'Set PYTHONPATH: %s' % os.environ['PYTHONPATH'] 42 print 'Set PYTHONPATH: %s' % os.environ['PYTHONPATH']
47 # Use subprocess instead of execv because otherwise windows destroys 43 # Use subprocess instead of execv because otherwise windows destroys
48 # quoting. 44 # quoting.
49 p = subprocess.Popen(args) 45 p = subprocess.Popen(args)
50 p.wait() 46 p.wait()
51 return p.returncode 47 return p.returncode
52 48
53 49
54 if __name__ == '__main__': 50 if __name__ == '__main__':
55 sys.exit(main()) 51 sys.exit(main())
OLDNEW
« no previous file with comments | « scripts/slave/unittests/recipe_simulation_test.py ('k') | scripts/tools/show_me_the_modules.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698