diff options
| author | Bastian Venthur <bastian.venthur@flixbus.com> | 2020-02-11 09:55:35 +0100 |
|---|---|---|
| committer | Bastian Venthur <bastian.venthur@flixbus.com> | 2020-02-11 09:55:35 +0100 |
| commit | 087c3b26eed9b6a8960815c2773edd04b5c91a98 (patch) | |
| tree | c0b0bf68b6f02980f742611c9232405ab9df299b /setuptools/command/upload_docs.py | |
| parent | c11270aa6bffd8913c6e074f09b9d920c8f19002 (diff) | |
| parent | a5dec2f14e3414e4ee5dd146bff9c289d573de9a (diff) | |
| download | python-setuptools-git-087c3b26eed9b6a8960815c2773edd04b5c91a98.tar.gz | |
Merge branch 'master' into fix/1700
Diffstat (limited to 'setuptools/command/upload_docs.py')
| -rw-r--r-- | setuptools/command/upload_docs.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/setuptools/command/upload_docs.py b/setuptools/command/upload_docs.py index 07aa564a..0351da77 100644 --- a/setuptools/command/upload_docs.py +++ b/setuptools/command/upload_docs.py @@ -24,7 +24,7 @@ from .upload import upload def _encode(s): - errors = 'surrogateescape' if six.PY3 else 'strict' + errors = 'strict' if six.PY2 else 'surrogateescape' return s.encode('utf-8', errors) @@ -127,8 +127,8 @@ class upload_docs(upload): """ Build up the MIME payload for the POST data """ - boundary = b'--------------GHSKFJDLGDS7543FJKLFHRE75642756743254' - sep_boundary = b'\n--' + boundary + boundary = '--------------GHSKFJDLGDS7543FJKLFHRE75642756743254' + sep_boundary = b'\n--' + boundary.encode('ascii') end_boundary = sep_boundary + b'--' end_items = end_boundary, b"\n", builder = functools.partial( @@ -138,7 +138,7 @@ class upload_docs(upload): part_groups = map(builder, data.items()) parts = itertools.chain.from_iterable(part_groups) body_items = itertools.chain(parts, end_items) - content_type = 'multipart/form-data; boundary=%s' % boundary.decode('ascii') + content_type = 'multipart/form-data; boundary=%s' % boundary return b''.join(body_items), content_type def upload_file(self, filename): @@ -153,7 +153,7 @@ class upload_docs(upload): # set up the authentication credentials = _encode(self.username + ':' + self.password) credentials = standard_b64encode(credentials) - if six.PY3: + if not six.PY2: credentials = credentials.decode('ascii') auth = "Basic " + credentials |
