#NEWLINE# def prompt_for_credentials( self ) : #NEWLINE# #INDENT# pypirc_file = os . path . expanduser ( '~/.pypirc' ) #NEWLINE# if ( not os . path . isfile ( pypirc_file ) ) : #NEWLINE# #INDENT# pypirc = None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# pypirc = configparser . Rawconfigparser ( ) #NEWLINE# pypirc . read ( [ pypirc_file ] ) #NEWLINE# #UNINDENT# missing_errs = ( configparser . NoSectionError , configparser . NoOptionError ) #NEWLINE# if ( self . username is None ) : #NEWLINE# #INDENT# if ( self is not None ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# self . username = pypirc . get ( 'server-login' , 'username' ) #NEWLINE# #UNINDENT# except missing_errs : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( self . username is None ) : #NEWLINE# #INDENT# print ( 'Username: ' ) #NEWLINE# self . username = input ( ) . strip ( ) #NEWLINE# #UNINDENT# if ( self . password is None ) : #NEWLINE# #INDENT# if ( pypirc is not None ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# self . password = pypirc . get ( 'server-login' , 'password' ) #NEWLINE# #UNINDENT# except missing_errs : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( self . password is None ) : #NEWLINE# #INDENT# self . password = getpass . getpass ( 'Password: ' ) #NEWLINE# #UNINDENT# if ( not self . username ) : #NEWLINE# #INDENT# raise ValueError ( 'PyPI requires a username' ) #NEWLINE# #UNINDENT# if ( not self . password ) : #NEWLINE# #INDENT# raise ValueError ( 'PyPI requires a password' )