<s> """<STR_LIT>""" <EOL> import new <EOL> import os <EOL> import sys <EOL> import pathfix <EOL> import testoptions <EOL> import testutil <EOL> from pygr import logger <EOL> from pygr import metabase <EOL> parser = testoptions . option_parser ( ) <EOL> options , args = parser . parse_args ( ) <EOL> if options . pygrdatapath : <EOL> mdb = metabase . MetabaseList ( options . pygrdatapath ) <EOL> else : <EOL> mdb = metabase . MetabaseList ( ) <EOL> if options . verbosity == <NUM_LIT:0> : <EOL> logger . disable ( '<STR_LIT>' ) <EOL> names = filter ( None , options . resources . split ( '<STR_LIT::>' ) ) <EOL> resources = map ( mdb , names ) <EOL> options . downloadDB = options . downloadDB or None <EOL> xmlrpc = metabase . ResourceServer ( mdb , '<STR_LIT>' , <EOL> withIndex = True , <EOL> downloadDB = options . downloadDB , <EOL> host = '<STR_LIT:localhost>' , port = options . port ) <EOL> if options . port_file : <EOL> print '<STR_LIT>' % options . port_file <EOL> fp = open ( options . port_file , '<STR_LIT:w>' ) <EOL> fp . write ( "<STR_LIT>" % ( xmlrpc . port ) ) <EOL> fp . close ( ) <EOL> def serve_forever ( self ) : <EOL> self . keepRunning = True <EOL> while self . keepRunning : <EOL> self . handle_request ( ) <EOL> def exit_now ( self ) : <EOL> self . keepRunning = False <EOL> return <NUM_LIT:0> <EOL> exit_handler = new . instancemethod ( exit_now , xmlrpc . server , <EOL> xmlrpc . server . __class__ ) <EOL> xmlrpc . server . register_function ( exit_handler ) <EOL> print '<STR_LIT>' % ( xmlrpc . host , xmlrpc . port ) <EOL> serve_forever ( xmlrpc . server ) </s>
