[Python-checkins] distutils2: Super considered super.

eric.araujo python-checkins at python.org
Mon Nov 14 15:24:07 CET 2011


http://hg.python.org/distutils2/rev/6d968e324bc5
changeset:   1239:6d968e324bc5
user:        Éric Araujo <merwok at netwok.org>
date:        Sat Nov 12 03:46:43 2011 +0100
summary:
  Super considered super.

I think I’ve got all of them (I’ll clean up compat after); if someone
knows a lint tool that can detect missing super calls, please let me
know.

files:
  distutils2/command/bdist_msi.py        |   2 +-
  distutils2/compiler/bcppcompiler.py    |   2 +-
  distutils2/compiler/cygwinccompiler.py |  25 ++++++-------
  distutils2/compiler/msvc9compiler.py   |   2 +-
  distutils2/compiler/msvccompiler.py    |   2 +-
  distutils2/metadata.py                 |   8 ++-
  distutils2/tests/pypi_server.py        |  15 +++----
  distutils2/tests/support.py            |   4 +-
  8 files changed, 29 insertions(+), 31 deletions(-)


diff --git a/distutils2/command/bdist_msi.py b/distutils2/command/bdist_msi.py
--- a/distutils2/command/bdist_msi.py
+++ b/distutils2/command/bdist_msi.py
@@ -35,7 +35,7 @@
     def __init__(self, *args, **kw):
         """Dialog(database, name, x, y, w, h, attributes, title, first,
         default, cancel, bitmap=true)"""
-        Dialog.__init__(self, *args)
+        super(PyDialog, self).__init__(*args)
         ruler = self.h - 36
         #if kw.get("bitmap", True):
         #    self.bitmap("Bitmap", 0, 0, bmwidth, ruler, "PythonWin")
diff --git a/distutils2/compiler/bcppcompiler.py b/distutils2/compiler/bcppcompiler.py
--- a/distutils2/compiler/bcppcompiler.py
+++ b/distutils2/compiler/bcppcompiler.py
@@ -48,7 +48,7 @@
 
 
     def __init__(self, verbose=0, dry_run=False, force=False):
-        CCompiler.__init__(self, verbose, dry_run, force)
+        super(BCPPCompiler, self).__init__(verbose, dry_run, force)
 
         # These executables are assumed to all be in the path.
         # Borland doesn't seem to use any special registry settings to
diff --git a/distutils2/compiler/cygwinccompiler.py b/distutils2/compiler/cygwinccompiler.py
--- a/distutils2/compiler/cygwinccompiler.py
+++ b/distutils2/compiler/cygwinccompiler.py
@@ -93,8 +93,7 @@
     exe_extension = ".exe"
 
     def __init__(self, verbose=0, dry_run=False, force=False):
-
-        UnixCCompiler.__init__(self, verbose, dry_run, force)
+        super(CygwinCCompiler, self).__init__(verbose, dry_run, force)
 
         status, details = check_config_h()
         logger.debug("Python's GCC status: %s (details: %s)", status, details)
@@ -234,12 +233,11 @@
         if not debug:
             extra_preargs.append("-s")
 
-        UnixCCompiler.link(self, target_desc, objects, output_filename,
-                           output_dir, libraries, library_dirs,
-                           runtime_library_dirs,
-                           None, # export_symbols, we do this in our def-file
-                           debug, extra_preargs, extra_postargs, build_temp,
-                           target_lang)
+        super(CygwinCCompiler, self).link(
+            target_desc, objects, output_filename, output_dir, libraries,
+            library_dirs, runtime_library_dirs,
+            None, # export_symbols, we do this in our def-file
+            debug, extra_preargs, extra_postargs, build_temp, target_lang)
 
     # -- Miscellaneous methods -----------------------------------------
 
@@ -255,14 +253,14 @@
             if ext not in (self.src_extensions + ['.rc','.res']):
                 raise UnknownFileError("unknown file type '%s' (from '%s')" % (ext, src_name))
             if strip_dir:
-                base = os.path.basename (base)
+                base = os.path.basename(base)
             if ext in ('.res', '.rc'):
                 # these need to be compiled to object files
