[Numpy-svn] r4438 - in branches/numpy.scons/numpy/distutils/scons: . checkers core tests

numpy-svn@scip... numpy-svn@scip...
Mon Nov 12 04:24:05 CST 2007


Author: cdavid
Date: 2007-11-12 04:23:54 -0600 (Mon, 12 Nov 2007)
New Revision: 4438

Modified:
   branches/numpy.scons/numpy/distutils/scons/Changelog
   branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py
   branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py
   branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py
   branches/numpy.scons/numpy/distutils/scons/fortran_scons.py
   branches/numpy.scons/numpy/distutils/scons/tests/test_fortran.py
Log:
Correct wrong indendation

Modified: branches/numpy.scons/numpy/distutils/scons/Changelog
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/Changelog	2007-11-12 09:59:51 UTC (rev 4437)
+++ branches/numpy.scons/numpy/distutils/scons/Changelog	2007-11-12 10:23:54 UTC (rev 4438)
@@ -1,3 +1,16 @@
+Sat, 11 Nov 2007 19:35:54 +0900
+
+User-visible Changes:
+	* numpy.scons can now be used when no F77 is found. In perticular, the
+	CheckF77* funcs fail graciously when no F77 are found.
+
+Sat, 10 Nov 2007 19:35:54 +0900
+
+User-visible Changes:
+	* VS 2005 can now be used, modulo a small modification in the
+	numpy.distutils.command.build_ext (rename the run method, and add a
+	dummy run instead).
+
 Fri, 09 Nov 2007 18:22:44 +0900
 
 User-visible Changes:

Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py	2007-11-12 09:59:51 UTC (rev 4437)
+++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py	2007-11-12 10:23:54 UTC (rev 4438)
@@ -1,5 +1,5 @@
 #! /usr/bin/env python
-# Last Change: Tue Nov 06 11:00 PM 2007 J
+# Last Change: Mon Nov 12 07:00 PM 2007 J
 
 # Module for custom, common checkers for numpy (and scipy)
 import sys
@@ -116,9 +116,9 @@
     siteconfig, cfgfiles = get_config()
     (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section)
     if found:
-	# XXX: handle def library names correctly
-	if len(libs) == 1 and len(libs[0]) == 0:
-	    libs = ['lapack', 'blas']
+        # XXX: handle def library names correctly
+        if len(libs) == 1 and len(libs[0]) == 0:
+            libs = ['lapack', 'blas']
         cfg = ConfigOpts(cpppath = cpppath, libs = libs, libpath = libpath,
                          rpath = deepcopy(libpath))
 
@@ -133,18 +133,18 @@
         sgesv_string = env['F77_NAME_MANGLER']('sgesv')
         test_src = lapack_sgesv % sgesv_string
 
-	# fortrancfg is used to merge info from fortran checks and site.cfg
-	fortrancfg = deepcopy(cfg)
-	if not built_with_mstools(env):
-		fortrancfg['linkflags'].append(env['F77_LDFLAGS'])
-	else:
-	    # XXX: do this the right way (abstract a minimal posix -> MS flags
-	    # convertor)
-	    for i in env['F77_LDFLAGS'].split(' '):
-		if i.startswith('-L'):
-		    fortrancfg['libpath'].append(i[2:])
-		elif i.startswith('-l'):
-		    fortrancfg['linkflags'].append('lib%s.a' % i[2:])
+        # fortrancfg is used to merge info from fortran checks and site.cfg
+        fortrancfg = deepcopy(cfg)
+        if not built_with_mstools(env):
+            fortrancfg['linkflags'].append(env['F77_LDFLAGS'])
+        else:
+            # XXX: do this the right way (abstract a minimal posix -> MS flags
+            # convertor)
+            for i in env['F77_LDFLAGS'].split(' '):
+            if i.startswith('-L'):
+                fortrancfg['libpath'].append(i[2:])
+            elif i.startswith('-l'):
+                fortrancfg['linkflags'].append('lib%s.a' % i[2:])
 
         st = check_include_and_run(context, 'LAPACK (from site.cfg) ', fortrancfg,
                                   [], test_src, autoadd)

Modified: branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py	2007-11-12 09:59:51 UTC (rev 4437)
+++ branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py	2007-11-12 10:23:54 UTC (rev 4438)
@@ -1,5 +1,5 @@
 #! /usr/bin/env python
-# Last Change: Fri Oct 19 11:00 AM 2007 J
+# Last Change: Mon Nov 12 07:00 PM 2007 J
 
 # Module for support to build python extension. scons specific code goes here.
 import sys
@@ -10,6 +10,9 @@
 
 from extension import get_pythonlib_dir, get_python_inc
 
+# Those built_* are not good: we should have a better way to get the real type
+# of compiler instead of being based on names (to support things like colorgcc,
+# gcc-4.2, etc...). Fortunately, we mostly need this on MS platform.
 def built_with_mstools(env):
     """Return True if built with MS tools (compiler + linker)."""
     return env['cc_opt'] == 'msvc'
@@ -18,6 +21,10 @@
     """Return true if built with mingw compiler."""
     return env['cc_opt'] == 'mingw'
 
+def built_with_gnu_f77(env):
+    """Return true if f77 compiler is gnu (g77, gfortran, etc...)."""
+    return env['f77_opt'] == 'g77' or env['f77_opt'] == 'gfortran'
+
 def get_pythonlib_name(debug = 0):
     """Return the name of python library (necessary to link on NT with
     mingw."""

Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py	2007-11-12 09:59:51 UTC (rev 4437)
+++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py	2007-11-12 10:23:54 UTC (rev 4438)
@@ -93,17 +93,17 @@
 def finalize_env(env):
     if built_with_mstools(env):
         major, minor = get_vs_version(env)
