- Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify

the order that backends for the dbm extension are checked.
This commit is contained in:
Matthias Klose 2009-04-29 19:52:49 +00:00
parent 10cbe4886e
commit 51c614e3bf
2 changed files with 6 additions and 5 deletions

View File

@ -1921,7 +1921,7 @@ AC_MSG_RESULT($with_system_ffi)
# Check for --with-dbmliborder # Check for --with-dbmliborder
AC_MSG_CHECKING(for --with-dbmliborder) AC_MSG_CHECKING(for --with-dbmliborder)
AC_ARG_WITH(dbmliborder, AC_ARG_WITH(dbmliborder,
AC_HELP_STRING(--with-dbmliborder=db1:db2:..., order to check db backends for dbm), AC_HELP_STRING([--with-dbmliborder=db1:db2:...], [order to check db backends for dbm. Valid value is a colon separated string with the backend names `ndbm', `gdbm' and `bdb'.]),
[ [
if test x$with_dbmliborder = xyes if test x$with_dbmliborder = xyes
then then

View File

@ -1000,13 +1000,14 @@ class PyBuildExt(build_ext):
# The standard Unix dbm module: # The standard Unix dbm module:
if platform not in ['cygwin']: if platform not in ['cygwin']:
config_args = sysconfig.get_config_var("CONFIG_ARGS") config_args = [arg.strip("'")
dbm_args = [arg.split('=')[-1] for arg in args.split() for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
dbm_args = [arg.split('=')[-1] for arg in config_args
if arg.startswith('--with-dbmliborder=')] if arg.startswith('--with-dbmliborder=')]
if dbm_args: if dbm_args:
dbm_order = "ndbm:gdbm:bdb".split(":") dbm_order = dbm_args[-1].split(":")
else: else:
dbm_order = dbm_args.split(":") dbm_order = "ndbm:gdbm:bdb".split(":")
dbmext = None dbmext = None
for cand in dbm_order: for cand in dbm_order:
if cand == "ndbm": if cand == "ndbm":