-                obj_names.append (os.path.join(output_dir,
+                obj_names.append(os.path.join(output_dir,
                                               base + ext + self.obj_extension))
             else:
-                obj_names.append (os.path.join(output_dir,
-                                               base + self.obj_extension))
+                obj_names.append(os.path.join(output_dir,
+                                              base + self.obj_extension))
         return obj_names
 
 # the same as cygwin plus some additional parameters
@@ -273,8 +271,7 @@
     description = 'MinGW32 compiler'
 
     def __init__(self, verbose=0, dry_run=False, force=False):
-
-        CygwinCCompiler.__init__ (self, verbose, dry_run, force)
+        super(Mingw32CCompiler, self).__init__(verbose, dry_run, force)
 
         # ld_version >= "2.13" support -shared so use it instead of
         # -mdll -static
diff --git a/distutils2/compiler/msvc9compiler.py b/distutils2/compiler/msvc9compiler.py
--- a/distutils2/compiler/msvc9compiler.py
+++ b/distutils2/compiler/msvc9compiler.py
@@ -310,7 +310,7 @@
     exe_extension = '.exe'
 
     def __init__(self, verbose=0, dry_run=False, force=False):
-        CCompiler.__init__(self, verbose, dry_run, force)
+        super(MSVCCompiler, self).__init__(verbose, dry_run, force)
         self.__version = VERSION
         self.__root = r"Software\Microsoft\VisualStudio"
         # self.__macros = MACROS
diff --git a/distutils2/compiler/msvccompiler.py b/distutils2/compiler/msvccompiler.py
--- a/distutils2/compiler/msvccompiler.py
+++ b/distutils2/compiler/msvccompiler.py
@@ -237,7 +237,7 @@
     exe_extension = '.exe'
 
     def __init__(self, verbose=0, dry_run=False, force=False):
-        CCompiler.__init__(self, verbose, dry_run, force)
+        super(MSVCCompiler, self).__init__(verbose, dry_run, force)
         self.__version = get_build_version()
         self.__arch = get_build_architecture()
         if self.__arch == "Intel":
diff --git a/distutils2/metadata.py b/distutils2/metadata.py
--- a/distutils2/metadata.py
+++ b/distutils2/metadata.py
@@ -24,13 +24,14 @@
     from docutils import frontend
     from docutils import nodes
 
-    class SilentReporter(Reporter):
+    class SilentReporter(Reporter, object):
 
         def __init__(self, source, report_level, halt_level, stream=None,
                      debug=0, encoding='ascii', error_handler='replace'):
             self.messages = []
-            Reporter.__init__(self, source, report_level, halt_level, stream,
-                              debug, encoding, error_handler)
+            super(SilentReporter, self).__init__(
+                source, report_level, halt_level, stream,
+                debug, encoding, error_handler)
 
         def system_message(self, level, message, *children, **kwargs):
             self.messages.append((level, message, children, kwargs))
@@ -185,6 +186,7 @@
 
 _FILESAFE = re.compile('[^A-Za-z0-9.]+')
 
+
 class Metadata(object):
     """The metadata of a release.
 
diff --git a/distutils2/tests/pypi_server.py b/distutils2/tests/pypi_server.py
--- a/distutils2/tests/pypi_server.py
+++ b/distutils2/tests/pypi_server.py
@@ -33,7 +33,6 @@
 import Queue
 import select
 import threading
-import SocketServer
 from BaseHTTPServer import HTTPServer
 from SimpleHTTPServer import SimpleHTTPRequestHandler
 from SimpleXMLRPCServer import SimpleXMLRPCServer
@@ -42,7 +41,6 @@
 from distutils2.compat import wraps
 
 
-
 PYPI_DEFAULT_STATIC_PATH = os.path.join(
     os.path.dirname(os.path.abspath(__file__)), 'pypiserver')
 
@@ -105,7 +103,7 @@
         """
         # we want to launch the server in a new dedicated thread, to not freeze
         # tests.
-        threading.Thread.__init__(self)
+        super(PyPIServer, self).__init__()
         self._run = True
         self._serve_xmlrpc = serve_xmlrpc
         if static_filesystem_paths is None:
@@ -275,10 +273,10 @@
         self.wfile.write(data)
 
 
-class PyPIXMLRPCServer(SimpleXMLRPCServer):
+class PyPIXMLRPCServer(SimpleXMLRPCServer, object):
     def server_bind(self):
         """Override server_bind to store the server name."""
-        SocketServer.TCPServer.server_bind(self)
+        super(PyPIXMLRPCServer, self).server_bind()
         host, port = self.socket.getsockname()[:2]
         self.server_port = port
 
@@ -379,12 +377,13 @@
             'requires_python': self.requires_python,
             'classifiers': [],
             'name': self.name,
-            'licence': self.licence,
+            'licence': self.licence,  # XXX licence or license?
             'summary': self.summary,
             'home_page': self.homepage,
             'stable_version': self.stable_version,
-            'provides_dist': self.provides_dist or "%s (%s)" % (self.name,
-                                                              self.version),
+            # FIXME doesn't that reproduce the bug from 6527d3106e9f?
+            'provides_dist': (self.provides_dist or
+                             "%s (%s)" % (self.name, self.version)),
             'requires': self.requires,
             'cheesecake_installability_id': self.cheesecake_installability_id,
         }
diff --git a/distutils2/tests/support.py b/distutils2/tests/support.py
--- a/distutils2/tests/support.py
+++ b/distutils2/tests/support.py
@@ -69,11 +69,11 @@
 logger2to3 = logging.getLogger('RefactoringTool')
 
 
-class _TestHandler(logging.handlers.BufferingHandler):
+class _TestHandler(logging.handlers.BufferingHandler, object):
     # stolen and adapted from test.support
 
     def __init__(self):
-        logging.handlers.BufferingHandler.__init__(self, 0)
+        super(_TestHandler, self).__init__(0)
         self.setLevel(logging.DEBUG)
 
     def shouldFlush(self):

-- 
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list