ó RÑÕfc@sâdZddlZddlZddlZddlmZmZd„ZedkrÞej dZ e ej ƒdkrŠe ej dƒndZ ejd e eƒZd e e fGHyejƒWqÞek rÚd GHqÞXndS( s  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. iÿÿÿÿN(t simple_servertutilcCs½tjjt|ddƒ}d|jtjjƒdkrTtjj|dƒ}ntj|ƒd}tjj|ƒr¢|dd|fgƒtj t |ƒƒS|d d gƒd gSdS( Nt PATH_INFOit.iÿÿÿÿs index.htmlis200 OKs Content-Types 404 Not Founds text/plains not found(s Content-Types text/plain( tostpathtjointsplittsept mimetypest guess_typetexistsRt FileWrappertopen(tenvirontrespondtfnttype((s+/usr/lib64/python2.7/Tools/scripts/serve.pytapp st__main__iii@ts(Serving %s on port %s, control-C to stopsShutting down.(t__doc__tsysRR twsgirefRRRt__name__targvRtlentinttportt make_serverthttpdt serve_forevertKeyboardInterrupt(((s+/usr/lib64/python2.7/Tools/scripts/serve.pyts      .