| 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 HTTP server for our HTML rebaseline viewer. | 9 HTTP server for our HTML rebaseline viewer. |
| 10 """ | 10 """ |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 # | 208 # |
| 209 # Because Skia uses depot_tools, we have to update using "gclient sync" | 209 # Because Skia uses depot_tools, we have to update using "gclient sync" |
| 210 # instead of raw git (or SVN) update. Happily, this will work whether | 210 # instead of raw git (or SVN) update. Happily, this will work whether |
| 211 # the checkout was created using git or SVN. | 211 # the checkout was created using git or SVN. |
| 212 if self._reload_seconds: | 212 if self._reload_seconds: |
| 213 logging.info( | 213 logging.info( |
| 214 'Updating expected GM results in %s by syncing Skia repo ...' % | 214 'Updating expected GM results in %s by syncing Skia repo ...' % |
| 215 EXPECTATIONS_DIR) | 215 EXPECTATIONS_DIR) |
| 216 _run_command(['gclient', 'sync'], TRUNK_DIRECTORY) | 216 _run_command(['gclient', 'sync'], TRUNK_DIRECTORY) |
| 217 | 217 |
| 218 logging.info( | |
| 219 ('Parsing results from actuals in %s and expectations in %s, ' | |
| 220 + 'and generating pixel diffs (may take a while) ...') % ( | |
| 221 self._actuals_dir, EXPECTATIONS_DIR)) | |
| 222 self._results = results.Results( | 218 self._results = results.Results( |
| 223 actuals_root=self._actuals_dir, | 219 actuals_root=self._actuals_dir, |
| 224 expected_root=EXPECTATIONS_DIR, | 220 expected_root=EXPECTATIONS_DIR, |
| 225 generated_images_root=GENERATED_IMAGES_ROOT) | 221 generated_images_root=GENERATED_IMAGES_ROOT) |
| 226 | 222 |
| 227 def _result_loader(self, reload_seconds=0): | 223 def _result_loader(self, reload_seconds=0): |
| 228 """ Call self.update_results(), either once or periodically. | 224 """ Call self.update_results(), either once or periodically. |
| 229 | 225 |
| 230 Params: | 226 Params: |
| 231 reload_seconds: integer; if nonzero, reload results at this interval | 227 reload_seconds: integer; if nonzero, reload results at this interval |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 Args: | 496 Args: |
| 501 json_dict: dictionary to send | 497 json_dict: dictionary to send |
| 502 """ | 498 """ |
| 503 self.send_response(200) | 499 self.send_response(200) |
| 504 self.send_header('Content-type', 'application/json') | 500 self.send_header('Content-type', 'application/json') |
| 505 self.end_headers() | 501 self.end_headers() |
| 506 json.dump(json_dict, self.wfile) | 502 json.dump(json_dict, self.wfile) |
| 507 | 503 |
| 508 | 504 |
| 509 def main(): | 505 def main(): |
| 510 logging.basicConfig(level=logging.INFO) | 506 logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', |
| 507 datefmt='%m/%d/%Y %H:%M:%S', |
| 508 level=logging.INFO) |
| 511 parser = argparse.ArgumentParser() | 509 parser = argparse.ArgumentParser() |
| 512 parser.add_argument('--actuals-dir', | 510 parser.add_argument('--actuals-dir', |
| 513 help=('Directory into which we will check out the latest ' | 511 help=('Directory into which we will check out the latest ' |
| 514 'actual GM results. If this directory does not ' | 512 'actual GM results. If this directory does not ' |
| 515 'exist, it will be created. Defaults to %(default)s'), | 513 'exist, it will be created. Defaults to %(default)s'), |
| 516 default=DEFAULT_ACTUALS_DIR) | 514 default=DEFAULT_ACTUALS_DIR) |
| 517 parser.add_argument('--editable', action='store_true', | 515 parser.add_argument('--editable', action='store_true', |
| 518 help=('Allow HTTP clients to submit new baselines.')) | 516 help=('Allow HTTP clients to submit new baselines.')) |
| 519 parser.add_argument('--export', action='store_true', | 517 parser.add_argument('--export', action='store_true', |
| 520 help=('Instead of only allowing access from HTTP clients ' | 518 help=('Instead of only allowing access from HTTP clients ' |
| (...skipping 16 matching lines...) Expand all Loading... |
| 537 args = parser.parse_args() | 535 args = parser.parse_args() |
| 538 global _SERVER | 536 global _SERVER |
| 539 _SERVER = Server(actuals_dir=args.actuals_dir, | 537 _SERVER = Server(actuals_dir=args.actuals_dir, |
| 540 port=args.port, export=args.export, editable=args.editable, | 538 port=args.port, export=args.export, editable=args.editable, |
| 541 reload_seconds=args.reload) | 539 reload_seconds=args.reload) |
| 542 _SERVER.run() | 540 _SERVER.run() |
| 543 | 541 |
| 544 | 542 |
| 545 if __name__ == '__main__': | 543 if __name__ == '__main__': |
| 546 main() | 544 main() |
| OLD | NEW |