summaryrefslogtreecommitdiff
path: root/setuptools/command/upload_docs.py
diff options
context:
space:
mode:
authorSteve Kowalik <steven@wedontsleep.org>2016-01-07 14:07:33 +1100
committerSteve Kowalik <steven@wedontsleep.org>2016-01-07 14:07:33 +1100
commit337ea160558acc352c8a61b9d27c93d1f9e09618 (patch)
tree52272a24ccb0b3be0d2349956c5fd44e5e65e565 /setuptools/command/upload_docs.py
parent3bd5118eaa87b4f6598e0a473fec3623b6579d3b (diff)
parentd49c41c6ebc16371efabe0b92b417457cf9c47d7 (diff)
downloadpython-setuptools-git-337ea160558acc352c8a61b9d27c93d1f9e09618.tar.gz
Merge from default.
Diffstat (limited to 'setuptools/command/upload_docs.py')
-rw-r--r--setuptools/command/upload_docs.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/setuptools/command/upload_docs.py b/setuptools/command/upload_docs.py
index 001ee936..ca35a3ce 100644
--- a/setuptools/command/upload_docs.py
+++ b/setuptools/command/upload_docs.py
@@ -16,17 +16,19 @@ import tempfile
import sys
import shutil
-from setuptools.compat import httplib, urlparse, unicode, iteritems, PY3
+from setuptools.extern import six
+from setuptools.extern.six.moves import http_client, urllib
+
from pkg_resources import iter_entry_points
-errors = 'surrogateescape' if PY3 else 'strict'
+errors = 'surrogateescape' if six.PY3 else 'strict'
# This is not just a replacement for byte literals
# but works as a general purpose encoder
def b(s, encoding='utf-8'):
- if isinstance(s, unicode):
+ if isinstance(s, six.text_type):
return s.encode(encoding, errors)
return s
@@ -113,7 +115,7 @@ class upload_docs(upload):
# set up the authentication
credentials = b(self.username + ':' + self.password)
credentials = standard_b64encode(credentials)
- if PY3:
+ if six.PY3:
credentials = credentials.decode('ascii')
auth = "Basic " + credentials
@@ -122,7 +124,7 @@ class upload_docs(upload):
sep_boundary = b('\n--') + b(boundary)
end_boundary = sep_boundary + b('--')
body = []
- for key, values in iteritems(data):
+ for key, values in six.iteritems(data):
title = '\nContent-Disposition: form-data; name="%s"' % key
# handle multiple entries for the same name
if not isinstance(values, list):
@@ -150,12 +152,12 @@ class upload_docs(upload):
# 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(self.repository)
+ urllib.parse.urlparse(self.repository)
assert not params and not query and not fragments
if schema == 'http':
- conn = httplib.HTTPConnection(netloc)
+ conn = http_client.HTTPConnection(netloc)
elif schema == 'https':
- conn = httplib.HTTPSConnection(netloc)
+ conn = http_client.HTTPSConnection(netloc)
else:
raise AssertionError("unsupported schema " + schema)