mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
code cleanup
This commit is contained in:
parent
9f7baec574
commit
d7c5cee2d5
1 changed files with 9 additions and 13 deletions
|
@ -1,11 +1,6 @@
|
||||||
"""distutils.command.upload
|
"""distutils.command.upload
|
||||||
|
|
||||||
Implements the Distutils 'upload' subcommand (upload package to PyPI)."""
|
Implements the Distutils 'upload' subcommand (upload package to PyPI)."""
|
||||||
|
|
||||||
from distutils.errors import *
|
|
||||||
from distutils.core import PyPIRCCommand
|
|
||||||
from distutils.spawn import spawn
|
|
||||||
from distutils import log
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
|
@ -15,12 +10,12 @@ import base64
|
||||||
import urlparse
|
import urlparse
|
||||||
import cStringIO as StringIO
|
import cStringIO as StringIO
|
||||||
from ConfigParser import ConfigParser
|
from ConfigParser import ConfigParser
|
||||||
|
from hashlib import md5
|
||||||
|
|
||||||
# this keeps compatibility for 2.3 and 2.4
|
from distutils.errors import *
|
||||||
if sys.version < "2.5":
|
from distutils.core import PyPIRCCommand
|
||||||
from md5 import md5
|
from distutils.spawn import spawn
|
||||||
else:
|
from distutils import log
|
||||||
from hashlib import md5
|
|
||||||
|
|
||||||
class upload(PyPIRCCommand):
|
class upload(PyPIRCCommand):
|
||||||
|
|
||||||
|
@ -125,7 +120,8 @@ class upload(PyPIRCCommand):
|
||||||
open(filename+".asc").read())
|
open(filename+".asc").read())
|
||||||
|
|
||||||
# set up the authentication
|
# set up the authentication
|
||||||
auth = "Basic " + base64.encodestring(self.username + ":" + self.password).strip()
|
auth = "Basic " + base64.encodestring(self.username + ":" +
|
||||||
|
self.password).strip()
|
||||||
|
|
||||||
# Build up the MIME payload for the POST data
|
# Build up the MIME payload for the POST data
|
||||||
boundary = '--------------GHSKFJDLGDS7543FJKLFHRE75642756743254'
|
boundary = '--------------GHSKFJDLGDS7543FJKLFHRE75642756743254'
|
||||||
|
@ -134,10 +130,10 @@ class upload(PyPIRCCommand):
|
||||||
body = StringIO.StringIO()
|
body = StringIO.StringIO()
|
||||||
for key, value in data.items():
|
for key, value in data.items():
|
||||||
# handle multiple entries for the same name
|
# handle multiple entries for the same name
|
||||||
if type(value) != type([]):
|
if not isinstance(value, list):
|
||||||
value = [value]
|
value = [value]
|
||||||
for value in value:
|
for value in value:
|
||||||
if type(value) is tuple:
|
if isinstance(value, tuple):
|
||||||
fn = ';filename="%s"' % value[0]
|
fn = ';filename="%s"' % value[0]
|
||||||
value = value[1]
|
value = value[1]
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue