#NEWLINE# def _read_new_format( config , repository ) : #NEWLINE# #INDENT# sections = config . sections ( ) #NEWLINE# index_servers = config . get ( 'distutils' , 'index-servers' ) #NEWLINE# _servers = [ server . strip ( ) for server in index_servers . split ( '\n' ) if ( server . strip ( ) != '' ) ] #NEWLINE# if ( _servers == [ ] ) : #NEWLINE# #INDENT# if ( 'pypi' in sections ) : #NEWLINE# #INDENT# _servers = [ 'pypi' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise InvalidPyPIConfig ( 'No index-servers section or pypi section' ) #NEWLINE# #UNINDENT# #UNINDENT# for server in _servers : #NEWLINE# #INDENT# current = PyPIConfig ( ) #NEWLINE# current . username = config . get ( server , 'username' ) #NEWLINE# current . server = server #NEWLINE# def _get_default( key , default ) : #NEWLINE# #INDENT# if config . has_option ( server , key ) : #NEWLINE# #INDENT# return config . get ( server , key ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return default #NEWLINE# #UNINDENT# #UNINDENT# current . repository = _get_default ( 'repository' , DEFAULT_REPOSITORY ) #NEWLINE# current . realm = _get_default ( 'realm' , DEFAULT_REALM ) #NEWLINE# current . password = _get_default ( 'password' , None ) #NEWLINE# if ( ( current . server == repository ) or ( current . repository == config ) ) : #NEWLINE# #INDENT# return current #NEWLINE# #UNINDENT# #UNINDENT# raise InvalidPyPIConfig ( ( 'No section for repository %r found' % repository ) )