diff options
| author | Tarek Ziade <tarek@ziade.org> | 2010-04-13 01:23:15 +0200 |
|---|---|---|
| committer | Tarek Ziade <tarek@ziade.org> | 2010-04-13 01:23:15 +0200 |
| commit | 51394f229a01e2bf26ae5d019634400a15e0ae02 (patch) | |
| tree | 8668d0508e2e6b7518b6e5ccf35d80772f5d9218 /src/distutils2/command | |
| parent | 0c38acb9a69aae99de8546ffa97bcd25c229945f (diff) | |
| download | disutils2-51394f229a01e2bf26ae5d019634400a15e0ae02.tar.gz | |
refactored the code that builds the HTTP requests for both register and upload
Diffstat (limited to 'src/distutils2/command')
| -rw-r--r-- | src/distutils2/command/register.py | 33 | ||||
| -rw-r--r-- | src/distutils2/command/upload.py | 44 |
2 files changed, 12 insertions, 65 deletions
diff --git a/src/distutils2/command/register.py b/src/distutils2/command/register.py index 0a64442..dbaab85 100644 --- a/src/distutils2/command/register.py +++ b/src/distutils2/command/register.py @@ -224,37 +224,8 @@ Your selection [default 1]: ''', log.INFO) def build_post_data(self, action): # figure the data to send - the metadata plus some additional # information used by the package server - meta = self.distribution.metadata - data = { - ':action': action, - 'metadata_version' : meta.version, - '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'], - 'classifier': meta['Classifier'], - 'download_url': meta['Download-URL'], - } - - if meta.version == '1.2': - data['requires_dist'] = meta['Requires-Dist'] - data['requires_python'] = meta['Requires-Python'] - data['requires_external'] = meta['Requires-External'] - data['provides_dist'] = meta['Provides-Dist'] - data['obsoletes_dist'] = meta['Obsoletes-Dist'] - data['project_url'] = meta['Project-URL'] - - elif meta.version == '1.1': - data['provides'] = meta['Provides'] - data['requires'] = meta['Requires'] - data['obsoletes'] = meta['Obsoletes'] - + data = self._metadata_to_pypy_dict() + data[':action'] = action return data def post_to_server(self, data, auth=None): 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() |
