diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/distutils2/command/register.py | 33 | ||||
| -rw-r--r-- | src/distutils2/command/upload.py | 44 | ||||
| -rw-r--r-- | src/distutils2/config.py | 33 |
3 files changed, 45 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() diff --git a/src/distutils2/config.py b/src/distutils2/config.py index ee54b98..ed08e2d 100644 --- a/src/distutils2/config.py +++ b/src/distutils2/config.py @@ -107,6 +107,39 @@ class PyPIRCCommand(Command): return {} + def _metadata_to_pypy_dict(self): + meta = self.distribution.metadata + data = { + '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'] + + return data + def initialize_options(self): """Initialize options.""" self.repository = None |
