B oi9y4P@sdZddlZddlZddlZddlmZmZddZedkrej dZ e ej dkrbe ej dnd Z ed e eZed e e y eWnek red YnXdS) a  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. N) simple_serverutilcCstjt|ddd}d|tjjdkr>tj|d}t|d}tj|rx|dd|fgt t |d S|d d gd gSdS) NZ PATH_INFO.z index.htmlrz200 OKz Content-Typerbz 404 Not Found)z Content-Typez text/plains not found) ospathjoinsplitsep mimetypesZ guess_typeexistsrZ FileWrapperopen)environZrespondfntyper8/opt/alt/python37/lib64/python3.7/Tools/scripts/serve.pyapp s  r__main__ri@z(Serving {} on port {}, control-C to stopzShutting down.)__doc__sysrr Zwsgirefrrr__name__argvr lenintZportZ make_serverZhttpdprintformatZ serve_foreverKeyboardInterruptrrrrs