Anonymous avatar Anonymous committed 77db8a2

Reverting 1a1ab844f03e due to issue 250

Comments (0)

Files changed (4)

distribute.egg-info/entry_points.txt

 egg_info = setuptools.command.egg_info:egg_info
 register = setuptools.command.register:register
 upload_docs = setuptools.command.upload_docs:upload_docs
-upload = setuptools.command.upload:upload
 install_egg_info = setuptools.command.install_egg_info:install_egg_info
 alias = setuptools.command.alias:alias
 easy_install = setuptools.command.easy_install:easy_install

setuptools/command/__init__.py

 from setuptools.command import install_scripts
 import sys
 
+if sys.version>='2.5':
+    # In Python 2.5 and above, distutils includes its own upload command
+    __all__.remove('upload')
+
 from distutils.command.bdist import bdist
 
 if 'egg' not in bdist.format_commands:

setuptools/command/register.py

 from distutils.command.register import register as _register
-from ConfigParser import ConfigParser
-import os
 
 class register(_register):
     __doc__ = _register.__doc__
     def run(self):
         # Make sure that we are using valid current name/version info
         self.run_command('egg_info')
-        self._section_name = self.repository
         _register.run(self)
 
-    def _read_pypirc(self):
-        """Reads the .pypirc file."""
-        rc = self._get_rc_file()
-        if os.path.exists(rc):
-            repository = self.repository
-            config = ConfigParser()
-            config.read(rc)
-            sections = config.sections()
-            if 'distutils' in sections:
-                # let's get the list of servers
-                index_servers = config.get('distutils', 'index-servers')
-                _servers = [server.strip() for server in
-                            index_servers.split('\n')
-                            if server.strip() != '']
-                if _servers == []:
-                    # nothing set, let's try to get the default pypi
-                    if 'pypi' in sections:
-                        _servers = ['pypi']
-                    else:
-                        # the file is not properly defined, returning
-                        # an empty dict
-                        return {}
-                for server in _servers:
-                    current = {'server': server}
-                    current['username'] = config.get(server, 'username')
-
-                    # optional params
-                    for key, default in (('repository',
-                                          None),
-                                         ('realm', self.DEFAULT_REALM),
-                                         ('password', None)):
-                        if config.has_option(server, key):
-                            current[key] = config.get(server, key)
-                        else:
-                            current[key] = default
-                    if (current['server'] == repository or
-                        current['repository'] == repository):
-                        return current
-            elif 'server-login' in sections:
-                # old format
-                server = 'server-login'
-                if config.has_option(server, 'repository'):
-                    repository = config.get(server, 'repository')
-                else:
-                    repository = None
-                return {'username': config.get(server, 'username'),
-                        'password': config.get(server, 'password'),
-                        'repository': repository,
-                        'server': server,
-                        'realm': self.DEFAULT_REALM}
-
-        return {}
-
-    def _set_config(self):
-        _register._set_config(self)
-        if self.repository is None:
-                raise ValueError('%s is missing a repository value in .pypirc' % self._section_name)

setuptools/command/upload.py

 
 Implements the Distutils 'upload' subcommand (upload package to PyPI)."""
 
-
 from distutils.errors import *
 from distutils.core import Command
 from distutils.spawn import spawn
 except ImportError:
     from md5 import md5
 import os
-import sys
 import socket
 import platform
 import ConfigParser
 import urlparse
 import cStringIO as StringIO
 
-class _upload(Command):
+class upload(Command):
 
     description = "upload binary package to PyPI"
 
                 if not self.password:
                     self.password = config.get('server-login', 'password')
         if not self.repository:
-            raise ValueError('%s is missing a repository value in .pypirc' % self._section_name)
+            self.repository = self.DEFAULT_REPOSITORY
 
     def run(self):
         if not self.distribution.dist_files:
         if self.show_response:
             print '-'*75, r.read(), '-'*75
 
-if sys.version >= "2.5":
-    from distutils.command.upload import upload as distutils_upload
-    class upload(distutils_upload):
-
-        def run(self):
-            self._section_name = self.repository
-            distutils_upload.run(self)
-
-        def _read_pypirc(self):
-            """Reads the .pypirc file."""
-            self._section_name = self.repository
-            rc = self._get_rc_file()
-            if os.path.exists(rc):
-                repository = self.repository
-                config = ConfigParser.ConfigParser()
-                config.read(rc)
-                sections = config.sections()
-                if 'distutils' in sections:
-                    # let's get the list of servers
-                    index_servers = config.get('distutils', 'index-servers')
-                    _servers = [server.strip() for server in
-                                index_servers.split('\n')
-                                if server.strip() != '']
-                    if _servers == []:
-                        # nothing set, let's try to get the default pypi
-                        if 'pypi' in sections:
-                            _servers = ['pypi']
-                        else:
-                            # the file is not properly defined, returning
-                            # an empty dict
-                            return {}
-                    for server in _servers:
-                        current = {'server': server}
-                        current['username'] = config.get(server, 'username')
-
-                        # optional params
-                        for key, default in (('repository',
-                                              None),
-                                             ('realm', self.DEFAULT_REALM),
-                                             ('password', None)):
-                            if config.has_option(server, key):
-                                current[key] = config.get(server, key)
-                            else:
-                                current[key] = default
-                                if (current['server'] == repository:
-                            return current
-                elif 'server-login' in sections:
-                    # old format
-                    server = 'server-login'
-                    if config.has_option(server, 'repository'):
-                        repository = config.get(server, 'repository')
-                    else:
-                        repository = None
-                    return {'username': config.get(server, 'username'),
-                            'password': config.get(server, 'password'),
-                            'repository': repository,
-                            'server': server,
-                            'realm': self.DEFAULT_REALM}
-
-            return {}
-
-        def finalize_options(self):
-            distutils_upload.finalize_options(self)
-            if not self.repository:
-                raise ValueError('%s is missing a repository value in .pypirc' % self._section_name)
-
-
-else:
-    upload = _upload
-
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.