summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorcookedm <cookedm@localhost>2007-08-17 18:31:24 +0000
committercookedm <cookedm@localhost>2007-08-17 18:31:24 +0000
commitc4e38d2904e8337019ad4f735d92feabf1f789a1 (patch)
treedaf27f0676f04a06f7426012a2c5ef686dcaec54 /numpy
parent83f13bc82583855d024788b4d27707bdf2cb315b (diff)
downloadnumpy-c4e38d2904e8337019ad4f735d92feabf1f789a1.tar.gz
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/
Diffstat (limited to 'numpy')
-rw-r--r--numpy/distutils/ccompiler.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py
index 9d8b37c71..882a53570 100644
--- a/numpy/distutils/ccompiler.py
+++ b/numpy/distutils/ccompiler.py
@@ -121,28 +121,30 @@ def CCompiler_compile(self, sources, output_dir=None, macros=None,
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)