[Numpy-svn] r5781 - branches/clean_math_config/numpy/core

numpy-svn@scip... numpy-svn@scip...
Fri Sep 5 01:26:00 CDT 2008


Author: cdavid
Date: 2008-09-05 01:25:57 -0500 (Fri, 05 Sep 2008)
New Revision: 5781

Modified:
   branches/clean_math_config/numpy/core/setup.py
Log:
Speed up the math configuration using check_funcs_once.

Modified: branches/clean_math_config/numpy/core/setup.py
===================================================================
--- branches/clean_math_config/numpy/core/setup.py	2008-09-05 06:21:18 UTC (rev 5780)
+++ branches/clean_math_config/numpy/core/setup.py	2008-09-05 06:25:57 UTC (rev 5781)
@@ -58,6 +58,17 @@
             moredefs.extend([name_to_defsymb(f) for f in funcs_name])
         return st
 
+    def check_funcs(funcs_name):
+        # Use check_funcs_once first, and if it does not work, test func per
+        # func. Return success only if all the functions are available
+        if not check_funcs_once(funcs_name):
+            # Global check failed, check func per func
+            for f in funcs_name:
+                if check_func(f):
+                    moredefs.append(name_to_defsymb(f))
+            return 0
+        else:
+            return 1
 
     def name_to_defsymb(name):
         return "HAVE_%s" % name.upper()
@@ -78,22 +89,17 @@
     optional_stdfuncs = ["expm1", "log1p", "acosh", "asinh", "atanh",
                          "rint", "trunc"]
 
-    for f in optional_stdfuncs:
-        if check_func(f):
-            moredefs.append(name_to_defsymb(f))
+    check_funcs(optional_stdfuncs)
 
+    # C99 functions: float and long double versions
     c99_funcs = ["sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs", "floor",
 "ceil", "rint", "trunc", "sqrt", "log10", "log", "exp", "expm1", "asin",
 "acos", "atan", "asinh", "acosh", "atanh", "hypot", "atan2", "pow", "fmod",
 "modf", 'frexp', 'ldexp']
 
     for prec in ['l', 'f']:
-        if not check_funcs_once([f + prec for f in c99_funcs]):
-            # Global check failed, check func per func
-            for f in c99_funcs:
-                name = f + prec
-                if check_func(name):
-                    moredefs.append(name_to_defsymb(name))
+        fns = [f + prec for f in c99_funcs]
+        check_funcs(fns)
 
     # Keep this for compatibility for now
     def check_func_old(func_name):



More information about the Numpy-svn mailing list