[Python-checkins] distutils2: compiler_type -> name

tarek.ziade python-checkins at python.org
Sat Nov 13 12:40:55 CET 2010


tarek.ziade pushed 7ebf14ab2840 to distutils2:

http://hg.python.org/distutils2/rev/7ebf14ab2840
changeset:   816:7ebf14ab2840
tag:         tip
user:        Tarek Ziade <tarek at ziade.org>
date:        Sat Nov 13 12:40:33 2010 +0100
summary:     compiler_type -> name
files:       distutils2/compiler/__init__.py, distutils2/compiler/bcppcompiler.py, distutils2/compiler/ccompiler.py, distutils2/compiler/cygwinccompiler.py, distutils2/compiler/msvc9compiler.py, distutils2/compiler/msvccompiler.py, distutils2/compiler/unixccompiler.py, distutils2/tests/test_config.py

diff --git a/distutils2/compiler/__init__.py b/distutils2/compiler/__init__.py
--- a/distutils2/compiler/__init__.py
+++ b/distutils2/compiler/__init__.py
@@ -13,7 +13,7 @@
     Mainly needed on Unix, so we can plug in the information that
     varies across Unices and is stored in Python's Makefile.
     """
-    if compiler.compiler_type == "unix":
+    if compiler.name == "unix":
         (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \
             sysconfig.get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
                                        'CCSHARED', 'LDSHARED', 'SO', 'AR',
@@ -116,8 +116,8 @@
 def set_compiler(location):
     """Add or change a compiler"""
     klass = resolve_name(location)
-    # XXX we want to check teh class here
-    _COMPILERS[klass.compiler_type] = klass
+    # XXX we want to check the class here
+    _COMPILERS[klass.name] = klass
 
 
 def show_compilers():
diff --git a/distutils2/compiler/bcppcompiler.py b/distutils2/compiler/bcppcompiler.py
--- a/distutils2/compiler/bcppcompiler.py
+++ b/distutils2/compiler/bcppcompiler.py
@@ -26,7 +26,7 @@
     compiler, as defined by the CCompiler abstract class.
     """
 
-    compiler_type = 'bcpp'
+    name = 'bcpp'
     description = 'Borland C++ Compiler'
 
     # Just set this so CCompiler's constructor doesn't barf.  We currently
diff --git a/distutils2/compiler/ccompiler.py b/distutils2/compiler/ccompiler.py
--- a/distutils2/compiler/ccompiler.py
+++ b/distutils2/compiler/ccompiler.py
@@ -15,6 +15,7 @@
 from distutils2 import logger
 from distutils2.compiler import gen_preprocess_options
 
+
 class CCompiler(object):
     """Abstract base class to define the interface that must be implemented
     by real compiler classes.  Also has some utility methods used by
@@ -29,11 +30,11 @@
     attributes may be varied on a per-compilation or per-link basis.
     """
 
-    # 'compiler_type' is a class attribute that identifies this class.  It
+    # 'name' is a class attribute that identifies this class.  It
     # keeps code that wants to know what kind of compiler it's dealing with
     # from having to import all possible compiler classes just to do an
     # 'isinstance'.
-    compiler_type = None
+    name = None
     description = None
 
     # XXX things not handled by this compiler abstraction model:
diff --git a/distutils2/compiler/cygwinccompiler.py b/distutils2/compiler/cygwinccompiler.py
--- a/distutils2/compiler/cygwinccompiler.py
+++ b/distutils2/compiler/cygwinccompiler.py
@@ -85,7 +85,7 @@
 class CygwinCCompiler(UnixCCompiler):
     """ Handles the Cygwin port of the GNU C compiler to Windows.
     """
-    compiler_type = 'cygwin'
+    name = 'cygwin'
     description = 'Cygwin port of GNU C Compiler for Win32'
     obj_extension = ".o"
     static_lib_extension = ".a"
@@ -110,7 +110,7 @@
 
         self.gcc_version, self.ld_version, self.dllwrap_version = \
             get_compiler_versions()
-        self.debug_print(self.compiler_type + ": gcc %s, ld %s, dllwrap %s\n" %
+        self.debug_print(self.name + ": gcc %s, ld %s, dllwrap %s\n" %
                          (self.gcc_version,
                           self.ld_version,
                           self.dllwrap_version) )
@@ -272,7 +272,8 @@
 class Mingw32CCompiler(CygwinCCompiler):
     """ Handles the Mingw32 port of the GNU C compiler to Windows.
     """
-    compiler_type = 'mingw32'
+    name = 'mingw32'
+    description = 'MinGW32 compiler'
 
     def __init__(self, verbose=0, dry_run=0, force=0):
 
diff --git a/distutils2/compiler/msvc9compiler.py b/distutils2/compiler/msvc9compiler.py
--- a/distutils2/compiler/msvc9compiler.py
+++ b/distutils2/compiler/msvc9compiler.py
@@ -285,7 +285,7 @@
     """Concrete class that implements an interface to Microsoft Visual C++,
        as defined by the CCompiler abstract class."""
 
-    compiler_type = 'msvc'
+    name = 'msvc'
     description = 'Microsoft Visual C++'
 
     # Just set this so CCompiler's constructor doesn't barf.  We currently
diff --git a/distutils2/compiler/msvccompiler.py b/distutils2/compiler/msvccompiler.py
--- a/distutils2/compiler/msvccompiler.py
+++ b/distutils2/compiler/msvccompiler.py
@@ -205,7 +205,7 @@
     """Concrete class that implements an interface to Microsoft Visual C++,
        as defined by the CCompiler abstract class."""
 
-    compiler_type = 'msvc'
+    name = 'msvc'
     description = "Microsoft Visual C++"
 
     # Just set this so CCompiler's constructor doesn't barf.  We currently
diff --git a/distutils2/compiler/unixccompiler.py b/distutils2/compiler/unixccompiler.py
--- a/distutils2/compiler/unixccompiler.py
+++ b/distutils2/compiler/unixccompiler.py
@@ -106,7 +106,7 @@
 
 class UnixCCompiler(CCompiler):
 
-    compiler_type = 'unix'
+    name = 'unix'
     description = 'Standard UNIX-style compiler'
 
     # These are used by CCompiler in two places: the constructor sets
diff --git a/distutils2/tests/test_config.py b/distutils2/tests/test_config.py
--- a/distutils2/tests/test_config.py
+++ b/distutils2/tests/test_config.py
@@ -89,7 +89,7 @@
 
 
 class DCompiler(object):
-    compiler_type = 'd'
+    name = 'd'
     description = 'D Compiler'
 
     def __init__(self, *args):

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


More information about the Python-checkins mailing list