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

Side by Side Diff: tools/python/google/httpd_utils.py

Issue 8678023: Fix python scripts in src/tools/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes Created 9 years 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 | « tools/python/google/gethash_timer.py ('k') | tools/python/google/logging_utils.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 #!/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """A class to help start/stop a local apache http server.""" 6 """A class to help start/stop a local apache http server."""
7 7
8 import logging 8 import logging
9 import optparse 9 import optparse
10 import os 10 import os
11 import subprocess 11 import subprocess
12 import sys 12 import sys
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 stdout=subprocess.PIPE, 162 stdout=subprocess.PIPE,
163 stderr=subprocess.PIPE) 163 stderr=subprocess.PIPE)
164 logging.info('%s\n%s' % (kill_proc.stdout.read(), 164 logging.info('%s\n%s' % (kill_proc.stdout.read(),
165 kill_proc.stderr.read())) 165 kill_proc.stderr.read()))
166 self._http_server_proc = None 166 self._http_server_proc = None
167 if self._cygserver_path: 167 if self._cygserver_path:
168 subprocess.Popen(["taskkill.exe", "/f", "/im", "cygserver.exe"], 168 subprocess.Popen(["taskkill.exe", "/f", "/im", "cygserver.exe"],
169 stdout=subprocess.PIPE, 169 stdout=subprocess.PIPE,
170 stderr=subprocess.PIPE) 170 stderr=subprocess.PIPE)
171 171
172 if '__main__' == __name__: 172
173 def main():
173 # Provide some command line params for starting/stopping the http server 174 # Provide some command line params for starting/stopping the http server
174 # manually. 175 # manually.
175 option_parser = optparse.OptionParser() 176 option_parser = optparse.OptionParser()
176 option_parser.add_option('-k', '--server', help='Server action (start|stop)') 177 option_parser.add_option('-k', '--server', help='Server action (start|stop)')
177 option_parser.add_option('-r', '--root', help='Document root (optional)') 178 option_parser.add_option('-r', '--root', help='Document root (optional)')
178 option_parser.add_option('-a', '--apache2', action='store_true', 179 option_parser.add_option('-a', '--apache2', action='store_true',
179 default=False, help='Starts Apache 2 instead of Apache 1.3 (default). ' 180 default=False, help='Starts Apache 2 instead of Apache 1.3 (default). '
180 'Ignored on Mac (apache2 is used always)') 181 'Ignored on Mac (apache2 is used always)')
181 options, args = option_parser.parse_args() 182 options, args = option_parser.parse_args()
182 183
183 if not options.server: 184 if not options.server:
184 print ("Usage: %s -k {start|stop} [-r document_root] [--apache2]" % 185 print ("Usage: %s -k {start|stop} [-r document_root] [--apache2]" %
185 sys.argv[0]) 186 sys.argv[0])
186 sys.exit(0) 187 return 1
187 188
188 document_root = None 189 document_root = None
189 if options.root: 190 if options.root:
190 document_root = options.root 191 document_root = options.root
191 192
192 if 'start' == options.server: 193 if 'start' == options.server:
193 StartServer(document_root, apache2=options.apache2) 194 StartServer(document_root, apache2=options.apache2)
194 else: 195 else:
195 StopServers(apache2=options.apache2) 196 StopServers(apache2=options.apache2)
196 197
198
199 if '__main__' == __name__:
200 sys.exit(main())
OLDNEW
« no previous file with comments | « tools/python/google/gethash_timer.py ('k') | tools/python/google/logging_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698