summaryrefslogtreecommitdiff
path: root/src/distutils2/command
diff options
context:
space:
mode:
Diffstat (limited to 'src/distutils2/command')
-rw-r--r--src/distutils2/command/upload.py11
-rw-r--r--src/distutils2/command/upload_docs.py15
2 files changed, 20 insertions, 6 deletions
diff --git a/src/distutils2/command/upload.py b/src/distutils2/command/upload.py
index 18ebb77..3fdb5b3 100644
--- a/src/distutils2/command/upload.py
+++ b/src/distutils2/command/upload.py
@@ -7,7 +7,10 @@ import platform
from urllib2 import urlopen, Request, HTTPError
from base64 import standard_b64encode
import urlparse
-import StringIO as StringIO
+try:
+ from cStringIO import StringIO
+except ImportError:
+ from StringIO import StringIO
try:
from hashlib import md5
except ImportError:
@@ -135,7 +138,7 @@ class upload(Command):
boundary = '--------------GHSKFJDLGDS7543FJKLFHRE75642756743254'
sep_boundary = '\n--' + boundary
end_boundary = sep_boundary + '--'
- body = StringIO.StringIO()
+ body = StringIO()
file_fields = ('content', 'gpg_signature')
for key, values in data.items():
@@ -198,5 +201,7 @@ class upload(Command):
else:
self.announce('Upload failed (%s): %s' % (status, reason),
log.ERROR)
+
if self.show_response:
- self.announce('-'*75, result.read(), '-'*75)
+ msg = '\n'.join(('-' * 75, result.read(), '-' * 75))
+ self.announce(msg, log.INFO)
diff --git a/src/distutils2/command/upload_docs.py b/src/distutils2/command/upload_docs.py
index dbc31a0..d53dd03 100644
--- a/src/distutils2/command/upload_docs.py
+++ b/src/distutils2/command/upload_docs.py
@@ -1,5 +1,13 @@
-import base64, httplib, os.path, socket, urlparse, zipfile
-from cStringIO import StringIO
+import os
+import base64
+import httplib
+import socket
+import urlparse
+import zipfile
+try:
+ from cStringIO import StringIO
+except ImportError:
+ from StringIO import StringIO
from distutils2 import log
from distutils2.command.upload import upload
@@ -144,4 +152,5 @@ class upload_docs(Command):
log.ERROR)
if self.show_response:
- print "\n".join(['-'*75, r.read(), '-'*75])
+ msg = '\n'.join(('-' * 75, r.read(), '-' * 75))
+ self.announce(msg, log.INFO)