[issue4483] Error to build _dbm module during make

Roumen Petrov report at bugs.python.org
Sun Dec 7 23:52:09 CET 2008


Roumen Petrov <bugtrack at roumenpetrov.info> added the comment:

The old if statement was "flat":
if find_file("ndbm.h", inc_dirs, []) is not None:
   <CODE>
elif (self.compiler.find_library_file(lib_dirs, 'gdbm')
      and find_file("gdbm/ndbm.h", inc_dirs, []) is not None):
   <CODE>
elif db_incs is not None:
   <CODE>
else:
   miss
If the second case fail, try third and if  succeed build dbm with
"berkeley db".

The new if statement contain nested if:
Now the second case is only "self.compiler.find_library_file(lib_dirs,
'gdbm'):" and if succeed (my case) =>
Failed to find the necessary bits to build these modules:
... dbm ...
Note the build system lack headers "gdbm/ndbm.h", "gdbm-ndbm.h".


To restore previous I add copy of code from third case as new case in
nested if:
===============
                         '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,
+                        runtime_library_dirs=dblib_dir,
+                        include_dirs=db_incs,
+                        define_macros=[('HAVE_BERKDB_H',None),
+                                       ('DB_DBM_HSEARCH',None)],
+                        libraries=dblibs))
                 else:
                     missing.append('dbm')
             elif db_incs is not None:
===============
Note that above is not proposed patch as I don't like nested ifs and
code duplicate.
Is possible the checks to be in a new separate function ?

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4483>
_______________________________________


More information about the Python-bugs-list mailing list