diff options
author | Pearu Peterson <pearu.peterson@gmail.com> | 2006-10-08 09:30:17 +0000 |
---|---|---|
committer | Pearu Peterson <pearu.peterson@gmail.com> | 2006-10-08 09:30:17 +0000 |
commit | 45e92465815e16d02a611005b61abc6a65f6b91c (patch) | |
tree | 7cb75b38697c04be28bac4a388a5c8b71db5373c /numpy/distutils/command | |
parent | cc7fd3d7d62f4bc6ee17456d282475781204f98e (diff) | |
download | numpy-45e92465815e16d02a611005b61abc6a65f6b91c.tar.gz |
numpy.distutils: use language flag or source file extension to select default f77 or f90 compiler.
Diffstat (limited to 'numpy/distutils/command')
-rw-r--r-- | numpy/distutils/command/build_clib.py | 12 | ||||
-rw-r--r-- | numpy/distutils/command/build_ext.py | 10 |
2 files changed, 18 insertions, 4 deletions
diff --git a/numpy/distutils/command/build_clib.py b/numpy/distutils/command/build_clib.py index 3319c6a75..de1781991 100644 --- a/numpy/distutils/command/build_clib.py +++ b/numpy/distutils/command/build_clib.py @@ -46,9 +46,12 @@ class build_clib(old_build_clib): return # Make sure that library sources are complete. + languages = [] for (lib_name, build_info) in self.libraries: if not all_strings(build_info.get('sources',[])): self.run_command('build_src') + l = build_info.get('language',None) + if l and l not in languages: languages.append(l) from distutils.ccompiler import new_compiler self.compiler = new_compiler(compiler=self.compiler, @@ -69,7 +72,8 @@ class build_clib(old_build_clib): self.fcompiler = new_fcompiler(compiler=self.fcompiler, verbose=self.verbose, dry_run=self.dry_run, - force=self.force) + force=self.force, + requiref90='f90' in languages) self.fcompiler.customize(self.distribution) libraries = self.libraries @@ -124,12 +128,14 @@ class build_clib(old_build_clib): 'for fortran compiler: %s' \ % (config_fc)) from numpy.distutils.fcompiler import new_fcompiler + requiref90 = build_info.get('language','c')=='f90' fcompiler = new_fcompiler(compiler=self.fcompiler.compiler_type, verbose=self.verbose, dry_run=self.dry_run, - force=self.force) + force=self.force, + requiref90=requiref90) fcompiler.customize(config_fc) - + macros = build_info.get('macros') include_dirs = build_info.get('include_dirs') extra_postargs = build_info.get('extra_compiler_args') or [] diff --git a/numpy/distutils/command/build_ext.py b/numpy/distutils/command/build_ext.py index 9958f5d8b..5f09ea1e3 100644 --- a/numpy/distutils/command/build_ext.py +++ b/numpy/distutils/command/build_ext.py @@ -75,6 +75,13 @@ class build_ext (old_build_ext): need_f_compiler = 1 break + requiref90 = 0 + if need_f_compiler: + for ext in self.extensions: + if getattr(ext,'language','c')=='f90': + requiref90 = 1 + break + # Determine if C++ compiler is needed. need_cxx_compiler = 0 for ext in self.extensions: @@ -100,7 +107,8 @@ class build_ext (old_build_ext): self.fcompiler = new_fcompiler(compiler=self.fcompiler, verbose=self.verbose, dry_run=self.dry_run, - force=self.force) + force=self.force, + requiref90=requiref90) if self.fcompiler.get_version(): self.fcompiler.customize(self.distribution) self.fcompiler.customize_cmd(self) |