summaryrefslogtreecommitdiff
path: root/scripts/serve_local.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/serve_local.py')
-rw-r--r--scripts/serve_local.py63
1 files changed, 0 insertions, 63 deletions
diff --git a/scripts/serve_local.py b/scripts/serve_local.py
deleted file mode 100644
index 589fe48..0000000
--- a/scripts/serve_local.py
+++ /dev/null
@@ -1,63 +0,0 @@
-import BaseHTTPServer
-from os import curdir, sep, listdir
-
-port = 8000
-folders = [".", "./about", "./doc", "./dev"]
-
-html_files = []
-
-for fol in folders:
- all_files = listdir(fol)
- for f in all_files:
- if f.endswith(".html") and not f.startswith("cgit"):
- html_files.append(f[:len(f)-5])
-
-for f in html_files:
- #print("final files %s" % f)
- pass
-
-class DPDK_Handler(BaseHTTPServer.BaseHTTPRequestHandler):
- def do_GET(self):
- mimetype = ""
- if self.path.endswith(".html") or self.path.endswith("/"):
- mimetype='text/html'
-
- # Rudimental path rewriting to make links work
- path = self.path
- if path == "/":
- path = "index.html"
- else:
- for f in html_files:
- if path.endswith(f) and not path.endswith(".html"):
- path += ".html"
- break
-
- try:
- f = open(curdir + sep + path)
- self.send_response(200)
- self.send_header('Content-type', mimetype)
- self.end_headers()
- self.wfile.write(f.read().replace('//dpdk.org', ''))
- f.close()
- except IOError:
- self.send_error(404, 'File Not Found: %s' % path)
- def log_message(self, format, *args):
- return
-
-def run(server_class=BaseHTTPServer.HTTPServer,
- handler_class=BaseHTTPServer.BaseHTTPRequestHandler):
- server_address = ('', port)
- httpd = server_class(server_address, handler_class)
- httpd.serve_forever()
-
-url = "http://localhost:%d" % port
-print(url)
-try:
- run(handler_class=DPDK_Handler)
-except BaseHTTPServer.socket.error:
- print("#######################################")
- print("# ERROR: Socket already in use. #")
- print("# Are you running the server already? #")
- print("#######################################")
-except KeyboardInterrupt:
- print("\tQuitting, bye bye!")