Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2d1ca2d

Browse files
committed
Issue #4354: Fix distutils register command.
1 parent 6cadba7 commit 2d1ca2d

2 files changed

Lines changed: 10 additions & 13 deletions

File tree

Lib/distutils/command/register.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@
1515
from distutils.errors import *
1616
from distutils import log
1717

18-
def raw_input(prompt):
19-
sys.stdout.write(prompt)
20-
sys.stdout.flush()
21-
return sys.stdin.readline()
22-
2318
class register(PyPIRCCommand):
2419

2520
description = ("register the distribution with the Python package index")
@@ -154,7 +149,7 @@ def send_metadata(self):
154149
3. have the server generate a new password for you (and email it to you), or
155150
4. quit
156151
Your selection [default 1]: ''', end=' ')
157-
choice = raw_input()
152+
choice = input()
158153
if not choice:
159154
choice = '1'
160155
elif choice not in choices:
@@ -163,7 +158,7 @@ def send_metadata(self):
163158
if choice == '1':
164159
# get the username and password
165160
while not username:
166-
username = raw_input('Username: ')
161+
username = input('Username: ')
167162
while not password:
168163
password = getpass.getpass('Password: ')
169164

@@ -182,7 +177,7 @@ def send_metadata(self):
182177
print('(the login will be stored in %s)' % self._get_rc_file())
183178
choice = 'X'
184179
while choice.lower() not in 'yn':
185-
choice = raw_input('Save your login (y/N)?')
180+
choice = input('Save your login (y/N)?')
186181
if not choice:
187182
choice = 'n'
188183
if choice.lower() == 'y':
@@ -193,7 +188,7 @@ def send_metadata(self):
193188
data['name'] = data['password'] = data['email'] = ''
194189
data['confirm'] = None
195190
while not data['name']:
196-
data['name'] = raw_input('Username: ')
191+
data['name'] = input('Username: ')
197192
while data['password'] != data['confirm']:
198193
while not data['password']:
199194
data['password'] = getpass.getpass('Password: ')
@@ -204,7 +199,7 @@ def send_metadata(self):
204199
data['confirm'] = None
205200
print("Password and confirm don't match!")
206201
while not data['email']:
207-
data['email'] = raw_input(' EMail: ')
202+
data['email'] = input(' EMail: ')
208203
code, result = self.post_to_server(data)
209204
if code != 200:
210205
print('Server response (%s): %s'%(code, result))
@@ -215,7 +210,7 @@ def send_metadata(self):
215210
data = {':action': 'password_reset'}
216211
data['email'] = ''
217212
while not data['email']:
218-
data['email'] = raw_input('Your email address: ')
213+
data['email'] = input('Your email address: ')
219214
code, result = self.post_to_server(data)
220215
print('Server response (%s): %s'%(code, result))
221216

@@ -262,7 +257,7 @@ def post_to_server(self, data, auth=None):
262257
if type(value) not in (type([]), type( () )):
263258
value = [value]
264259
for value in value:
265-
value = str(value).encode("utf-8")
260+
value = str(value)
266261
body.write(sep_boundary)
267262
body.write('\nContent-Disposition: form-data; name="%s"'%key)
268263
body.write("\n\n")
@@ -271,7 +266,7 @@ def post_to_server(self, data, auth=None):
271266
body.write('\n') # write an extra newline (lurve Macs)
272267
body.write(end_boundary)
273268
body.write("\n")
274-
body = body.getvalue()
269+
body = body.getvalue().encode("utf-8")
275270

276271
# build the Request
277272
headers = {

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ Core and Builtins
3333
Library
3434
-------
3535

36+
- Issue #4354: Fix distutils register command.
37+
3638
- Issue #4116: Resolve member name conflict in ScrolledCanvas.__init__.
3739

3840
- Issue #4307: The named tuple that ``inspect.getfullargspec()`` returns now

0 commit comments

Comments
 (0)