#NEWLINE# def run( self , ctx , path ) : #NEWLINE# #INDENT# with self . make_target_directory ( path ) as scratch : #NEWLINE# #INDENT# for template in self . jinja_env . list_templates ( ) : #NEWLINE# #INDENT# if ( not template . endswith ( '.in' ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# fn = self . expand_filename ( scratch , ctx , template ) #NEWLINE# tmpl = self . jinja_env . get_template ( template ) #NEWLINE# rv = tmpl . render ( ctx ) . strip ( '\r\n' ) #NEWLINE# if rv : #NEWLINE# #INDENT# directory = os . path . dirname ( fn ) #NEWLINE# try : #NEWLINE# #INDENT# os . makedirs ( directory ) #NEWLINE# #UNINDENT# except OSError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# with open ( fn , 'w' ) as f : #NEWLINE# #INDENT# f . write ( ( rv . encode ( 'utf-8' ) + '\n' ) )