summaryrefslogtreecommitdiff
path: root/numpy/distutils/command
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
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')
-rw-r--r--numpy/distutils/command/build.py3
-rw-r--r--numpy/distutils/command/config.py10
-rw-r--r--numpy/distutils/command/config_compiler.py46
3 files changed, 46 insertions, 13 deletions
diff --git a/numpy/distutils/command/build.py b/numpy/distutils/command/build.py
index f74fbde69..a968a2739 100644
--- a/numpy/distutils/command/build.py
+++ b/numpy/distutils/command/build.py
@@ -5,7 +5,8 @@ from distutils.util import get_platform
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
diff --git a/numpy/distutils/command/config.py b/numpy/distutils/command/config.py
index ea79ef0a9..6f796087b 100644
--- a/numpy/distutils/command/config.py
+++ b/numpy/distutils/command/config.py
@@ -14,8 +14,7 @@ LANG_EXT['f90'] = '.f90'
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 @@ class config(old_config):
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
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