[Numpy-svn] r4689 - branches/build_with_scons/numpy/core/code_generators

numpy-svn@scip... numpy-svn@scip...
Sun Jan 6 06:19:42 CST 2008


Author: cdavid
Date: 2008-01-06 06:19:35 -0600 (Sun, 06 Jan 2008)
New Revision: 4689

Modified:
   branches/build_with_scons/numpy/core/code_generators/generate_ufunc_api.py
Log:
Modify ufunc api generator to be compatible with scons builder

Modified: branches/build_with_scons/numpy/core/code_generators/generate_ufunc_api.py
===================================================================
--- branches/build_with_scons/numpy/core/code_generators/generate_ufunc_api.py	2008-01-06 12:18:13 UTC (rev 4688)
+++ branches/build_with_scons/numpy/core/code_generators/generate_ufunc_api.py	2008-01-06 12:19:35 UTC (rev 4689)
@@ -1,8 +1,6 @@
 import os
 import genapi
 
-UFUNC_API_ORDER = 'ufunc_api_order.txt'
-
 h_template = r"""
 #ifdef _UMATHMODULE
 
@@ -72,18 +70,29 @@
 """
 
 def generate_api(output_dir, force=False):
-    header_file = os.path.join(output_dir, '__ufunc_api.h')
-    c_file = os.path.join(output_dir, '__ufunc_api.c')
-    doc_file = os.path.join(output_dir, 'ufunc_api.txt')
+    basename = 'ufunc_api'
+    
+    h_file = os.path.join(output_dir, '__%s.h' % basename)
+    c_file = os.path.join(output_dir, '__%s.c' % basename)
+    d_file = os.path.join(output_dir, '%s.txt' % basename)
+    targets = (h_file, c_file, d_file)
 
-    targets = (header_file, c_file, doc_file)
-    if (not force
-            and not genapi.should_rebuild(targets,
-                                          [UFUNC_API_ORDER, __file__])):
+    sources = ['ufunc_api_order.txt']
+
+    if (not force and not genapi.should_rebuild(targets, sources + [__file__])):
         return targets
+    else:
+        do_generate_api(targets, sources)
 
-    ufunc_api_list = genapi.get_api_functions('UFUNC_API', UFUNC_API_ORDER)
+    return targets
 
+def do_generate_api(targets, sources):
+    header_file = targets[0]
+    c_file = targets[1]
+    doc_file = targets[2]
+
+    ufunc_api_list = genapi.get_api_functions('UFUNC_API', sources[0])
+
     # API fixes for __arrayobject_api.h
 
     fixed = 1



More information about the Numpy-svn mailing list