summaryrefslogtreecommitdiff
path: root/lang/python31/patches/patch-am
diff options
context:
space:
mode:
Diffstat (limited to 'lang/python31/patches/patch-am')
-rw-r--r--lang/python31/patches/patch-am71
1 files changed, 41 insertions, 30 deletions
diff --git a/lang/python31/patches/patch-am b/lang/python31/patches/patch-am
index 2e291d574ee..14475c61048 100644
--- a/lang/python31/patches/patch-am
+++ b/lang/python31/patches/patch-am
@@ -1,4 +1,4 @@
-$NetBSD: patch-am,v 1.3 2011/10/18 21:59:18 sbd Exp $
+$NetBSD: patch-am,v 1.4 2011/10/31 06:50:55 sbd Exp $
--- setup.py.orig 2011-06-11 15:48:52.000000000 +0000
+++ setup.py
@@ -41,36 +41,47 @@ $NetBSD: patch-am,v 1.3 2011/10/18 21:59:18 sbd Exp $
if (ssl_incs is not None and
ssl_libs is not None):
-@@ -1054,13 +1058,15 @@ class PyBuildExt(build_ext):
- ndbm_libs = ['ndbm']
- else:
- ndbm_libs = []
-- print("building dbm using ndbm")
-- dbmext = Extension('_dbm', ['_dbmmodule.c'],
-+ if not self.compiler.find_library_file(lib_dirs,
-+ 'gdbm'):
-+ print("building dbm using ndbm")
-+ dbmext = Extension('_dbm', ['_dbmmodule.c'],
- define_macros=[
- ('HAVE_NDBM_H',None),
- ],
- libraries=ndbm_libs)
-- break
+@@ -1037,6 +1041,30 @@ class PyBuildExt(build_ext):
+ dbm_order = ['gdbm']
+ # The standard Unix dbm module:
+ if platform not in ['cygwin']:
++
++ ## Top half based on find_file
++ def find_ndbm_h(dirs):
++ ret = None
++ if sys.platform == 'darwin':
++ sysroot = macosx_sdk_root()
++ for dir in dirs:
++ f = os.path.join(dir, 'ndbm.h')
++ if sys.platform == 'darwin' and is_macosx_sdk_path(dir):
++ f = os.path.join(sysroot, dir[1:], filename)
++ if not os.path.exists(f): continue
++
++ ret = 'True'
++ input = text_file.TextFile(f)
++ while 1:
++ line = input.readline()
++ if not line: break
++ if re.search('This file is part of GDBM', line):
++ ret = None
+ break
-
- elif cand == "gdbm":
- if self.compiler.find_library_file(lib_dirs, 'gdbm'):
-@@ -1085,7 +1091,8 @@ class PyBuildExt(build_ext):
- ],
- libraries = gdbm_libs)
- break
-- elif cand == "bdb":
++ input.close()
++ break
++ return ret
+
-+ if cand == "bdb" and dbmext is None:
- if db_incs is not None:
- print("building dbm using bdb")
- dbmext = Extension('_dbm', ['_dbmmodule.c'],
-@@ -1315,6 +1322,14 @@ class PyBuildExt(build_ext):
+ config_args = [arg.strip("'")
+ for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
+ dbm_args = [arg for arg in config_args
+@@ -1048,7 +1076,7 @@ class PyBuildExt(build_ext):
+ dbmext = None
+ for cand in dbm_order:
+ if cand == "ndbm":
+- if find_file("ndbm.h", inc_dirs, []) is not None:
++ if find_ndbm_h(inc_dirs) is not None:
+ # Some systems have -lndbm, others don't
+ if self.compiler.find_library_file(lib_dirs, 'ndbm'):
+ ndbm_libs = ['ndbm']
+@@ -1315,6 +1343,14 @@ class PyBuildExt(build_ext):
macros = dict()
libraries = []
@@ -85,7 +96,7 @@ $NetBSD: patch-am,v 1.3 2011/10/18 21:59:18 sbd Exp $
else: # Linux and other unices
macros = dict()
libraries = ['rt']
-@@ -1831,8 +1846,8 @@ def main():
+@@ -1831,8 +1867,8 @@ def main():
# called unless there's at least one extension module defined.
ext_modules=[Extension('_struct', ['_struct.c'])],