7
7
8
8
import getpass
9
9
import io
10
+ import logging
10
11
import urllib .parse
11
12
import urllib .request
12
13
from warnings import warn
13
14
14
15
from ..core import PyPIRCCommand
15
- from distutils import log
16
+ from distutils . _log import log
16
17
17
18
18
19
class register (PyPIRCCommand ):
@@ -153,7 +154,7 @@ def send_metadata(self): # noqa: C901
153
154
3. have the server generate a new password for you (and email it to you), or
154
155
4. quit
155
156
Your selection [default 1]: ''' ,
156
- log .INFO ,
157
+ logging .INFO ,
157
158
)
158
159
choice = input ()
159
160
if not choice :
@@ -174,7 +175,7 @@ def send_metadata(self): # noqa: C901
174
175
auth .add_password (self .realm , host , username , password )
175
176
# send the info to the server and report the result
176
177
code , result = self .post_to_server (self .build_post_data ('submit' ), auth )
177
- self .announce ('Server response ({}): {}' .format (code , result ), log .INFO )
178
+ self .announce ('Server response ({}): {}' .format (code , result ), logging .INFO )
178
179
179
180
# possibly save the login
180
181
if code == 200 :
@@ -188,11 +189,11 @@ def send_metadata(self): # noqa: C901
188
189
'I can store your PyPI login so future '
189
190
'submissions will be faster.'
190
191
),
191
- log .INFO ,
192
+ logging .INFO ,
192
193
)
193
194
self .announce (
194
195
'(the login will be stored in %s)' % self ._get_rc_file (),
195
- log .INFO ,
196
+ logging .INFO ,
196
197
)
197
198
choice = 'X'
198
199
while choice .lower () not in 'yn' :
@@ -265,7 +266,8 @@ def post_to_server(self, data, auth=None): # noqa: C901
265
266
'''Post a query to the server, and return a string response.'''
266
267
if 'name' in data :
267
268
self .announce (
268
- 'Registering {} to {}' .format (data ['name' ], self .repository ), log .INFO
269
+ 'Registering {} to {}' .format (data ['name' ], self .repository ),
270
+ logging .INFO ,
269
271
)
270
272
# Build up the MIME payload for the urllib2 POST data
271
273
boundary = '--------------GHSKFJDLGDS7543FJKLFHRE75642756743254'
@@ -315,5 +317,5 @@ def post_to_server(self, data, auth=None): # noqa: C901
315
317
result = 200 , 'OK'
316
318
if self .show_response :
317
319
msg = '\n ' .join (('-' * 75 , data , '-' * 75 ))
318
- self .announce (msg , log .INFO )
320
+ self .announce (msg , logging .INFO )
319
321
return result
0 commit comments