From edfe72f66fd789d65b0c7125540c08d3e98a901e Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Fri, 1 Jan 2010 15:21:13 +0000 Subject: [PATCH] allow --with-dbmliborder to specify that no dbm modules will be built #6491 --- Misc/NEWS | 2 ++ setup.py | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS index acb03be4c4c..cf9148177f7 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -93,6 +93,8 @@ C-API Build ----- +- Issue #6491: Allow --with-dbmliborder to specify that no dbms will be built. + - Issue #6943: Use pkg-config to find the libffi headers when the --with-system-ffi flag is used. diff --git a/setup.py b/setup.py index 3749054b867..faf2c333864 100644 --- a/setup.py +++ b/setup.py @@ -1000,14 +1000,15 @@ class PyBuildExt(build_ext): else: missing.append('bsddb185') + 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 @@ -1071,7 +1072,8 @@ class PyBuildExt(build_ext): missing.append('dbm') # Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm: - if (self.compiler_obj.find_library_file(lib_dirs, 'gdbm')): + if ('gdbm' in dbm_order and + self.compiler_obj.find_library_file(lib_dirs, 'gdbm')): exts.append( Extension('gdbm', ['gdbmmodule.c'], libraries = ['gdbm'] ) ) else: