<s> import snakeserver . server <EOL> import os , sys , time , hashlib <EOL> import getopt <EOL> def usage ( ) : <EOL> print """<STR_LIT>""" % sys . argv [ <NUM_LIT:1> ] <EOL> def main ( ) : <EOL> HTTPD_PORT = <NUM_LIT> <EOL> HTTPD_IP = '<STR_LIT:127.0.0.1>' <EOL> HTTPD_EXTERNAL_PORT = <NUM_LIT> <EOL> RUNAS_USER = None <EOL> RUNAS_GROUP = None <EOL> WORKDIR = None <EOL> DEBUG = False <EOL> try : <EOL> opts , args = getopt . getopt ( sys . argv [ <NUM_LIT:1> : ] , "<STR_LIT>" , [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> except getopt . GetoptError , err : <EOL> print str ( err ) <EOL> usage ( ) <EOL> sys . exit ( <NUM_LIT:2> ) <EOL> output = None <EOL> verbose = False <EOL> for o , a in opts : <EOL> if o in ( "<STR_LIT>" , "<STR_LIT>" ) : <EOL> HTTPD_IP = a <EOL> elif o in ( "<STR_LIT>" , "<STR_LIT>" ) : <EOL> HTTPD_PORT = int ( a ) <EOL> elif o in ( "<STR_LIT>" , "<STR_LIT>" ) : <EOL> HTTPD_EXTERNAL_PORT = int ( a ) <EOL> elif o in ( "<STR_LIT>" , "<STR_LIT>" ) : <EOL> WORKDIR = a <EOL> elif o in ( "<STR_LIT>" , "<STR_LIT>" ) : <EOL> DEBUG = True <EOL> else : <EOL> assert False , "<STR_LIT>" <EOL> if WORKDIR : <EOL> os . chdir ( WORKDIR ) <EOL> print >> sys . stderr , "<STR_LIT>" % ( time . asctime ( time . gmtime ( ) ) , HTTPD_IP , HTTPD_PORT , HTTPD_EXTERNAL_PORT ) <EOL> snakeserver . server . main ( <EOL> HTTPD_PORT = HTTPD_PORT , <EOL> bindname = HTTPD_IP , <EOL> externalPort = HTTPD_EXTERNAL_PORT , <EOL> serverURLprefix = '<STR_LIT>' , <EOL> debugRequests = DEBUG , <EOL> precompileYPages = True , <EOL> writePageSource = False , <EOL> serverRootDir = None , <EOL> runAsUser = RUNAS_USER , <EOL> runAsGroup = RUNAS_GROUP , <EOL> escrow = hashlib . sha1 ( str ( time . time ) ) . hexdigest ( ) <EOL> ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( ) </s>
