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 | 9 |
10 ''' | 10 ''' |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 be raised. | 75 be raised. |
76 | 76 |
77 Any tests for which we have no expectations will be left out of the | 77 Any tests for which we have no expectations will be left out of the |
78 returned dictionary. | 78 returned dictionary. |
79 """ | 79 """ |
80 result_dict = {} | 80 result_dict = {} |
81 json_dict = gm_json.LoadFromString(contents) | 81 json_dict = gm_json.LoadFromString(contents) |
82 all_expectations = json_dict[gm_json.JSONKEY_EXPECTEDRESULTS] | 82 all_expectations = json_dict[gm_json.JSONKEY_EXPECTEDRESULTS] |
83 | 83 |
84 # Prevent https://code.google.com/p/skia/issues/detail?id=1588 | 84 # Prevent https://code.google.com/p/skia/issues/detail?id=1588 |
85 # ('svndiff.py: 'NoneType' object has no attribute 'keys'') | |
86 if not all_expectations: | 85 if not all_expectations: |
87 return result_dict | 86 return result_dict |
88 | 87 |
89 for test_name in all_expectations.keys(): | 88 for test_name in all_expectations.keys(): |
90 test_expectations = all_expectations[test_name] | 89 test_expectations = all_expectations[test_name] |
91 allowed_digests = test_expectations[ | 90 allowed_digests = test_expectations[ |
92 gm_json.JSONKEY_EXPECTEDRESULTS_ALLOWEDDIGESTS] | 91 gm_json.JSONKEY_EXPECTEDRESULTS_ALLOWEDDIGESTS] |
93 if allowed_digests: | 92 if allowed_digests: |
94 num_allowed_digests = len(allowed_digests) | 93 num_allowed_digests = len(allowed_digests) |
95 if num_allowed_digests > 1: | 94 if num_allowed_digests > 1: |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 'ACTUAL results from the "old" JSON file. This can be a ' + | 191 'ACTUAL results from the "old" JSON file. This can be a ' + |
193 'filepath on local storage, or a URL.') | 192 'filepath on local storage, or a URL.') |
194 args = parser.parse_args() | 193 args = parser.parse_args() |
195 differ = GMDiffer() | 194 differ = GMDiffer() |
196 diffs = differ.GenerateDiffDict(oldfile=args.old, newfile=args.new) | 195 diffs = differ.GenerateDiffDict(oldfile=args.old, newfile=args.new) |
197 json.dump(diffs, sys.stdout, sort_keys=True, indent=2) | 196 json.dump(diffs, sys.stdout, sort_keys=True, indent=2) |
198 | 197 |
199 | 198 |
200 if __name__ == '__main__': | 199 if __name__ == '__main__': |
201 _Main() | 200 _Main() |
OLD | NEW |