OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 """ | 3 """ |
4 Copyright 2013 Google Inc. | 4 Copyright 2013 Google Inc. |
5 | 5 |
6 Use of this source code is governed by a BSD-style license that can be | 6 Use of this source code is governed by a BSD-style license that can be |
7 found in the LICENSE file. | 7 found in the LICENSE file. |
8 | 8 |
9 Repackage expected/actual GM results as needed by our HTML rebaseline viewer. | 9 Repackage expected/actual GM results as needed by our HTML rebaseline viewer. |
10 """ | 10 """ |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 for dirpath, dirnames, filenames in os.walk(root): | 231 for dirpath, dirnames, filenames in os.walk(root): |
232 for matching_filename in fnmatch.filter(filenames, pattern): | 232 for matching_filename in fnmatch.filter(filenames, pattern): |
233 builder = os.path.basename(dirpath) | 233 builder = os.path.basename(dirpath) |
234 # We should never encounter Trybot *expectations*, but if we are | 234 # We should never encounter Trybot *expectations*, but if we are |
235 # writing into the actual-results dir, skip the Trybot actuals. | 235 # writing into the actual-results dir, skip the Trybot actuals. |
236 # (I don't know why we would ever write into the actual-results dir, | 236 # (I don't know why we would ever write into the actual-results dir, |
237 # though.) | 237 # though.) |
238 if builder.endswith('-Trybot'): | 238 if builder.endswith('-Trybot'): |
239 continue | 239 continue |
240 per_builder_dict = meta_dict.get(builder) | 240 per_builder_dict = meta_dict.get(builder) |
241 if per_builder_dict: | 241 if per_builder_dict is not None: |
242 fullpath = os.path.join(dirpath, matching_filename) | 242 fullpath = os.path.join(dirpath, matching_filename) |
243 gm_json.WriteToFile(per_builder_dict, fullpath) | 243 gm_json.WriteToFile(per_builder_dict, fullpath) |
244 actual_builders_written.append(builder) | 244 actual_builders_written.append(builder) |
245 | 245 |
246 # Check: did we write out the set of per-builder dictionaries we | 246 # Check: did we write out the set of per-builder dictionaries we |
247 # expected to? | 247 # expected to? |
248 expected_builders_written = sorted(meta_dict.keys()) | 248 expected_builders_written = sorted(meta_dict.keys()) |
249 actual_builders_written.sort() | 249 actual_builders_written.sort() |
250 if expected_builders_written != actual_builders_written: | 250 if expected_builders_written != actual_builders_written: |
251 raise KeyError( | 251 raise KeyError( |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 category_dict: category dict-of-dicts to modify | 476 category_dict: category dict-of-dicts to modify |
477 category_name: category name, as a string | 477 category_name: category name, as a string |
478 category_values: list of values we want to make sure are represented | 478 category_values: list of values we want to make sure are represented |
479 for this category | 479 for this category |
480 """ | 480 """ |
481 if not category_dict.get(category_name): | 481 if not category_dict.get(category_name): |
482 category_dict[category_name] = {} | 482 category_dict[category_name] = {} |
483 for category_value in category_values: | 483 for category_value in category_values: |
484 if not category_dict[category_name].get(category_value): | 484 if not category_dict[category_name].get(category_value): |
485 category_dict[category_name][category_value] = 0 | 485 category_dict[category_name][category_value] = 0 |
OLD | NEW |