#NEWLINE# def configure( self , runtime_environment ) : #NEWLINE# #INDENT# self . runtime_environment = runtime_environment #NEWLINE# self . namespace [ 'runtime_environment' ] = self #NEWLINE# for ( name , dependency_configuration ) in self . dependencies . items ( ) : #NEWLINE# #INDENT# if isinstance ( dependency_configuration , basestring ) : #NEWLINE# #INDENT# self . dependencies [ name ] = dict ( provider = dependency_configuration ) #NEWLINE# #UNINDENT# #UNINDENT# self . dependency_map = runtime_environment . create_dependency_map ( self , ** self . dependencies ) #NEWLINE# self . namespace . setdefault ( 'd' , self . dependency_map ) #NEWLINE# self . namespace . setdefault ( 'dependencies' , self . dependency_map ) #NEWLINE# with tempfile . NamedTemporaryFile ( suffix = '_bootstrap.py' ) as ntf : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# if isinstance ( self . bootstrap , filepath . FilePath ) : #NEWLINE# #INDENT# execfile ( self . bootstrap . path , self . namespace , self . namespace ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ntf . file . write ( self . bootstrap ) #NEWLINE# ntf . file . flush ( ) #NEWLINE# execfile ( ntf . name , self . namespace , self . namespace ) #NEWLINE# logger . info ( 'Finished bootstrapping the REPL namespace.' ) #NEWLINE# #UNINDENT# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# logger . error ( 'Caught exception while bootstrapping REPL. Traceback follows.' , exc_info = True ) #NEWLINE# #UNINDENT# #UNINDENT# try : #NEWLINE# #INDENT# self . start ( ) #NEWLINE# logger . info ( 'REPL started.' ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# logger . error ( 'Unable to start REPL. Traceback follows' , exc_info = True )