mirror of
https://github.com/python/cpython.git
synced 2025-08-15 22:30:42 +00:00
fixed #4394 make the storage of the password optional in .pypirc
This commit is contained in:
parent
5b913e31a1
commit
1a240fb9f0
9 changed files with 172 additions and 75 deletions
|
@ -173,19 +173,23 @@ Your selection [default 1]: ''', log.INFO)
|
|||
log.INFO)
|
||||
|
||||
# possibly save the login
|
||||
if not self.has_config and code == 200:
|
||||
self.announce(('I can store your PyPI login so future '
|
||||
'submissions will be faster.'), log.INFO)
|
||||
self.announce('(the login will be stored in %s)' % \
|
||||
self._get_rc_file(), log.INFO)
|
||||
|
||||
choice = 'X'
|
||||
while choice.lower() not in 'yn':
|
||||
choice = raw_input('Save your login (y/N)?')
|
||||
if not choice:
|
||||
choice = 'n'
|
||||
if choice.lower() == 'y':
|
||||
self._store_pypirc(username, password)
|
||||
if code == 200:
|
||||
if self.has_config:
|
||||
# sharing the password in the distribution instance
|
||||
# so the upload command can reuse it
|
||||
self.distribution.password = password
|
||||
else:
|
||||
self.announce(('I can store your PyPI login so future '
|
||||
'submissions will be faster.'), log.INFO)
|
||||
self.announce('(the login will be stored in %s)' % \
|
||||
self._get_rc_file(), log.INFO)
|
||||
choice = 'X'
|
||||
while choice.lower() not in 'yn':
|
||||
choice = raw_input('Save your login (y/N)?')
|
||||
if not choice:
|
||||
choice = 'n'
|
||||
if choice.lower() == 'y':
|
||||
self._store_pypirc(username, password)
|
||||
|
||||
elif choice == '2':
|
||||
data = {':action': 'user'}
|
||||
|
|
|
@ -50,6 +50,11 @@ class upload(PyPIRCCommand):
|
|||
self.repository = config['repository']
|
||||
self.realm = config['realm']
|
||||
|
||||
# getting the password from the distribution
|
||||
# if previously set by the register command
|
||||
if not self.password and self.distribution.password:
|
||||
self.password = self.distribution.password
|
||||
|
||||
def run(self):
|
||||
if not self.distribution.dist_files:
|
||||
raise DistutilsOptionError("No dist file created in earlier command")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue