#NEWLINE# def extension( self , node ) : #NEWLINE# #INDENT# ret = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# seen = set ( ) #NEWLINE# def _ensure_unique( field ) : #NEWLINE# #INDENT# if ( field in seen ) : #NEWLINE# #INDENT# raise ValueError ( ( 'Field %r for extension %r is specified more than once !' % ( field , ret [ 'name' ] ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# seen . add ( field ) #NEWLINE# #UNINDENT# #UNINDENT# def update( extension_dict , c ) : #NEWLINE# #INDENT# if ( type ( c ) == list ) : #NEWLINE# #INDENT# for i in c : #NEWLINE# #INDENT# update ( extension_dict , i ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( c . type == 'name' ) : #NEWLINE# #INDENT# ret [ 'name' ] = c . value #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( c . type == 'sources' ) : #NEWLINE# #INDENT# _ensure_unique ( 'sources' ) #NEWLINE# ret [ 'sources' ] = c . value #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( c . type == 'include_dirs' ) : #NEWLINE# #INDENT# _ensure_unique ( 'include_dirs' ) #NEWLINE# ret [ 'include_dirs' ] = c . value #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( 'Gne ?' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# for c in ( [ node . children [ 0 ] ] + node . children [ 1 ] ) : #NEWLINE# #INDENT# update ( ret , c ) #NEWLINE# #UNINDENT# return Node ( 'extension' , value = ret )