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

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

Issue 81243002: rebaseline_server: deprecate --expectations-dir option in advance of git transition (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 def __init__(self, 102 def __init__(self,
103 actuals_dir=DEFAULT_ACTUALS_DIR, 103 actuals_dir=DEFAULT_ACTUALS_DIR,
104 expectations_dir=DEFAULT_EXPECTATIONS_DIR, 104 expectations_dir=DEFAULT_EXPECTATIONS_DIR,
105 port=DEFAULT_PORT, export=False, editable=True, 105 port=DEFAULT_PORT, export=False, editable=True,
106 reload_seconds=0): 106 reload_seconds=0):
107 """ 107 """
108 Args: 108 Args:
109 actuals_dir: directory under which we will check out the latest actual 109 actuals_dir: directory under which we will check out the latest actual
110 GM results 110 GM results
111 expectations_dir: directory under which to find GM expectations (they 111 expectations_dir: DEPRECATED: directory under which to find
112 must already be in that directory) 112 GM expectations (they must already be in that directory)
113 port: which TCP port to listen on for HTTP requests 113 port: which TCP port to listen on for HTTP requests
114 export: whether to allow HTTP clients on other hosts to access this server 114 export: whether to allow HTTP clients on other hosts to access this server
115 editable: whether HTTP clients are allowed to submit new baselines 115 editable: whether HTTP clients are allowed to submit new baselines
116 reload_seconds: polling interval with which to check for new results; 116 reload_seconds: polling interval with which to check for new results;
117 if 0, don't check for new results at all 117 if 0, don't check for new results at all
118 """ 118 """
119 self._actuals_dir = actuals_dir 119 self._actuals_dir = actuals_dir
120 self._expectations_dir = expectations_dir 120 self._expectations_dir = expectations_dir
121 self._port = port 121 self._port = port
122 self._export = export 122 self._export = export
123 self._editable = editable 123 self._editable = editable
124 self._reload_seconds = reload_seconds 124 self._reload_seconds = reload_seconds
125 self._actuals_repo = _create_svn_checkout( 125 self._actuals_repo = _create_svn_checkout(
126 dir_path=actuals_dir, repo_url=ACTUALS_SVN_REPO) 126 dir_path=actuals_dir, repo_url=ACTUALS_SVN_REPO)
127 127
128 # We only update the expectations dir if the server was run with a 128 # We only update the expectations dir if the server was run with a
129 # nonzero --reload argument; otherwise, we expect the user to maintain 129 # nonzero --reload argument; otherwise, we expect the user to maintain
130 # her own expectations as she sees fit. 130 # her own expectations as she sees fit.
131 # 131 #
132 # TODO(epoger): Use git instead of svn to check out expectations, since 132 # TODO(epoger): Use git instead of svn to check out expectations, since
133 # the Skia repo is moving to git. 133 # the Skia repo is moving to git.
134 if reload_seconds: 134 if reload_seconds:
135 self._expectations_repo = _create_svn_checkout( 135 self._expectations_repo = _create_svn_checkout(
epoger 2013/11/21 17:08:37 see comments below
136 dir_path=expectations_dir, repo_url=EXPECTATIONS_SVN_REPO) 136 dir_path=expectations_dir, repo_url=EXPECTATIONS_SVN_REPO)
137 else: 137 else:
138 self._expectations_repo = None 138 self._expectations_repo = None
139 139
140 def is_exported(self): 140 def is_exported(self):
141 """ Returns true iff HTTP clients on other hosts are allowed to access 141 """ Returns true iff HTTP clients on other hosts are allowed to access
142 this server. """ 142 this server. """
143 return self._export 143 return self._export
144 144
145 def is_editable(self): 145 def is_editable(self):
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 def main(): 427 def main():
428 logging.basicConfig(level=logging.INFO) 428 logging.basicConfig(level=logging.INFO)
429 parser = argparse.ArgumentParser() 429 parser = argparse.ArgumentParser()
430 parser.add_argument('--actuals-dir', 430 parser.add_argument('--actuals-dir',
431 help=('Directory into which we will check out the latest ' 431 help=('Directory into which we will check out the latest '
432 'actual GM results. If this directory does not ' 432 'actual GM results. If this directory does not '
433 'exist, it will be created. Defaults to %(default)s'), 433 'exist, it will be created. Defaults to %(default)s'),
434 default=DEFAULT_ACTUALS_DIR) 434 default=DEFAULT_ACTUALS_DIR)
435 parser.add_argument('--editable', action='store_true', 435 parser.add_argument('--editable', action='store_true',
436 help=('Allow HTTP clients to submit new baselines.')) 436 help=('Allow HTTP clients to submit new baselines.'))
437 parser.add_argument('--expectations-dir', 437 # Deprecated the --expectations-dir option, because once our GM expectations
438 help=('Directory under which to find GM expectations; ' 438 # are maintained within git we will no longer be able to check out and update
439 # them in isolation (in SVN you can update a single directory subtree within
440 # a checkout, but you cannot do that with git).
441 #
442 # In a git world, we will force the user to refer to expectations
443 # within the same checkout as this tool (at the relative path
444 # ../../expectations/gm ). If they specify the --reload option, we will
445 # periodically run "git pull" on the entire Skia checkout, which will update
446 # the GM expectations along with everything else (such as this script).
447 #
448 # We can still allow --actuals-dir to be specified, though, because the
449 # actual results will continue to be maintained in the skia-autogen
450 # SVN repository.
451 parser.add_argument('--deprecated-expectations-dir',
452 help=('DEPRECATED due to our transition from SVN to git '
453 '(formerly known as --expectations-dir). '
454 'If you still need this option, contact '
455 'epoger@google.com as soon as possible. WAS: '
456 'Directory under which to find GM expectations; '
epoger 2013/11/21 17:08:37 Alternatively, we could allow the user to specify
439 'defaults to %(default)s'), 457 'defaults to %(default)s'),
440 default=DEFAULT_EXPECTATIONS_DIR) 458 default=DEFAULT_EXPECTATIONS_DIR)
441 parser.add_argument('--export', action='store_true', 459 parser.add_argument('--export', action='store_true',
442 help=('Instead of only allowing access from HTTP clients ' 460 help=('Instead of only allowing access from HTTP clients '
443 'on localhost, allow HTTP clients on other hosts ' 461 'on localhost, allow HTTP clients on other hosts '
444 'to access this server. WARNING: doing so will ' 462 'to access this server. WARNING: doing so will '
445 'allow users on other hosts to modify your ' 463 'allow users on other hosts to modify your '
446 'GM expectations, if combined with --editable.')) 464 'GM expectations, if combined with --editable.'))
447 parser.add_argument('--port', type=int, 465 parser.add_argument('--port', type=int,
448 help=('Which TCP port to listen on for HTTP requests; ' 466 help=('Which TCP port to listen on for HTTP requests; '
449 'defaults to %(default)s'), 467 'defaults to %(default)s'),
450 default=DEFAULT_PORT) 468 default=DEFAULT_PORT)
451 parser.add_argument('--reload', type=int, 469 parser.add_argument('--reload', type=int,
452 help=('How often (a period in seconds) to update the ' 470 help=('How often (a period in seconds) to update the '
453 'results. If specified, both EXPECTATIONS_DIR and ' 471 'results. If specified, both '
472 'DEPRECATED_EXPECTATIONS_DIR and '
454 'ACTUAL_DIR will be updated. ' 473 'ACTUAL_DIR will be updated. '
455 'By default, we do not reload at all, and you ' 474 'By default, we do not reload at all, and you '
456 'must restart the server to pick up new data.'), 475 'must restart the server to pick up new data.'),
457 default=0) 476 default=0)
458 args = parser.parse_args() 477 args = parser.parse_args()
459 global _SERVER 478 global _SERVER
460 _SERVER = Server(actuals_dir=args.actuals_dir, 479 _SERVER = Server(actuals_dir=args.actuals_dir,
461 expectations_dir=args.expectations_dir, 480 expectations_dir=args.deprecated_expectations_dir,
462 port=args.port, export=args.export, editable=args.editable, 481 port=args.port, export=args.export, editable=args.editable,
463 reload_seconds=args.reload) 482 reload_seconds=args.reload)
464 _SERVER.run() 483 _SERVER.run()
465 484
466 if __name__ == '__main__': 485 if __name__ == '__main__':
467 main() 486 main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698