[Numpy-svn] r4215 - in branches/cleanconfig/numpy/core: . include/numpy src

numpy-svn at scipy.org numpy-svn at scipy.org
Wed Oct 17 23:30:57 EDT 2007


Author: cdavid
Date: 2007-10-17 22:30:47 -0500 (Wed, 17 Oct 2007)
New Revision: 4215

Modified:
   branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h
   branches/cleanconfig/numpy/core/setup.py
   branches/cleanconfig/numpy/core/src/arraytypes.inc.src
   branches/cleanconfig/numpy/core/src/umathmodule.c.src
Log:
Split config.h into numpyconfig.h (public symbols) and config.h (private symbols)

Modified: branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h
===================================================================
--- branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h	2007-10-18 03:15:45 UTC (rev 4214)
+++ branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h	2007-10-18 03:30:47 UTC (rev 4215)
@@ -13,7 +13,7 @@
        everything when you're typing */
 #endif
 /* This is auto-generated by the installer */
-#include "config.h"
+#include "numpyconfig.h"
 
 /* Only use thread if configured in config and python supports it */
 #if defined WITH_THREAD && !NPY_NOSMP
@@ -88,17 +88,7 @@
 #define NPY_FALSE 0
 #define NPY_TRUE 1
 
-#define NPY_SIZEOF_LONG SIZEOF_LONG
-#define NPY_SIZEOF_INT SIZEOF_INT
-#define NPY_SIZEOF_SHORT SIZEOF_SHORT
-#define NPY_SIZEOF_FLOAT SIZEOF_FLOAT
-#define NPY_SIZEOF_DOUBLE SIZEOF_DOUBLE
-#define NPY_SIZEOF_LONGDOUBLE SIZEOF_LONG_DOUBLE
-#define NPY_SIZEOF_LONGLONG SIZEOF_LONG_LONG
 
-#define NPY_SIZEOF_PY_LONG_LONG SIZEOF_PY_LONG_LONG
-#define NPY_SIZEOF_PY_INTPTR_T SIZEOF_PY_INTPTR_T
-
 #if NPY_SIZEOF_LONGDOUBLE == NPY_SIZEOF_DOUBLE
         typedef double npy_longdouble;
         #define NPY_LONGDOUBLE_FMT "g"

Modified: branches/cleanconfig/numpy/core/setup.py
===================================================================
--- branches/cleanconfig/numpy/core/setup.py	2007-10-18 03:15:45 UTC (rev 4214)
+++ branches/cleanconfig/numpy/core/setup.py	2007-10-18 03:30:47 UTC (rev 4215)
@@ -159,6 +159,39 @@
         config.add_data_files((header_dir,target))
         return target
 
+    def generate_numpyconfig_h(ext, build_dir):
+        """Depends on config.h: generate_config_h has to be called before !"""
+        target = join(build_dir,'numpyconfig.h')
+        if newer(__file__,target):
+            config_cmd = config.get_config_cmd()
+            log.info('Generating %s',target)
+            testcode = generate_numpyconfig_code(target)
+
+            from distutils import sysconfig
+            python_include = sysconfig.get_python_inc()
+            python_h = join(python_include, 'Python.h')
+            if not os.path.isfile(python_h):
+                raise SystemError,\
+                      "Non-existing %s. Perhaps you need to install"\
+                      " python-dev|python-devel." % (python_h)
+
+            config.numpy_include_dirs
+            result = config_cmd.try_run(testcode, 
+                                include_dirs = [python_include] + \
+                                                       config.numpy_include_dirs,
+                                        library_dirs = default_lib_dirs)
+
+            if not result:
+                raise SystemError,"Failed to generate numpy configuration. "\
+                      "See previous error messages for more information."
+
+            print 'File: %s' % target
+            target_f = open(target)
+            print target_f.read()
+            target_f.close()
+            print 'EOF'
+        return target
+                                
     def generate_api_func(module_name):
         def generate_api(ext, build_dir):
             script = join(codegen_dir, module_name + '.py')
@@ -213,6 +246,7 @@
     config.add_extension('multiarray',
                          sources = [join('src','multiarraymodule.c'),
                                     generate_config_h,
+                                    generate_numpyconfig_h,
                                     generate_array_api,
                                     join('src','scalartypes.inc.src'),
                                     join('src','arraytypes.inc.src'),
@@ -224,6 +258,7 @@
 
     config.add_extension('umath',
                          sources = [generate_config_h,
+                                    generate_numpyconfig_h,
                                     join('src','umathmodule.c.src'),
                                     generate_umath_c,
                                     generate_ufunc_api,
@@ -239,6 +274,7 @@
     config.add_extension('_sort',
                          sources=[join('src','_sortmodule.c.src'),
                                   generate_config_h,
+                                  generate_numpyconfig_h,
                                   generate_array_api,
                                   ],
                          )
@@ -246,6 +282,7 @@
     config.add_extension('scalarmath',
                          sources=[join('src','scalarmathmodule.c.src'),
                                   generate_config_h,
+                                  generate_numpyconfig_h,
                                   generate_array_api,
                                   generate_ufunc_api],
                          )

Modified: branches/cleanconfig/numpy/core/src/arraytypes.inc.src
===================================================================
--- branches/cleanconfig/numpy/core/src/arraytypes.inc.src	2007-10-18 03:15:45 UTC (rev 4214)
+++ branches/cleanconfig/numpy/core/src/arraytypes.inc.src	2007-10-18 03:30:47 UTC (rev 4215)
@@ -1,4 +1,5 @@
 /* -*- c -*- */
+#include "config.h"
 
 static longlong
 MyPyLong_AsLongLong(PyObject *vv)

Modified: branches/cleanconfig/numpy/core/src/umathmodule.c.src
===================================================================
--- branches/cleanconfig/numpy/core/src/umathmodule.c.src	2007-10-18 03:15:45 UTC (rev 4214)
+++ branches/cleanconfig/numpy/core/src/umathmodule.c.src	2007-10-18 03:30:47 UTC (rev 4215)
@@ -5,6 +5,7 @@
 #define _UMATHMODULE
 #include "numpy/ufuncobject.h"
 #include "abstract.h"
+#include "config.h"
 #include <math.h>
 
 /* A whole slew of basic math functions are provided originally




More information about the Numpy-svn mailing list