LEFT | RIGHT |
1 """distutils.command.upload | 1 """distutils.command.upload |
2 | 2 |
3 Implements the Distutils 'upload' subcommand (upload package to PyPI).""" | 3 Implements the Distutils 'upload' subcommand (upload package to PyPI).""" |
4 import os | 4 import os |
5 import socket | 5 import socket |
6 import platform | 6 import platform |
7 from urllib2 import urlopen, Request, HTTPError | 7 from urllib2 import urlopen, Request, HTTPError |
8 from base64 import standard_b64encode | 8 from base64 import standard_b64encode |
9 import urlparse | 9 import urlparse |
10 import cStringIO as StringIO | 10 import cStringIO as StringIO |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 ) | 43 ) |
44 config = self._read_pypirc() | 44 config = self._read_pypirc() |
45 if config != {}: | 45 if config != {}: |
46 self.username = config['username'] | 46 self.username = config['username'] |
47 self.password = config['password'] | 47 self.password = config['password'] |
48 self.repository = config['repository'] | 48 self.repository = config['repository'] |
49 self.realm = config['realm'] | 49 self.realm = config['realm'] |
50 | 50 |
51 # getting credentials from the distribution | 51 # getting credentials from the distribution |
52 # if previously set by the register command | 52 # if previously set by the register command |
53 if not self.username and self.distribution.username: | 53 if not self.username and self.distribution.username: |
54 self.username = self.distribution.username | 54 self.username = self.distribution.username |
55 if not self.password and self.distribution.password: | 55 if not self.password and self.distribution.password: |
56 self.password = self.distribution.password | 56 self.password = self.distribution.password |
57 | 57 |
58 def run(self): | 58 def run(self): |
59 if not self.distribution.dist_files: | 59 if not self.distribution.dist_files: |
60 raise DistutilsOptionError("No dist file created in earlier command"
) | 60 raise DistutilsOptionError("No dist file created in earlier command"
) |
61 for command, pyversion, filename in self.distribution.dist_files: | 61 for command, pyversion, filename in self.distribution.dist_files: |
62 self.upload_file(command, pyversion, filename) | 62 self.upload_file(command, pyversion, filename) |
63 | 63 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 reason = e.msg | 182 reason = e.msg |
183 | 183 |
184 if status == 200: | 184 if status == 200: |
185 self.announce('Server response (%s): %s' % (status, reason), | 185 self.announce('Server response (%s): %s' % (status, reason), |
186 log.INFO) | 186 log.INFO) |
187 else: | 187 else: |
188 self.announce('Upload failed (%s): %s' % (status, reason), | 188 self.announce('Upload failed (%s): %s' % (status, reason), |
189 log.ERROR) | 189 log.ERROR) |
190 if self.show_response: | 190 if self.show_response: |
191 self.announce('-'*75, result.read(), '-'*75) | 191 self.announce('-'*75, result.read(), '-'*75) |
LEFT | RIGHT |