From 72be8174fa4e46fcf82269015ad3fd0d585de195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Wirtel?= Date: Sun, 24 Mar 2019 13:28:05 +0100 Subject: [PATCH] bpo-36345: Remove the deprecated Tools/scripts/serve.py script --- .../2019-03-24-13-27-03.bpo-36345.la9UDq.rst | 2 ++ Tools/scripts/README | 1 - Tools/scripts/serve.py | 35 ------------------- 3 files changed, 2 insertions(+), 36 deletions(-) create mode 100644 Misc/NEWS.d/next/Documentation/2019-03-24-13-27-03.bpo-36345.la9UDq.rst delete mode 100755 Tools/scripts/serve.py diff --git a/Misc/NEWS.d/next/Documentation/2019-03-24-13-27-03.bpo-36345.la9UDq.rst b/Misc/NEWS.d/next/Documentation/2019-03-24-13-27-03.bpo-36345.la9UDq.rst new file mode 100644 index 00000000000000..b8079a82f890c3 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2019-03-24-13-27-03.bpo-36345.la9UDq.rst @@ -0,0 +1,2 @@ +Remove the deprecated ``Tools/scripts/serve.py`` script. Contributed by +Stéphane Wirtel diff --git a/Tools/scripts/README b/Tools/scripts/README index d4ac2ade25ef84..827d89ef810f3a 100644 --- a/Tools/scripts/README +++ b/Tools/scripts/README @@ -59,7 +59,6 @@ reindent.py Change .py files to use 4-space indents reindent-rst.py Fix-up reStructuredText file whitespace rgrep.py Reverse grep through a file (useful for big logfiles) run_tests.py Run the test suite with more sensible default options -serve.py Small wsgiref-based web server, used in make serve in Doc suff.py Sort a list of files by suffix texi2html.py Convert GNU texinfo files into HTML untabify.py Replace tabs with spaces in argument files diff --git a/Tools/scripts/serve.py b/Tools/scripts/serve.py deleted file mode 100755 index dae21f2260ff13..00000000000000 --- a/Tools/scripts/serve.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python3 -''' -Small wsgiref based web server. Takes a path to serve from and an -optional port number (defaults to 8000), then tries to serve files. -Mime types are guessed from the file names, 404 errors are raised -if the file is not found. Used for the make serve target in Doc. -''' -import sys -import os -import mimetypes -from wsgiref import simple_server, util - -def app(environ, respond): - - fn = os.path.join(path, environ['PATH_INFO'][1:]) - if '.' not in fn.split(os.path.sep)[-1]: - fn = os.path.join(fn, 'index.html') - type = mimetypes.guess_type(fn)[0] - - if os.path.exists(fn): - respond('200 OK', [('Content-Type', type)]) - return util.FileWrapper(open(fn, "rb")) - else: - respond('404 Not Found', [('Content-Type', 'text/plain')]) - return [b'not found'] - -if __name__ == '__main__': - path = sys.argv[1] - port = int(sys.argv[2]) if len(sys.argv) > 2 else 8000 - httpd = simple_server.make_server('', port, app) - print("Serving {} on port {}, control-C to stop".format(path, port)) - try: - httpd.serve_forever() - except KeyboardInterrupt: - print("\b\bShutting down.")