OLD | NEW |
1 #!/usr/bin/python -u | 1 #!/usr/bin/python -u |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 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 """This allows easy execution of a recipe (scripts/slave/recipes, etc.) | 6 """This allows easy execution of a recipe (scripts/slave/recipes, etc.) |
7 without buildbot. | 7 without buildbot. |
8 | 8 |
9 This is currently useful for testing recipes locally while developing them. | 9 This is currently useful for testing recipes locally while developing them. |
10 | 10 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 | 105 |
106 def get_properties_from_file(filename): | 106 def get_properties_from_file(filename): |
107 properties_file = sys.stdin if filename == '-' else open(filename) | 107 properties_file = sys.stdin if filename == '-' else open(filename) |
108 return ast.literal_eval(properties_file.read()) | 108 return ast.literal_eval(properties_file.read()) |
109 | 109 |
110 | 110 |
111 def main(args): | 111 def main(args): |
112 """Gets the recipe name and properties and runs an annotated run.""" | 112 """Gets the recipe name and properties and runs an annotated run.""" |
113 properties, master_overrides_slave = parse_args(args) | 113 properties, master_overrides_slave = parse_args(args) |
114 properties.setdefault('use_mirror', False) | |
115 | 114 |
116 if not os.path.exists(SLAVE_DIR): | 115 if not os.path.exists(SLAVE_DIR): |
117 os.makedirs(SLAVE_DIR) | 116 os.makedirs(SLAVE_DIR) |
118 | 117 |
119 env = os.environ.copy() | 118 env = os.environ.copy() |
120 env['RUN_SLAVE_UPDATED_SCRIPTS'] = '1' | 119 env['RUN_SLAVE_UPDATED_SCRIPTS'] = '1' |
121 env['PYTHONUNBUFFERED'] = '1' | 120 env['PYTHONUNBUFFERED'] = '1' |
122 env['PYTHONIOENCODING'] = 'UTF-8' | 121 env['PYTHONIOENCODING'] = 'UTF-8' |
123 | 122 |
124 cmd = ['python', '-u', RUNIT, 'python', '-u', ANNOTATED_RUN, | 123 cmd = ['python', '-u', RUNIT, 'python', '-u', ANNOTATED_RUN, |
125 '--keep-stdin', # so that pdb works for local execution | 124 '--keep-stdin', # so that pdb works for local execution |
126 '--factory-properties', json.dumps(properties), | 125 '--factory-properties', json.dumps(properties), |
127 '--build-properties', json.dumps(properties)] | 126 '--build-properties', json.dumps(properties)] |
128 | 127 |
129 if master_overrides_slave: | 128 if master_overrides_slave: |
130 cmd.append('--master-overrides-slave') | 129 cmd.append('--master-overrides-slave') |
131 | 130 |
132 return subprocess.call(cmd, cwd=SLAVE_DIR, env=env) | 131 return subprocess.call(cmd, cwd=SLAVE_DIR, env=env) |
133 | 132 |
134 | 133 |
135 if __name__ == '__main__': | 134 if __name__ == '__main__': |
136 sys.exit(main(sys.argv[1:])) | 135 sys.exit(main(sys.argv[1:])) |
OLD | NEW |