Several packages provide a dbm-compatible API. Currently, the code in Python's setup.py hardcodes the order of consideration: ndbm, then gdbm, then Berkeley DB. While the APIs are compatible, the file formats are all different as far as I know. If you have ndbm but want to use Berkeley DB format, you're stuck. Right now editing setup.py is the only way to influence the order.
I opened an issue on the bug tracker about this:
It includes a patch which adds an optional environment variable (PYDBMLIBORDER) which builders can use to override the order of the default library checks. I'm not sure that's the "correct" way to do this, but I'm at a loss to figure out how else to do it. Is it possible to easily add a flag to setup.py, say --dbm-order=gdbm:bdb:ndbm?
If you've got any -- even passing -- interest in this, please read the issue and add a comment if you feel so moved.
This grew out of a change to adapt to new gdbm library organization:
Unbeknownst to me, I apparently wound up fixing a previously reported issue about the change: