OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 ''' | 3 ''' |
4 Copyright 2012 Google Inc. | 4 Copyright 2012 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 def __init__(self, expectations_root, expectations_filename, | 94 def __init__(self, expectations_root, expectations_filename, |
95 actuals_base_url, actuals_filename, | 95 actuals_base_url, actuals_filename, |
96 tests=None, configs=None, add_new=False): | 96 tests=None, configs=None, add_new=False): |
97 self._expectations_root = expectations_root | 97 self._expectations_root = expectations_root |
98 self._expectations_filename = expectations_filename | 98 self._expectations_filename = expectations_filename |
99 self._tests = tests | 99 self._tests = tests |
100 self._configs = configs | 100 self._configs = configs |
101 self._actuals_base_url = actuals_base_url | 101 self._actuals_base_url = actuals_base_url |
102 self._actuals_filename = actuals_filename | 102 self._actuals_filename = actuals_filename |
103 self._add_new = add_new | 103 self._add_new = add_new |
104 self._testname_pattern = re.compile('(\S+)_(\S+).png') | 104 self._testname_pattern = re.compile(gm_json.IMAGE_FILENAME_PATTERN) |
105 | 105 |
106 # Returns the full contents of filepath, as a single string. | 106 # Returns the full contents of filepath, as a single string. |
107 # If filepath looks like a URL, try to read it that way instead of as | 107 # If filepath looks like a URL, try to read it that way instead of as |
108 # a path on local storage. | 108 # a path on local storage. |
109 # | 109 # |
110 # Raises _InternalException if there is a problem. | 110 # Raises _InternalException if there is a problem. |
111 def _GetFileContents(self, filepath): | 111 def _GetFileContents(self, filepath): |
112 if filepath.startswith('http:') or filepath.startswith('https:'): | 112 if filepath.startswith('http:') or filepath.startswith('https:'): |
113 try: | 113 try: |
114 return urllib2.urlopen(filepath).read() | 114 return urllib2.urlopen(filepath).read() |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 dry_run=args.dry_run, | 297 dry_run=args.dry_run, |
298 json_base_url=args.actuals_base_url, | 298 json_base_url=args.actuals_base_url, |
299 json_filename=args.actuals_filename, | 299 json_filename=args.actuals_filename, |
300 add_new=args.add_new, | 300 add_new=args.add_new, |
301 missing_json_is_fatal=missing_json_is_fatal) | 301 missing_json_is_fatal=missing_json_is_fatal) |
302 try: | 302 try: |
303 rebaseliner.RebaselineSubdir(subdir=subdir, builder=builder) | 303 rebaseliner.RebaselineSubdir(subdir=subdir, builder=builder) |
304 except BaseException as e: | 304 except BaseException as e: |
305 print >> sys.stderr, e | 305 print >> sys.stderr, e |
306 sys.exit(1) | 306 sys.exit(1) |
OLD | NEW |