Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: gm/rebaseline_server/server.py

Issue 364253003: rebaseline_server: if urlSchemaVersion is not specified, assume current (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | gm/rebaseline_server/static/constants.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 'png': 'image/png', 58 'png': 'image/png',
59 'js': 'application/javascript', 59 'js': 'application/javascript',
60 'json': 'application/json' 60 'json': 'application/json'
61 } 61 }
62 62
63 # Keys that server.py uses to create the toplevel content header. 63 # Keys that server.py uses to create the toplevel content header.
64 # NOTE: Keep these in sync with static/constants.js 64 # NOTE: Keep these in sync with static/constants.js
65 KEY__EDITS__MODIFICATIONS = 'modifications' 65 KEY__EDITS__MODIFICATIONS = 'modifications'
66 KEY__EDITS__OLD_RESULTS_HASH = 'oldResultsHash' 66 KEY__EDITS__OLD_RESULTS_HASH = 'oldResultsHash'
67 KEY__EDITS__OLD_RESULTS_TYPE = 'oldResultsType' 67 KEY__EDITS__OLD_RESULTS_TYPE = 'oldResultsType'
68 URL_KEY__SCHEMA_VERSION = 'urlSchemaVersion'
69 URL_VALUE__SCHEMA_VERSION__CURRENT = 0
70 # always interpret as then-current schema version;
71 # used for toplevel links on index page
72 URL_VALUE__SCHEMA_VERSION__ALWAYS_CURRENT = 'current'
73 68
74 DEFAULT_ACTUALS_DIR = results_mod.DEFAULT_ACTUALS_DIR 69 DEFAULT_ACTUALS_DIR = results_mod.DEFAULT_ACTUALS_DIR
75 DEFAULT_GM_SUMMARIES_BUCKET = download_actuals.GM_SUMMARIES_BUCKET 70 DEFAULT_GM_SUMMARIES_BUCKET = download_actuals.GM_SUMMARIES_BUCKET
76 DEFAULT_JSON_FILENAME = download_actuals.DEFAULT_JSON_FILENAME 71 DEFAULT_JSON_FILENAME = download_actuals.DEFAULT_JSON_FILENAME
77 DEFAULT_PORT = 8888 72 DEFAULT_PORT = 8888
78 73
79 PARENT_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) 74 PARENT_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
80 TRUNK_DIRECTORY = os.path.dirname(os.path.dirname(PARENT_DIRECTORY)) 75 TRUNK_DIRECTORY = os.path.dirname(os.path.dirname(PARENT_DIRECTORY))
81 # Directory, relative to PARENT_DIRECTORY, within which the server will serve 76 # Directory, relative to PARENT_DIRECTORY, within which the server will serve
82 # out live results (not static files). 77 # out live results (not static files).
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 with open(file_path, 'w') as file_handle: 157 with open(file_path, 'w') as file_handle:
163 file_handle.write( 158 file_handle.write(
164 '<!DOCTYPE html><html>' 159 '<!DOCTYPE html><html>'
165 '<head><title>rebaseline_server</title></head>' 160 '<head><title>rebaseline_server</title></head>'
166 '<body><ul>') 161 '<body><ul>')
167 if SUMMARY_TYPES: 162 if SUMMARY_TYPES:
168 file_handle.write('<li>Expectations vs Actuals</li><ul>') 163 file_handle.write('<li>Expectations vs Actuals</li><ul>')
169 for summary_type in SUMMARY_TYPES: 164 for summary_type in SUMMARY_TYPES:
170 file_handle.write( 165 file_handle.write(
171 '<li><a href="/{static_subdir}/view.html#/view.html?' 166 '<li><a href="/{static_subdir}/view.html#/view.html?'
172 '{version_key}={version_value}&'
173 'resultsToLoad=/{results_subdir}/{summary_type}">' 167 'resultsToLoad=/{results_subdir}/{summary_type}">'
174 '{summary_type}</a></li>'.format( 168 '{summary_type}</a></li>'.format(
175 results_subdir=RESULTS_SUBDIR, 169 results_subdir=RESULTS_SUBDIR,
176 static_subdir=STATIC_CONTENTS_SUBDIR, 170 static_subdir=STATIC_CONTENTS_SUBDIR,
177 summary_type=summary_type, 171 summary_type=summary_type))
178 version_key=URL_KEY__SCHEMA_VERSION,
179 version_value=URL_VALUE__SCHEMA_VERSION__ALWAYS_CURRENT))
180 file_handle.write('</ul>') 172 file_handle.write('</ul>')
181 if config_pairs: 173 if config_pairs:
182 file_handle.write('<li>Comparing configs within actual results</li><ul>') 174 file_handle.write('<li>Comparing configs within actual results</li><ul>')
183 for config_pair in config_pairs: 175 for config_pair in config_pairs:
184 file_handle.write('<li>%s vs %s:' % config_pair) 176 file_handle.write('<li>%s vs %s:' % config_pair)
185 for summary_type in SUMMARY_TYPES: 177 for summary_type in SUMMARY_TYPES:
186 file_handle.write( 178 file_handle.write(
187 ' <a href="/%s/view.html#/view.html?' 179 ' <a href="/%s/view.html#/view.html?'
188 'resultsToLoad=/%s/%s/%s-vs-%s_%s.json">%s</a>' % ( 180 'resultsToLoad=/%s/%s/%s-vs-%s_%s.json">%s</a>' % (
189 STATIC_CONTENTS_SUBDIR, STATIC_CONTENTS_SUBDIR, 181 STATIC_CONTENTS_SUBDIR, STATIC_CONTENTS_SUBDIR,
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 json_filename=args.json_filename, 693 json_filename=args.json_filename,
702 gm_summaries_bucket=args.gm_summaries_bucket, 694 gm_summaries_bucket=args.gm_summaries_bucket,
703 port=args.port, export=args.export, editable=args.editable, 695 port=args.port, export=args.export, editable=args.editable,
704 reload_seconds=args.reload, config_pairs=config_pairs, 696 reload_seconds=args.reload, config_pairs=config_pairs,
705 builder_regex_list=args.builders) 697 builder_regex_list=args.builders)
706 _SERVER.run() 698 _SERVER.run()
707 699
708 700
709 if __name__ == '__main__': 701 if __name__ == '__main__':
710 main() 702 main()
OLDNEW
« no previous file with comments | « no previous file | gm/rebaseline_server/static/constants.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698