#NEWLINE# def parse( self ) : #NEWLINE# #INDENT# _config = self . read_config ( self . config ) #NEWLINE# for ( src , path , configsection , key , value ) in key : #NEWLINE# #INDENT# if ( ':' in configsection ) : #NEWLINE# #INDENT# ( sectiongroupname , sectionname ) = configsection . split ( ':' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( sectiongroupname , sectionname ) = ( 'global' , configsection ) #NEWLINE# #UNINDENT# if ( ( sectiongroupname == 'global' ) and ( sectionname == 'global' ) and ( key == 'extends' ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# sectiongroup = self . setdefault ( sectiongroupname , ConfigSection ( ) ) #NEWLINE# self . get_section ( sectiongroupname , sectionname ) #NEWLINE# if ( key is not None ) : #NEWLINE# #INDENT# if ( key == 'massagers' ) : #NEWLINE# #INDENT# for spec in value . splitlines ( ) : #NEWLINE# #INDENT# spec = spec . strip ( ) #NEWLINE# if ( not spec ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( '=' not in spec ) : #NEWLINE# #INDENT# log . error ( "Invalid massager spec '%s' in section '%s:%s'." , spec , sectiongroupname , sectionname ) #NEWLINE# sys . exit ( 1 ) #NEWLINE# #UNINDENT# ( massager_key , massager ) = spec . split ( '=' ) #NEWLINE# massager_key = massager_key . strip ( ) #NEWLINE# massager = massager . strip ( ) #NEWLINE# if ( ':' in massager_key ) : #NEWLINE# #INDENT# parts = tuple ( ( x . strip ( ) for x in massager_key . split ( ':' ) ) ) #NEWLINE# if ( len ( parts ) == 2 ) : #NEWLINE# #INDENT# ( massager_sectiongroupname , massager_key ) = parts #NEWLINE# massager_sectionname = None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( parts ) == 3 ) : #NEWLINE# #INDENT# ( massager_sectiongroupname , massager_sectionname , massager_key ) = parts #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# log . error ( "Invalid massager spec '%s' in section '%s:%s'." , spec , sectiongroupname , sectionname ) #NEWLINE# sys . exit ( 1 ) #NEWLINE# #UNINDENT# #UNINDENT# if ( massager_sectiongroupname == '' ) : #NEWLINE# #INDENT# massager_sectiongroupname = sectiongroupname #NEWLINE# #UNINDENT# if ( massager_sectiongroupname == '*' ) : #NEWLINE# #INDENT# massager_sectiongroupname = None #NEWLINE# #UNINDENT# if ( massager_sectionname == '' ) : #NEWLINE# #INDENT# massager_sectionname = sectionname #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# massager_sectiongroupname = sectiongroupname #NEWLINE# massager_sectionname = sectionname #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# massager = resolve_dotted_name ( massager ) #NEWLINE# #UNINDENT# except ImportError as e : #NEWLINE# #INDENT# log . error ( "Can't import massager from '%s'.\n%s" , massager , unicode ( e ) ) #NEWLINE# sys . exit ( 1 ) #NEWLINE# #UNINDENT# except AttributeError as e : #NEWLINE# #INDENT# log . error ( "Can't import massager from '%s'.\n%s" , massager , unicode ( e ) ) #NEWLINE# sys . exit ( 1 ) #NEWLINE# #UNINDENT# massager = massager ( massager_sectiongroupname , massager_key ) #NEWLINE# if ( massager_sectionname is None ) : #NEWLINE# #INDENT# self . add_massager ( massager ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# massager_section = self . get_section ( sectiongroupname , massager_sectionname ) #NEWLINE# massager_section . add_massager ( massager ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# sectiongroup [ sectionname ] [ key ] = ConfigValue ( path , value , src = src ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( 'plugin' in self ) : #NEWLINE# #INDENT# warnings . warn ( "The 'plugin' section isn't used anymore." ) #NEWLINE# del self [ 'plugin' ] #NEWLINE# #UNINDENT# seen = set ( ) #NEWLINE# for sectiongroupname in self : #NEWLINE# #INDENT# sectiongroup = self [ sectiongroupname ] #NEWLINE# for sectionname in sectiongroup : #NEWLINE# #INDENT# section = sectiongroup [ sectionname ] #NEWLINE# if ( '<' in section ) : #NEWLINE# #INDENT# self . _expand ( sectiongroupname , sectionname , section , seen ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return self