aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/upload_docs.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2016-05-31 21:52:19 -0400
committerJason R. Coombs <jaraco@jaraco.com>2016-05-31 21:52:19 -0400
commit5e9c9d2fc751749e9ced584a548b197a552179bf (patch)
tree171aa75868ae96634c733c9ea49f586c87e2e592 /setuptools/command/upload_docs.py
parent81d8a9560f4a14fe5376f4d86643aa6bdf361869 (diff)
downloadexternal_python_setuptools-5e9c9d2fc751749e9ced584a548b197a552179bf.tar.gz
external_python_setuptools-5e9c9d2fc751749e9ced584a548b197a552179bf.tar.bz2
external_python_setuptools-5e9c9d2fc751749e9ced584a548b197a552179bf.zip
Extract method for _build_multipart
Diffstat (limited to 'setuptools/command/upload_docs.py')
-rw-r--r--setuptools/command/upload_docs.py26
1 files changed, 16 insertions, 10 deletions
diff --git a/setuptools/command/upload_docs.py b/setuptools/command/upload_docs.py
index 7136fea0..de38e8af 100644
--- a/setuptools/command/upload_docs.py
+++ b/setuptools/command/upload_docs.py
@@ -116,6 +116,21 @@ class upload_docs(upload):
if value and value[-1:] == b'\r':
yield b'\n' # write an extra newline (lurve Macs)
+ @classmethod
+ def _build_multipart(cls, data):
+ """
+ Build up the MIME payload for the POST data
+ """
+ boundary = b'--------------GHSKFJDLGDS7543FJKLFHRE75642756743254'
+ sep_boundary = b'\n--' + boundary
+ end_boundary = sep_boundary + b'--'
+ end_items = end_boundary, b"\n",
+ body_items = itertools.chain(
+ cls._build_parts(data, sep_boundary),
+ end_items,
+ )
+ return b''.join(body_items)
+
def upload_file(self, filename):
with open(filename, 'rb') as f:
content = f.read()
@@ -132,16 +147,7 @@ class upload_docs(upload):
credentials = credentials.decode('ascii')
auth = "Basic " + credentials
- # Build up the MIME payload for the POST data
- boundary = b'--------------GHSKFJDLGDS7543FJKLFHRE75642756743254'
- sep_boundary = b'\n--' + boundary
- end_boundary = sep_boundary + b'--'
- end_items = end_boundary, b"\n",
- body_items = itertools.chain(
- self._build_parts(data, sep_boundary),
- end_items,
- )
- body = b''.join(body_items)
+ body = self._build_multipart(data)
self.announce("Submitting documentation to %s" % (self.repository),
log.INFO)