[Numpy-svn] r6491 - trunk/numpy/core

numpy-svn at scipy.org numpy-svn at scipy.org
Thu Feb 26 08:21:38 EST 2009


Author: cdavid
Date: 2009-02-26 07:21:34 -0600 (Thu, 26 Feb 2009)
New Revision: 6491

Modified:
   trunk/numpy/core/setup.py
Log:
Remote obsolete test code for sizeof defines.

Modified: trunk/numpy/core/setup.py
===================================================================
--- trunk/numpy/core/setup.py	2009-02-26 12:38:23 UTC (rev 6490)
+++ trunk/numpy/core/setup.py	2009-02-26 13:21:34 UTC (rev 6491)
@@ -513,86 +513,6 @@
 }
 """
 
-import sys
-def generate_numpyconfig_code(target):
-    """Return the source code as a string of the code to generate the
-    numpyconfig header file."""
-    if sys.platform == 'win32':
-        target = target.replace('\\','\\\\')
-    # Config symbols to prepend
-    prepends = [('NPY_SIZEOF_SHORT', 'SIZEOF_SHORT'),
-            ('NPY_SIZEOF_INT', 'SIZEOF_INT'),
-            ('NPY_SIZEOF_LONG', 'SIZEOF_LONG'),
-            ('NPY_SIZEOF_FLOAT', 'SIZEOF_FLOAT'),
-            ('NPY_SIZEOF_DOUBLE', 'SIZEOF_DOUBLE'),
-            ('NPY_SIZEOF_LONGDOUBLE', 'SIZEOF_LONG_DOUBLE'),
-            ('NPY_SIZEOF_PY_INTPTR_T', 'SIZEOF_PY_INTPTR_T')]
-
-    testcode = ["""
-#include <Python.h>
-#include "config.h"
-
-int main()
-{
-    FILE* f;
-
-    f = fopen("%s", "w");
-    if (f == NULL) {
-        return -1;
-    }
-""" % target]
-
-    testcode.append(r"""
-    fprintf(f, "/*\n * This file is generated by %s. DO NOT EDIT \n */\n");
-""" % __file__)
-
-    # Prepend NPY_ to any SIZEOF defines
-    testcode.extend([r'    fprintf(f, "#define ' + i + r' %%d \n", %s);' % j for i, j in prepends])
-
-    # Conditionally define NPY_NO_SIGNAL
-    if is_npy_no_signal():
-        testcode.append(r'    fprintf(f, "\n#define NPY_NO_SIGNAL\n");')
-
-    # Define NPY_NOSMP to 1 if explicitely requested, or if we cannot
-    # support thread support reliably
-    if is_npy_no_smp():
-        testcode.append(r'    fprintf(f, "#define NPY_NO_SMP 1\n");')
-    else:
-        testcode.append(r'    fprintf(f, "#define NPY_NO_SMP 0\n");')
-
-    tmpcode = r"""
-    #ifdef PY_LONG_LONG
-        fprintf(f, "\n#define %s %%d \n", %s);
-        fprintf(f, "#define %s %%d \n", %s);
-    #else
-        fprintf(f, "/* PY_LONG_LONG not defined  */ \n");
-    #endif"""
-    testcode.append(tmpcode % ('NPY_SIZEOF_LONGLONG', 'SIZEOF_LONG_LONG',
-                               'NPY_SIZEOF_PY_LONG_LONG', 'SIZEOF_PY_LONG_LONG'))
-
-    testcode.append(r"""
-#ifndef CHAR_BIT
-          {
-             unsigned char var = 2;
-             int i = 0;
-             while (var >= 2) {
-                     var = var << 1;
-                     i++;
-             }
-             fprintf(f,"#define CHAR_BIT %d\n", i+1);
-          }
-#else
-          fprintf(f, "/* #define CHAR_BIT %d */\n", CHAR_BIT);
-#endif""")
-
-    testcode.append("""
-    fclose(f);
-
-    return 0;
-}
-""")
-    return "\n".join(testcode)
-
 if __name__=='__main__':
     from numpy.distutils.core import setup
     setup(configuration=configuration)




More information about the Numpy-svn mailing list