]> git.proxmox.com Git - ceph.git/blob - ceph/admin/serve-doc
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / admin / serve-doc
1 #!/usr/bin/python
2 from __future__ import print_function
3
4 import SimpleHTTPServer
5 import SocketServer
6 import os
7 import sys
8
9 path = os.path.dirname(sys.argv[0])
10 os.chdir(path)
11 os.chdir('..')
12 os.chdir('build-doc/output/html')
13
14 class ReusingTCPServer(SimpleHTTPServer.SimpleHTTPRequestHandler):
15 allow_reuse_address = True
16
17 def send_head(self):
18 # horrible kludge because SimpleHTTPServer is buggy wrt
19 # slash-redirecting of requests with query arguments, and will
20 # redirect to /foo?q=bar/ -- wrong slash placement
21 self.path = self.path.split('?', 1)[0]
22 return SimpleHTTPServer.SimpleHTTPRequestHandler.send_head(self)
23
24 httpd = SocketServer.TCPServer(
25 ("", 8080),
26 ReusingTCPServer,
27 )
28 try:
29 print("Serving doc at port: http://localhost:8080")
30 httpd.serve_forever()
31 except KeyboardInterrupt:
32 pass