aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/upload.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2011-06-20 22:55:16 +0100
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2011-06-20 22:55:16 +0100
commit58a658b26d1c95b31d02050dcccd648d2e4ce27b (patch)
treeb9d3e7de6f6d23b91a7afecde3491e99d8cc7069 /setuptools/command/upload.py
parente63f3e7d864b26529d6b197e053b4084be20decf (diff)
downloadexternal_python_setuptools-58a658b26d1c95b31d02050dcccd648d2e4ce27b.tar.gz
external_python_setuptools-58a658b26d1c95b31d02050dcccd648d2e4ce27b.tar.bz2
external_python_setuptools-58a658b26d1c95b31d02050dcccd648d2e4ce27b.zip
Changes to support 2.x and 3.x in the same codebase.
--HG-- branch : distribute extra : rebase_source : 7d3608edee54a43789f0574d702fb839628b5071
Diffstat (limited to 'setuptools/command/upload.py')
-rwxr-xr-xsetuptools/command/upload.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/setuptools/command/upload.py b/setuptools/command/upload.py
index 1f49745e..6b18d761 100755
--- a/setuptools/command/upload.py
+++ b/setuptools/command/upload.py
@@ -11,13 +11,12 @@ try:
except ImportError:
from md5 import md5
import os
+import sys
import socket
import platform
-import ConfigParser
-import httplib
import base64
-import urlparse
-import cStringIO as StringIO
+
+from setuptools.compat import urlparse, StringIO, httplib, ConfigParser
class upload(Command):
@@ -49,7 +48,7 @@ class upload(Command):
raise DistutilsOptionError(
"Must use --sign for --identity to have meaning"
)
- if os.environ.has_key('HOME'):
+ if 'HOME' in os.environ:
rc = os.path.join(os.environ['HOME'], '.pypirc')
if os.path.exists(rc):
self.announce('Using PyPI login from %s' % rc)
@@ -148,14 +147,14 @@ class upload(Command):
# We can't use urllib2 since we need to send the Basic
# auth right with the first request
schema, netloc, url, params, query, fragments = \
- urlparse.urlparse(self.repository)
+ urlparse(self.repository)
assert not params and not query and not fragments
if schema == 'http':
http = httplib.HTTPConnection(netloc)
elif schema == 'https':
http = httplib.HTTPSConnection(netloc)
else:
- raise AssertionError, "unsupported schema "+schema
+ raise AssertionError("unsupported schema " + schema)
data = ''
loglevel = log.INFO
@@ -168,7 +167,8 @@ class upload(Command):
http.putheader('Authorization', auth)
http.endheaders()
http.send(body)
- except socket.error, e:
+ except socket.error:
+ e = sys.exc_info()[1]
self.announce(str(e), log.ERROR)
return
@@ -180,4 +180,4 @@ class upload(Command):
self.announce('Upload failed (%s): %s' % (r.status, r.reason),
log.ERROR)
if self.show_response:
- print '-'*75, r.read(), '-'*75
+ print('-'*75, r.read(), '-'*75)