summaryrefslogtreecommitdiffstats
path: root/Lib/distutils
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2014-05-10 17:20:28 (GMT)
committerJason R. Coombs <jaraco@jaraco.com>2014-05-10 17:20:28 (GMT)
commit7ae0fde001b32b4141a3641ab358345b15b4c836 (patch)
tree1c8000181e81c013a4f3a6f7dd6bc2038f4f2071 /Lib/distutils
parentf84866c9af5d5ae8b6ec0e7eac817a79b9926ed4 (diff)
downloadcpython-7ae0fde001b32b4141a3641ab358345b15b4c836.zip
cpython-7ae0fde001b32b4141a3641ab358345b15b4c836.tar.gz
cpython-7ae0fde001b32b4141a3641ab358345b15b4c836.tar.bz2
Clean up style in distutils upload command
Diffstat (limited to 'Lib/distutils')
-rw-r--r--Lib/distutils/command/upload.py33
1 files changed, 19 insertions, 14 deletions
diff --git a/Lib/distutils/command/upload.py b/Lib/distutils/command/upload.py
index d6762e4..4882db4 100644
--- a/Lib/distutils/command/upload.py
+++ b/Lib/distutils/command/upload.py
@@ -1,18 +1,21 @@
-"""distutils.command.upload
+"""
+distutils.command.upload
-Implements the Distutils 'upload' subcommand (upload package to PyPI)."""
+Implements the Distutils 'upload' subcommand (upload package to a package
+index).
+"""
-from distutils.errors import *
-from distutils.core import PyPIRCCommand
-from distutils.spawn import spawn
-from distutils import log
import sys
-import os, io
-import socket
+import os
+import io
import platform
from base64 import standard_b64encode
from urllib.request import urlopen, Request, HTTPError
from urllib.parse import urlparse
+from distutils.errors import *
+from distutils.core import PyPIRCCommand
+from distutils.spawn import spawn
+from distutils import log
# this keeps compatibility for 2.3 and 2.4
if sys.version < "2.5":
@@ -106,7 +109,7 @@ class upload(PyPIRCCommand):
'md5_digest': md5(content).hexdigest(),
# additional meta-data
- 'metadata_version' : '1.0',
+ 'metadata_version': '1.0',
'summary': meta.get_description(),
'home_page': meta.get_url(),
'author': meta.get_contact(),
@@ -167,13 +170,15 @@ class upload(PyPIRCCommand):
body.write(b"\n")
body = body.getvalue()
- self.announce("Submitting %s to %s" % (filename, self.repository), log.INFO)
+ msg = "Submitting %s to %s" % (filename, self.repository)
+ self.announce(msg, log.INFO)
# build the Request
- headers = {'Content-type':
- 'multipart/form-data; boundary=%s' % boundary,
- 'Content-length': str(len(body)),
- 'Authorization': auth}
+ headers = {
+ 'Content-type': 'multipart/form-data; boundary=%s' % boundary,
+ 'Content-length': str(len(body)),
+ 'Authorization': auth,
+ }
request = Request(self.repository, data=body,
headers=headers)