File tree 2 files changed +29
-0
lines changed
2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 27
27
@echo " suspicious to check for suspicious markup in output text"
28
28
@echo " coverage to check documentation coverage for library and C API"
29
29
@echo " dist to create a \" dist\" directory with archived docs for download"
30
+ @echo " serve to serve the documentation on the localhost (8000)"
30
31
31
32
# Note: if you update versions here, do the same in make.bat and README.txt
32
33
checkout :
@@ -149,3 +150,6 @@ dist:
149
150
150
151
check :
151
152
$(PYTHON ) tools/rstlint.py -i tools
153
+
154
+ serve :
155
+ ../Tools/scripts/serve.py build/html
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+ import sys
3
+ import os
4
+ import mimetypes
5
+ from wsgiref import simple_server , util
6
+
7
+ def app (environ , respond ):
8
+
9
+ fn = os .path .join (path , environ ['PATH_INFO' ][1 :])
10
+ if '.' not in fn .split (os .path .sep )[- 1 ]:
11
+ fn = os .path .join (fn , 'index.html' )
12
+ type = mimetypes .guess_type (fn )[0 ]
13
+
14
+ if os .path .exists (fn ):
15
+ respond ('200 OK' , [('Content-Type' , type )])
16
+ return util .FileWrapper (open (fn ))
17
+ else :
18
+ respond ('404 Not Found' , [('Content-Type' , 'text/plain' )])
19
+ return ['not found' ]
20
+
21
+ if __name__ == '__main__' :
22
+ path = sys .argv [1 ]
23
+ port = int (sys .argv [2 ]) if len (sys .argv ) > 2 else 8000
24
+ httpd = simple_server .make_server ('' , port , app )
25
+ httpd .serve_forever ()
You can’t perform that action at this time.
0 commit comments