summaryrefslogtreecommitdiff
path: root/numpy/distutils/command/config_compiler.py
diff options
context:
space:
mode:
authorPearu Peterson <pearu.peterson@gmail.com>2007-05-18 20:41:10 +0000
committerPearu Peterson <pearu.peterson@gmail.com>2007-05-18 20:41:10 +0000
commit63c63253542c4ebd029d371ffee31fd22e0e36a4 (patch)
tree1135b528e5061aa9c5d448850592ce0ec62d9564 /numpy/distutils/command/config_compiler.py
parent6f82e1e9c704daaf398015ecc20892d89e56b259 (diff)
downloadnumpy-63c63253542c4ebd029d371ffee31fd22e0e36a4.tar.gz
added config to --fcompiler option unification method. introduced config_cc for unifying --compiler options.
Diffstat (limited to 'numpy/distutils/command/config_compiler.py')
-rw-r--r--numpy/distutils/command/config_compiler.py46
1 files changed, 43 insertions, 3 deletions
diff --git a/numpy/distutils/command/config_compiler.py b/numpy/distutils/command/config_compiler.py
index ebbe4c8e1..ff5886c9a 100644
--- a/numpy/distutils/command/config_compiler.py
+++ b/numpy/distutils/command/config_compiler.py
@@ -57,12 +57,14 @@ class config_fc(Command):
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,7 +73,45 @@ class config_fc(Command):
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