#NEWLINE# def get_auth_details( openrc_file = OPENRC ) : #NEWLINE# #INDENT# auth_details = AUTH_DETAILS #NEWLINE# pattern = re . compile ( '^(?:export\\s)?(?P<key>\\w+)(?:\\s+)?=(?:\\s+)?(?P<value>.*)$' ) #NEWLINE# try : #NEWLINE# #INDENT# with open ( openrc_file ) as openrc : #NEWLINE# #INDENT# for line in openrc : #NEWLINE# #INDENT# match = pattern . match ( line ) #NEWLINE# if ( match is None ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# k = match . group ( 'key' ) #NEWLINE# v = match . group ( 'value' ) #NEWLINE# if ( ( k in auth_details ) and ( auth_details [ k ] is None ) ) : #NEWLINE# #INDENT# auth_details [ k ] = v #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# except IOError as e : #NEWLINE# #INDENT# if ( e . errno != errno . ENOENT ) : #NEWLINE# #INDENT# status_err ( e ) #NEWLINE# #UNINDENT# for key in auth_details . keys ( ) : #NEWLINE# #INDENT# auth_details [ key ] = os . environ . get ( key ) #NEWLINE# #UNINDENT# #UNINDENT# for key in auth_details . keys ( ) : #NEWLINE# #INDENT# if ( auth_details [ key ] is None ) : #NEWLINE# #INDENT# status_err ( ( '%s not set' % key ) ) #NEWLINE# #UNINDENT# #UNINDENT# return auth_details