diff --git a/Misc/NEWS b/Misc/NEWS index b32d4555e8c9..d335bfd9d4bc 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -406,6 +406,8 @@ Extension Modules Build ----- +- Issue #6491: Allow --with-dbmliborder to specify that no dbms will be built. + - Issue #7589: Only build the nis module when the correct header files are found. diff --git a/setup.py b/setup.py index b8bad1461702..ef70df9a55a0 100644 --- a/setup.py +++ b/setup.py @@ -893,14 +893,15 @@ class db_found(Exception): pass else: missing.append('_sqlite3') + dbm_order = ['gdbm'] # The standard Unix dbm module: if platform not in ['cygwin']: config_args = [arg.strip("'") for arg in sysconfig.get_config_var("CONFIG_ARGS").split()] - dbm_args = [arg.split('=')[-1] for arg in config_args + dbm_args = [arg for arg in config_args if arg.startswith('--with-dbmliborder=')] if dbm_args: - dbm_order = dbm_args[-1].split(":") + dbm_order = [arg.split('=')[-1] for arg in dbm_args][-1].split(":") else: dbm_order = "ndbm:gdbm:bdb".split(":") dbmext = None @@ -962,7 +963,8 @@ class db_found(Exception): pass missing.append('_dbm') # Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm: - if (self.compiler.find_library_file(lib_dirs, 'gdbm')): + if ('gdbm' in dbm_order and + self.compiler.find_library_file(lib_dirs, 'gdbm')): exts.append( Extension('_gdbm', ['_gdbmmodule.c'], libraries = ['gdbm'] ) ) else: