[Numpy-svn] r3781 - in trunk/numpy/distutils: . command

numpy-svn at scipy.org numpy-svn at scipy.org
Fri May 18 16:41:19 EDT 2007


Author: pearu
Date: 2007-05-18 15:41:10 -0500 (Fri, 18 May 2007)
New Revision: 3781

Modified:
   trunk/numpy/distutils/command/build.py
   trunk/numpy/distutils/command/config.py
   trunk/numpy/distutils/command/config_compiler.py
   trunk/numpy/distutils/core.py
Log:
added config to --fcompiler option unification method. introduced config_cc for unifying --compiler options.

Modified: trunk/numpy/distutils/command/build.py
===================================================================
--- trunk/numpy/distutils/command/build.py	2007-05-18 20:17:48 UTC (rev 3780)
+++ trunk/numpy/distutils/command/build.py	2007-05-18 20:41:10 UTC (rev 3781)
@@ -5,7 +5,8 @@
 
 class build(old_build):
 
-    sub_commands = [('config_fc',     lambda *args: True),
+    sub_commands = [('config_cc',     lambda *args: True),
+                    ('config_fc',     lambda *args: True),
                     ('build_src',     old_build.has_ext_modules),
                     ] + old_build.sub_commands
 

Modified: trunk/numpy/distutils/command/config.py
===================================================================
--- trunk/numpy/distutils/command/config.py	2007-05-18 20:17:48 UTC (rev 3780)
+++ trunk/numpy/distutils/command/config.py	2007-05-18 20:41:10 UTC (rev 3781)
@@ -14,8 +14,7 @@
 
 class config(old_config):
     old_config.user_options += [
-        ('fcompiler=', None,
-         "specify the Fortran compiler type"),
+        ('fcompiler=', None, "specify the Fortran compiler type"),
         ]
 
     def initialize_options(self):
@@ -23,13 +22,6 @@
         old_config.initialize_options(self)
         return
 
-    def finalize_options(self):
-        old_config.finalize_options(self)
-        f = self.distribution.get_command_obj('config_fc')
-        self.set_undefined_options('config_fc',
-                                   ('fcompiler', 'fcompiler'))
-        return
-
     def _check_compiler (self):
         old_config._check_compiler(self)
         from numpy.distutils.fcompiler import FCompiler, new_fcompiler

Modified: trunk/numpy/distutils/command/config_compiler.py
===================================================================
--- trunk/numpy/distutils/command/config_compiler.py	2007-05-18 20:17:48 UTC (rev 3780)
+++ trunk/numpy/distutils/command/config_compiler.py	2007-05-18 20:41:10 UTC (rev 3781)
@@ -57,12 +57,14 @@
         return
 
     def finalize_options(self):
-        log.info('unifing config_fc, build_ext, build_clib commands fcompiler options')
+        log.info('unifing config_fc, config, build_clib, build_ext commands --fcompiler options')
         build_clib = self.get_finalized_command('build_clib')
         build_ext = self.get_finalized_command('build_ext')
+        config = self.get_finalized_command('config')
+        cmd_list = [self, config, build_clib, build_ext]
         for a in ['fcompiler']:
             l = []
-            for c in [self, build_clib, build_ext]:
+            for c in cmd_list:
                 v = getattr(c,a)
                 if v is not None and v not in l: l.append(v)
             if not l: v1 = None
@@ -71,10 +73,48 @@
                 log.warn('  commands have different --%s options: %s'\
                          ', using first in list as default' % (a, l))
             if v1:
-                for c in [self, build_clib, build_ext]:
+                for c in cmd_list:
                     if getattr(c,a) is None: setattr(c, a, v1)
         return
 
     def run(self):
         # Do nothing.
         return
+
+class config_cc(Command):
+    """ Distutils command to hold user specified options
+    to C/C++ compilers.
+    """
+
+    user_options = [
+        ('compiler=',None,"specify C/C++ compiler type"),
+        ]
+
+    def initialize_options(self):
+        self.compiler = None
+        return
+
+    def finalize_options(self):
+        log.info('unifing config_cc, config, build_clib, build_ext commands --compiler options')
+        build_clib = self.get_finalized_command('build_clib')
+        build_ext = self.get_finalized_command('build_ext')
+        config = self.get_finalized_command('config')
+        cmd_list = [self, config, build_clib, build_ext]
+        for a in ['compiler']:
+            l = []
+            for c in cmd_list:
+                v = getattr(c,a)
+                if v is not None and v not in l: l.append(v)
+            if not l: v1 = None
+            else: v1 = l[0]
+            if len(l)>1:
+                log.warn('  commands have different --%s options: %s'\
+                         ', using first in list as default' % (a, l))
+            if v1:
+                for c in cmd_list:
+                    if getattr(c,a) is None: setattr(c, a, v1)
+        return
+
+    def run(self):
+        # Do nothing.
+        return

Modified: trunk/numpy/distutils/core.py
===================================================================
--- trunk/numpy/distutils/core.py	2007-05-18 20:17:48 UTC (rev 3780)
+++ trunk/numpy/distutils/core.py	2007-05-18 20:41:10 UTC (rev 3781)
@@ -35,6 +35,7 @@
 numpy_cmdclass = {'build':            build.build,
                   'build_src':        build_src.build_src,
                   'build_scripts':    build_scripts.build_scripts,
+                  'config_cc':        config_compiler.config_cc,
                   'config_fc':        config_compiler.config_fc,
                   'config':           config.config,
                   'build_ext':        build_ext.build_ext,




More information about the Numpy-svn mailing list