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

Side by Side Diff: appengine/swarming/tools/start_servers.py

Issue 1390773002: Add an assert to ensure UTF-8 locale when handling file paths. (Closed) Base URL: git@github.com:luci/luci-py.git@master
Patch Set: More fixes Created 5 years, 2 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 | « appengine/swarming/tools/start_bot.py ('k') | client/tests/file_path_test.py » ('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/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The Swarming Authors. All rights reserved. 2 # Copyright 2015 The Swarming Authors. All rights reserved.
3 # Use of this source code is governed by the Apache v2.0 license that can be 3 # Use of this source code is governed by the Apache v2.0 license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Starts local Swarming and Isolate servers.""" 6 """Starts local Swarming and Isolate servers."""
7 7
8 import argparse 8 import argparse
9 import os 9 import os
10 import shutil 10 import shutil
11 import sys 11 import sys
12 import tempfile 12 import tempfile
13 13
14 14
15 APP_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 15 APP_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
16 CLIENT_DIR = os.path.join(os.path.dirname(os.path.dirname(APP_DIR)), 'client')
16 sys.path.insert(0, APP_DIR) 17 sys.path.insert(0, APP_DIR)
17 18
19 sys.path.insert(0, CLIENT_DIR)
20 from third_party.depot_tools import fix_encoding
21 sys.path.pop(0)
22
18 import test_env 23 import test_env
19 test_env.setup_test_env() 24 test_env.setup_test_env()
20 25
21 from tool_support import local_app 26 from tool_support import local_app
22 27
23 28
24 class LocalServers(object): 29 class LocalServers(object):
25 """Local Swarming and Isolate servers.""" 30 """Local Swarming and Isolate servers."""
26 def __init__(self, listen_all): 31 def __init__(self, listen_all):
27 self._isolate_server = None 32 self._isolate_server = None
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 self._swarming_server.wait() 86 self._swarming_server.wait()
82 87
83 def dump_log(self): 88 def dump_log(self):
84 if self._isolate_server: 89 if self._isolate_server:
85 self._isolate_server.dump_log() 90 self._isolate_server.dump_log()
86 if self._swarming_server: 91 if self._swarming_server:
87 self._swarming_server.dump_log() 92 self._swarming_server.dump_log()
88 93
89 94
90 def main(): 95 def main():
96 fix_encoding.fix_encoding()
91 parser = argparse.ArgumentParser(description=sys.modules[__name__].__doc__) 97 parser = argparse.ArgumentParser(description=sys.modules[__name__].__doc__)
92 parser.add_argument('-a', '--all', action='store_true') 98 parser.add_argument('-a', '--all', action='store_true')
93 args = parser.parse_args() 99 args = parser.parse_args()
94 servers = LocalServers(args.all) 100 servers = LocalServers(args.all)
95 try: 101 try:
96 servers.start() 102 servers.start()
97 print('Swarming: %s' % servers.swarming_server.url) 103 print('Swarming: %s' % servers.swarming_server.url)
98 print('Isolate : %s' % servers.isolate_server.url) 104 print('Isolate : %s' % servers.isolate_server.url)
99 servers.wait() 105 servers.wait()
100 servers.dump_log() 106 servers.dump_log()
101 except KeyboardInterrupt: 107 except KeyboardInterrupt:
102 print >> sys.stderr, '<Ctrl-C> received; stopping servers' 108 print >> sys.stderr, '<Ctrl-C> received; stopping servers'
103 finally: 109 finally:
104 exit_code = servers.stop(False) 110 exit_code = servers.stop(False)
105 return exit_code 111 return exit_code
106 112
107 113
108 if __name__ == '__main__': 114 if __name__ == '__main__':
109 sys.exit(main()) 115 sys.exit(main())
OLDNEW
« no previous file with comments | « appengine/swarming/tools/start_bot.py ('k') | client/tests/file_path_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698