summaryrefslogtreecommitdiff
path: root/src/distutils2/command/upload.py
diff options
context:
space:
mode:
authorTarek Ziade <tarek@ziade.org>2010-04-13 01:23:15 +0200
committerTarek Ziade <tarek@ziade.org>2010-04-13 01:23:15 +0200
commit51394f229a01e2bf26ae5d019634400a15e0ae02 (patch)
tree8668d0508e2e6b7518b6e5ccf35d80772f5d9218 /src/distutils2/command/upload.py
parent0c38acb9a69aae99de8546ffa97bcd25c229945f (diff)
downloaddisutils2-51394f229a01e2bf26ae5d019634400a15e0ae02.tar.gz
refactored the code that builds the HTTP requests for both register and upload
Diffstat (limited to 'src/distutils2/command/upload.py')
-rw-r--r--src/distutils2/command/upload.py44
1 files changed, 10 insertions, 34 deletions
diff --git a/src/distutils2/command/upload.py b/src/distutils2/command/upload.py
index ab97b97..8295bc1 100644
--- a/src/distutils2/command/upload.py
+++ b/src/distutils2/command/upload.py
@@ -85,40 +85,16 @@ class upload(PyPIRCCommand):
content = open(filename,'rb').read()
meta = self.distribution.metadata
- data = {
- # action
- ':action': 'file_upload',
- 'protcol_version': '1',
-
- # identify release
- 'name': meta['Name'],
- 'version': meta['Version'],
-
- # file content
- 'content': (os.path.basename(filename),content),
- 'filetype': command,
- 'pyversion': pyversion,
- 'md5_digest': md5(content).hexdigest(),
-
- # additional meta-data
- # XXX Implement 1.1
- 'metadata_version' : '1.0',
- 'name': meta['Name'],
- 'version': meta['Version'],
- 'summary': meta['Summary'],
- 'home_page': meta['Home-page'],
- 'author': meta['Author'],
- 'author_email': meta['Author-email'],
- 'license': meta['License'],
- 'description': meta['Description'],
- 'keywords': meta['Keywords'],
- 'platform': meta['Platform'],
- 'classifiers': meta['Classifier'],
- 'download_url': meta['Download-URL'],
- #'provides': meta['Provides'],
- #'requires': meta['Requires'],
- #'obsoletes': meta['Obsoletes'],
- }
+ data = self._metadata_to_pypy_dict()
+
+ # extra upload infos
+ data[':action'] = 'file_upload'
+ data['protcol_version'] = '1'
+ data['content'] = os.path.basename(filename), content
+ data['filetype'] = command
+ data['pyversion'] = pyversion
+ data['md5_digest'] = md5(content).hexdigest()
+
comment = ''
if command == 'bdist_rpm':
dist, version, id = platform.dist()