[Numpy-svn] r3970 - trunk/numpy/distutils

numpy-svn@scip... numpy-svn@scip...
Fri Aug 17 13:31:25 CDT 2007


Author: cookedm
Date: 2007-08-17 13:31:24 -0500 (Fri, 17 Aug 2007)
New Revision: 3970

Modified:
   trunk/numpy/distutils/ccompiler.py
Log:
in ccompiler.CCompiler_customize_cmd, allow a list of command attributes to
ignore when customising. This will be used to simplify some of the compiler
customisation in command/


Modified: trunk/numpy/distutils/ccompiler.py
===================================================================
--- trunk/numpy/distutils/ccompiler.py	2007-08-17 18:29:08 UTC (rev 3969)
+++ trunk/numpy/distutils/ccompiler.py	2007-08-17 18:31:24 UTC (rev 3970)
@@ -121,28 +121,30 @@
 
 replace_method(CCompiler, 'compile', CCompiler_compile)
 
-def CCompiler_customize_cmd(self, cmd):
+def CCompiler_customize_cmd(self, cmd, ignore=()):
     """ Customize compiler using distutils command.
     """
     log.info('customize %s using %s' % (self.__class__.__name__,
                                         cmd.__class__.__name__))
-    if getattr(cmd,'include_dirs',None) is not None:
+    def allow(attr):
+        return getattr(cmd, attr, None) is not None and attr not in ignore
+
+    if allow('include_dirs'):
         self.set_include_dirs(cmd.include_dirs)
-    if getattr(cmd,'define',None) is not None:
+    if allow('define'):
         for (name,value) in cmd.define:
             self.define_macro(name, value)
-    if getattr(cmd,'undef',None) is not None:
+    if allow('undef'):
         for macro in cmd.undef:
             self.undefine_macro(macro)
-    if getattr(cmd,'libraries',None) is not None:
+    if allow('libraries'):
         self.set_libraries(self.libraries + cmd.libraries)
-    if getattr(cmd,'library_dirs',None) is not None:
+    if allow('library_dirs'):
         self.set_library_dirs(self.library_dirs + cmd.library_dirs)
-    if getattr(cmd,'rpath',None) is not None:
+    if allow('rpath'):
         self.set_runtime_library_dirs(cmd.rpath)
-    if getattr(cmd,'link_objects',None) is not None:
+    if allow('link_objects'):
         self.set_link_objects(cmd.link_objects)
-    return
 
 replace_method(CCompiler, 'customize_cmd', CCompiler_customize_cmd)
 



More information about the Numpy-svn mailing list