Skip Montanaro <[EMAIL PROTECTED]> added the comment:

Andrew> ImportError: No module named math
    Andrew> make: *** [sharedmods] Error 1

    Andrew> The has_function source in Lib/distutils/ccompiler.py has this
    Andrew> comment:

    Andrew> # this can't be included at module scope because it tries to
    Andrew> # import math which might not be available at that point - maybe
    Andrew> # the necessary logic should just be inlined?

*sigh* I guess that would explain why it wasn't used anywhere in setup.py.

Can you try this simplified version?  (It's probably almost exactly what you
came up with.)

Thanks,

Skip

Added file: http://bugs.python.org/file12234/dbm.diff

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4483>
_______________________________________
Index: setup.py
===================================================================
--- setup.py    (revision 67489)
+++ setup.py    (working copy)
@@ -783,11 +783,20 @@
                 exts.append( Extension('_dbm', ['_dbmmodule.c'],
                                        define_macros=[('HAVE_NDBM_H',None)],
                                        libraries = ndbm_libs ) )
-            elif (self.compiler.find_library_file(lib_dirs, 'gdbm')
-                  and find_file("gdbm/ndbm.h", inc_dirs, []) is not None):
-                exts.append( Extension('_dbm', ['_dbmmodule.c'],
-                                       
define_macros=[('HAVE_GDBM_NDBM_H',None)],
-                                       libraries = ['gdbm'] ) )
+            elif self.compiler.find_library_file(lib_dirs, 'gdbm'):
+                gdbm_libs = ['gdbm']
+                if self.compiler.find_library_file(lib_dirs, 'gdbm_compat'):
+                    gdbm_libs.append('gdbm_compat')
+                if find_file("gdbm/ndbm.h", inc_dirs, []) is not None:
+                    exts.append( Extension(
+                        '_dbm', ['_dbmmodule.c'],
+                        define_macros=[('HAVE_GDBM_NDBM_H',None)],
+                        libraries = gdbm_libs ) )
+                elif find_file("gdbm-ndbm.h", inc_dirs, []) is not None:
+                    exts.append( Extension(
+                        '_dbm', ['_dbmmodule.c'],
+                        define_macros=[('HAVE_GDBM_DASH_NDBM_H',None)],
+                        libraries = gdbm_libs ) )
             elif db_incs is not None:
                 exts.append( Extension('_dbm', ['_dbmmodule.c'],
                                        library_dirs=dblib_dir,
Index: Modules/_dbmmodule.c
===================================================================
--- Modules/_dbmmodule.c        (revision 67489)
+++ Modules/_dbmmodule.c        (working copy)
@@ -21,6 +21,9 @@
 #elif defined(HAVE_GDBM_NDBM_H)
 #include <gdbm/ndbm.h>
 static char *which_dbm = "GNU gdbm";
+#elif defined(HAVE_GDBM_DASH_NDBM_H)
+#include <gdbm-ndbm.h>
+static char *which_dbm = "GNU gdbm";
 #elif defined(HAVE_BERKDB_H)
 #include <db.h>
 static char *which_dbm = "Berkeley DB";
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to