-	# For VS 8 and above (VS 2005), use manifest for DLL
-	if major >= 8:
-	    env['LINKCOM'] = [env['LINKCOM'], 
-			      'mt.exe -nologo -manifest ${TARGET}.manifest '\
-			      '-outputresource:$TARGET;1']
-	    env['SHLINKCOM'] = [env['SHLINKCOM'], 
-			        'mt.exe -nologo -manifest ${TARGET}.manifest '\
-			        '-outputresource:$TARGET;2']
-	    env['LDMODULECOM'] = [env['LDMODULECOM'], 
-			        'mt.exe -nologo -manifest ${TARGET}.manifest '\
-			        '-outputresource:$TARGET;2']
+        # For VS 8 and above (VS 2005), use manifest for DLL
+        if major >= 8:
+            env['LINKCOM'] = [env['LINKCOM'], 
+                      'mt.exe -nologo -manifest ${TARGET}.manifest '\
+                      '-outputresource:$TARGET;1']
+            env['SHLINKCOM'] = [env['SHLINKCOM'], 
+                        'mt.exe -nologo -manifest ${TARGET}.manifest '\
+                        '-outputresource:$TARGET;2']
+            env['LDMODULECOM'] = [env['LDMODULECOM'], 
+                        'mt.exe -nologo -manifest ${TARGET}.manifest '\
+                        '-outputresource:$TARGET;2']
 
 def GetNumpyEnvironment(args):
     env = _GetNumpyEnvironment(args)
@@ -146,7 +146,7 @@
     # ===============================================
     # Setting tools according to command line options
     if not env['ENV'].has_key('PATH'):
-	env['ENV']['PATH'] = []
+        env['ENV']['PATH'] = []
 
     # XXX: how to handle tools which are not in standard location ? Is adding
     # the full path of the compiler enough ? (I am sure some compilers also
@@ -174,9 +174,9 @@
                         env['ENV']['PATH'] += ';%s' % env['cc_opt_path']
                     else:
                         env['ENV']['PATH'] += ':%s' % env['cc_opt_path']
-	    else:
-		# Do not care about PATH info because none given from scons
-		# distutils command
+            else:
+                # Do not care about PATH info because none given from scons
+                # distutils command
                 t = Tool(env['cc_opt'])
                 t(env) 
                 customize_cc(t.name, env)
@@ -208,13 +208,12 @@
         # XXX: really have to understand how fortran compilers work in scons...
         env['F77'] = env['_FORTRAND']
     else:
-	#raise NotImplementedError('FIXME: Support for env wo fcompiler not tested yet !')
-	def_fcompiler =  FindTool(DEF_FORTRAN_COMPILERS, env)
-	if def_fcompiler:
-		t = Tool(def_fcompiler)
-		t(env)
+        def_fcompiler =  FindTool(DEF_FORTRAN_COMPILERS, env)
+        if def_fcompiler:
+            t = Tool(def_fcompiler)
+            t(env)
         else:
-		print "========== NO FORTRAN COMPILER FOUND ==========="
+            print "========== NO FORTRAN COMPILER FOUND ==========="
 
     # XXX: Really, we should use our own subclass of Environment, instead of
     # adding Numpy* functions !

Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/fortran_scons.py	2007-11-12 09:59:51 UTC (rev 4437)
+++ branches/numpy.scons/numpy/distutils/scons/fortran_scons.py	2007-11-12 10:23:54 UTC (rev 4438)
@@ -1,4 +1,4 @@
-# Last Change: Tue Nov 06 06:00 PM 2007 J
+# Last Change: Mon Nov 12 07:00 PM 2007 J
 import os
 import sys
 import string
@@ -357,30 +357,29 @@
         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)
+        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])
+    # MS tools and g77/gfortran semantics are totally different, 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)
+                            target = context.env.File(test_prog),
+                            source = context.lastTarget)
 
-        st, out = popen_wrapper(cmd, merge = True)
-        if st:
-            res = 0
-        else:
-            res = 1
+    st, out = popen_wrapper(cmd, merge = True)
+    if st:
+        res = 0
+    else:
+        res = 1
 	cnt = out.split('\n')
 	return res, cnt
 

Modified: branches/numpy.scons/numpy/distutils/scons/tests/test_fortran.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/tests/test_fortran.py	2007-11-12 09:59:51 UTC (rev 4437)
+++ branches/numpy.scons/numpy/distutils/scons/tests/test_fortran.py	2007-11-12 10:23:54 UTC (rev 4438)
@@ -1,14 +1,15 @@
-#! Last Change: Fri Oct 26 04:00 PM 2007 J
+#! Last Change: Mon Nov 12 03:00 PM 2007 J
 
 from numpy.testing import NumpyTestCase, set_package_path, restore_path, set_local_path
 
-set_package_path()
-from scons.fortran import parse_f77link
+set_local_path('..')
+from fortran import parse_f77link
 restore_path()
 
 set_local_path()
 from fortran_output import g77_link_output, gfortran_link_output, \
         sunfort_v12_link_output, ifort_v10_link_output, \
+        mingw_g77_link_output, \
         g77_link_expected, gfortran_link_expected, \
         sunfort_v12_link_expected, ifort_v10_link_expected
 restore_path()
@@ -40,6 +41,10 @@
         """Parsing ifort link output on win32."""
         print "FIXME: testing verbose output of win32 intel fortran"
 
+    def test_mingw_g77(self):
+        """Parsing mingw g77 link output on win32 (native, i.e. no cygwin)"""
+        print parse_f77link(mingw_g77_link_output.split('\n'))
+
 if __name__ == '__main__':
     from numpy.testing import NumpyTest
     NumpyTest().test()



More information about the Numpy-svn mailing list