[Numpy-svn] r4434 - branches/numpy.scons/numpy/distutils/scons
numpy-svn at scipy.org
numpy-svn at scipy.org
Mon Nov 12 00:12:18 EST 2007
Author: cdavid
Date: 2007-11-11 23:12:09 -0600 (Sun, 11 Nov 2007)
New Revision: 4434
Modified:
branches/numpy.scons/numpy/distutils/scons/fortran_scons.py
Log:
Starts working on mingw fortran / MS interaction
Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-11 03:26:54 UTC (rev 4433)
+++ branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-12 05:12:09 UTC (rev 4434)
@@ -7,6 +7,7 @@
from copy import deepcopy
from numpy.distutils.scons.core.utils import popen_wrapper
+from numpy.distutils.scons.core.extension_scons import built_with_mstools, built_with_mingw
from fortran import parse_f77link, check_link_verbose
#-----------------
@@ -311,11 +312,43 @@
else:
raise RuntimeError("fcomp %s not implemented..." % fcomp)
return 0
+
if res:
+ if not built_with_mstools(context.env):
+ res, cnt = _build_empty_program_posix(context, fcomp)
+ else:
+ res, cnt = _build_empty_program_ms(context, fcomp)
+
+ return res, cnt
+
+def _build_empty_program_ms(context, fcomp):
+ # MS tools and g77/gfortran semantics are totally
+ # difference, so we cannot just compile a program
+ # replacing MS linker by g77/gfortran as we can for
+ # all other platforms.
+ slast = str(context.lastTarget)
+ dir = dirname(slast)
+ test_prog = pjoin(dir, basename(slast).split('.')[0])
+ cmd = context.env.subst("$%s -v -o $TARGET $SOURCES" % fcomp,
+ target = context.env.File(test_prog),
+ source = context.lastTarget)
+
+ print cmd
+ st, out = popen_wrapper(cmd, merge = True)
+ if st:
+ res = 0
+ else:
+ res = 1
+ cnt = out.split('\n')
+ print cnt
+ raise "YATA"
+
+def _build_empty_program_posix(context, fcomp):
oldLINK = context.env['LINK']
# XXX: get the fortran compiler
context.env['LINK'] = '$' + fcomp
res = 0
+ cnt = ''
try:
# We always want to do this build, and we do not want scons cache
# to interfer. So we build a command executed directly through our
@@ -337,9 +370,9 @@
cnt = out.split('\n')
finally:
context.env['LINK'] = oldLINK
-
- return res, cnt
+ return res, cnt
+
# Helper to generate combinations of lists
def _RecursiveGenerator(*sets):
"""Returns a generator that yields one tuple per element combination.
More information about the Numpy-svn
mailing list