[Numpy-svn] r4556 - in branches/numpy.scons/numpy/distutils/scons: core tools

numpy-svn at scipy.org numpy-svn at scipy.org
Fri Dec 7 03:30:03 EST 2007


Author: cdavid
Date: 2007-12-07 02:29:55 -0600 (Fri, 07 Dec 2007)
New Revision: 4556

Modified:
   branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py
   branches/numpy.scons/numpy/distutils/scons/tools/g77.py
   branches/numpy.scons/numpy/distutils/scons/tools/gfortran.py
Log:
More work on getting around fortran / scons idiosyncraties

Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py	2007-12-07 02:17:51 UTC (rev 4555)
+++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py	2007-12-07 08:29:55 UTC (rev 4556)
@@ -135,6 +135,9 @@
 def GetNumpyEnvironment(args):
     env = _GetNumpyEnvironment(args)
 
+    #------------------------------
+    # C compiler last customization
+    #------------------------------
     # Apply optim and warn flags considering context
     if 'CFLAGS' in os.environ:
         env.Append(CFLAGS = "%s" % os.environ['CFLAGS'])
@@ -148,6 +151,11 @@
                                    env['NUMPY_THREAD_CFLAGS'])
     env.AppendUnique(LINKFLAGS = env['NUMPY_OPTIM_LDFLAGS'])
 
+    #--------------------------------
+    # F77 compiler last customization
+    #--------------------------------
+    # XXX: For now, only handle F77 case, but will have to think about multiple
+    # fortran standard at some points ?
     if 'FFLAGS' in os.environ:
         env.Append(F77FLAGS = "%s" % os.environ['FFLAGS'])
         env.AppendUnique(F77FLAGS = env['NUMPY_EXTRA_FFLAGS'] +
@@ -206,7 +214,6 @@
         try:
             if len(env['f77_opt_path']) > 0:
                 t = Tool(env['f77_opt'], toolpath = [get_local_toolpath()])
-
                 t(env) 
                 path_list.append(env['f77_opt_path'])
                 customize_f77(t.name, env)
@@ -223,7 +230,14 @@
         else:
             print "========== NO FORTRAN COMPILER FOUND ==========="
 
-    # XXX: really have to understand how fortran compilers work in scons...
+    # scons handles fortran tools in a really convoluted way which does not
+    # much make sense to me. Depending on the tool, different set of
+    # construction variables are defined. As long as this is not fixed or
+    # better understood, I do the following:
+    #   - if F77* variables do not exist, define them
+    #   - the only guaranteed variables for fortran are the list generators, so
+    #   use them through env.subst to get any compiler, and set F77* to them if
+    #   they are not already defined.
     if not env.has_key('F77'):
         env['F77'] = env.subst('$_FORTRANG')
     if not env.has_key('F77FLAGS'):

Modified: branches/numpy.scons/numpy/distutils/scons/tools/g77.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/tools/g77.py	2007-12-07 02:17:51 UTC (rev 4555)
+++ branches/numpy.scons/numpy/distutils/scons/tools/g77.py	2007-12-07 08:29:55 UTC (rev 4556)
@@ -51,5 +51,12 @@
     else:
         env['SHF77FLAGS'] = SCons.Util.CLVar('$F77FLAGS -fPIC')
 
+    env['FORTRAN'] = g77exec
+    env['SHFORTRAN'] = g77exec
+    if env['PLATFORM'] in ['cygwin', 'win32']:
+        env['SHFORTRANFLAGS'] = SCons.Util.CLVar('$FORTRANFLAGS')
+    else:
+        env['SHFORTRANFLAGS'] = SCons.Util.CLVar('$FORTRANFLAGS -fPIC')
+
 def exists(env):
     return env.Detect(compilers)

Modified: branches/numpy.scons/numpy/distutils/scons/tools/gfortran.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/tools/gfortran.py	2007-12-07 02:17:51 UTC (rev 4555)
+++ branches/numpy.scons/numpy/distutils/scons/tools/gfortran.py	2007-12-07 08:29:55 UTC (rev 4556)
@@ -47,12 +47,10 @@
 
     # which one is the good one ? ifort uses _FORTRAND, ifl FORTRAN, aixf77 F77
     # ...
-    #env['_FORTRAND'] = 'gfortran'
+    env['_FORTRAND'] = 'gfortran'
     env['FORTRAN'] = 'gfortran'
+    env['SHFORTRAN'] = 'gfortran'
 
-    # XXX does this need to be set too ?
-    #env['SHFORTRAN'] = 'gfortran'
-
     if env['PLATFORM'] in ['cygwin', 'win32']:
         env['SHFORTRANFLAGS'] = SCons.Util.CLVar('$FORTRANFLAGS')
     else:
@@ -60,8 +58,5 @@
 
     # XXX; Link problems: we need to add -lgfortran somewhere...
 
-    print env.subst('$_FORTRANG')
-    print env.subst('$_SHFORTRANFLAGSG')
-
 def exists(env):
     return env.Detect('gfortran')




More information about the Numpy-svn mailing list