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

Side by Side Diff: chrome/common/extensions/docs/server2/preview.py

Issue 10829149: Extensions Docs Server: preview.py fixes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment Created 8 years, 4 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 | 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/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 # This is a preview server for the apps and extensions docs. Navigate to a docs 6 # This is a preview server for the apps and extensions docs. Navigate to a docs
7 # page, and the page will be rendered how it will be on the production server. 7 # page, and the page will be rendered how it will be on the production server.
8 # 8 #
9 # For example: http://localhost:8000/tabs.html will render the docs page for 9 # For example: http://localhost:8000/tabs.html will render the docs page for
10 # the tabs API. 10 # the tabs API.
11 # 11 #
12 # Run with: './preview.py' 12 # Run with: './preview.py'
13 13
14 from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer 14 from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
15 import optparse 15 import optparse
16 import os 16 import os
17 import shutil
17 from StringIO import StringIO 18 from StringIO import StringIO
18 import sys 19 import sys
19 import urlparse 20 import urlparse
20 21
22 import build_server
23 # Copy all the files necessary to run the server. These are cleaned up when the
24 # server quits.
25 build_server.main()
21 from handler import Handler 26 from handler import Handler
22 27
23 class Response(object): 28 class Response(object):
24 def __init__(self): 29 def __init__(self):
25 self.status = 200 30 self.status = 200
26 self.out = StringIO() 31 self.out = StringIO()
27 self.headers = {} 32 self.headers = {}
28 33
29 def set_status(self, status): 34 def set_status(self, status):
30 self.status = status 35 self.status = status
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 print('The extension documentation can be found at:') 69 print('The extension documentation can be found at:')
65 print('') 70 print('')
66 print(' http://localhost:%s' % opts.port) 71 print(' http://localhost:%s' % opts.port)
67 print('') 72 print('')
68 73
69 server = HTTPServer(('', int(opts.port)), RequestHandler) 74 server = HTTPServer(('', int(opts.port)), RequestHandler)
70 try: 75 try:
71 server.serve_forever() 76 server.serve_forever()
72 finally: 77 finally:
73 server.socket.close() 78 server.socket.close()
79 shutil.rmtree(os.path.join(sys.argv[0].rsplit(os.sep, 1)[0], 'third_party'))
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