Wed May 21 00:31:07 2014 UTC ()
search openssl header file from prefered ssl_incs over system inc_dirs.


(obache)
diff -r1.38 -r1.39 pkgsrc/lang/python27/distinfo
diff -r1.16 -r1.17 pkgsrc/lang/python27/patches/patch-am

cvs diff -r1.38 -r1.39 pkgsrc/lang/python27/distinfo (switch to unified diff)

--- pkgsrc/lang/python27/distinfo 2014/05/20 16:48:00 1.38
+++ pkgsrc/lang/python27/distinfo 2014/05/21 00:31:07 1.39
@@ -1,28 +1,28 @@ @@ -1,28 +1,28 @@
1$NetBSD: distinfo,v 1.38 2014/05/20 16:48:00 adam Exp $ 1$NetBSD: distinfo,v 1.39 2014/05/21 00:31:07 obache Exp $
2 2
3SHA1 (Python-2.7.6.tar.xz) = 8321636af2acbeaa68fc635d7dda7369ed446a80 3SHA1 (Python-2.7.6.tar.xz) = 8321636af2acbeaa68fc635d7dda7369ed446a80
4RMD160 (Python-2.7.6.tar.xz) = 8efc73a01a466d8fa16c5c1734c89be79c2c538a 4RMD160 (Python-2.7.6.tar.xz) = 8efc73a01a466d8fa16c5c1734c89be79c2c538a
5Size (Python-2.7.6.tar.xz) = 10431288 bytes 5Size (Python-2.7.6.tar.xz) = 10431288 bytes
6SHA1 (patch-Include_node.h) = 673d148b625711ac47e4bfeb0f5b0d5b31f94d7e 6SHA1 (patch-Include_node.h) = 673d148b625711ac47e4bfeb0f5b0d5b31f94d7e
7SHA1 (patch-Include_pyerrors.h) = 3eba043c83b1d1df4918524f7b53047a6ed372ae 7SHA1 (patch-Include_pyerrors.h) = 3eba043c83b1d1df4918524f7b53047a6ed372ae
8SHA1 (patch-Lib_distutils_unixccompiler.py) = 39b967dc2ae648143d5841f22602a21063b4d5ea 8SHA1 (patch-Lib_distutils_unixccompiler.py) = 39b967dc2ae648143d5841f22602a21063b4d5ea
9SHA1 (patch-Modules___ssl.c) = aaddaea5bcd6c84d3d896c7c37f710933b8228bc 9SHA1 (patch-Modules___ssl.c) = aaddaea5bcd6c84d3d896c7c37f710933b8228bc
10SHA1 (patch-Modules_getpath.c) = f68b38eb90f974b67ceab3922ce7f92eb77f25c3 10SHA1 (patch-Modules_getpath.c) = f68b38eb90f974b67ceab3922ce7f92eb77f25c3
11SHA1 (patch-Modules_readline.c) = 0afcbd1c8bdf3648177bed760e6cccf54c857451 11SHA1 (patch-Modules_readline.c) = 0afcbd1c8bdf3648177bed760e6cccf54c857451
12SHA1 (patch-Modules_socketmodule.c) = a8a4da9381a9485f7e999ae7db4aa715adfacfa5 12SHA1 (patch-Modules_socketmodule.c) = a8a4da9381a9485f7e999ae7db4aa715adfacfa5
13SHA1 (patch-aa) = 990e4025bb6a37715e1f5df1831499f0ab08acfa 13SHA1 (patch-aa) = 990e4025bb6a37715e1f5df1831499f0ab08acfa
14SHA1 (patch-ab) = 0d0ae9802dfe3b85659adb16793affd8c4ffce43 14SHA1 (patch-ab) = 0d0ae9802dfe3b85659adb16793affd8c4ffce43
15SHA1 (patch-ad) = de730b9f5a5efb56afa8bed05824b5f6579242ec 15SHA1 (patch-ad) = de730b9f5a5efb56afa8bed05824b5f6579242ec
16SHA1 (patch-ae) = ff6d8c6164fe3c6dc4fb33d88eb8a49d5c5442f6 16SHA1 (patch-ae) = ff6d8c6164fe3c6dc4fb33d88eb8a49d5c5442f6
17SHA1 (patch-ah) = ae3ce0656d890ca34292920bf0185f94ba847139 17SHA1 (patch-ah) = ae3ce0656d890ca34292920bf0185f94ba847139
18SHA1 (patch-al) = dd8bed847f797b97df1a9ad7ffe17645b0f08925 18SHA1 (patch-al) = dd8bed847f797b97df1a9ad7ffe17645b0f08925
19SHA1 (patch-am) = 4a1fb4f30d27463587901f5cf40adfc7b9c5904a 19SHA1 (patch-am) = 366ce0b130cc9b6d6c5354769da05bb4b5845e01
20SHA1 (patch-an) = 6098fbf0fc31422196cc40d3a227934523db11ca 20SHA1 (patch-an) = 6098fbf0fc31422196cc40d3a227934523db11ca
21SHA1 (patch-ao) = 3a1cd2b255340fd23fc1fce8680e692581ffcec1 21SHA1 (patch-ao) = 3a1cd2b255340fd23fc1fce8680e692581ffcec1
22SHA1 (patch-au) = 2a2a988ac92553d17eb898870d1adb3c30a59b66 22SHA1 (patch-au) = 2a2a988ac92553d17eb898870d1adb3c30a59b66
23SHA1 (patch-av) = a14eaf4d5db6fc3b79ed896fbfcc34ca98051af2 23SHA1 (patch-av) = a14eaf4d5db6fc3b79ed896fbfcc34ca98051af2
24SHA1 (patch-aw) = 15652e241f371a22c7300f46771825ea74514fa0 24SHA1 (patch-aw) = 15652e241f371a22c7300f46771825ea74514fa0
25SHA1 (patch-ax) = be7498a37a89c86d278d07c38666237215308498 25SHA1 (patch-ax) = be7498a37a89c86d278d07c38666237215308498
26SHA1 (patch-az) = 56a3adedfc87cbbb0307ccb4b452665f79bde582 26SHA1 (patch-az) = 56a3adedfc87cbbb0307ccb4b452665f79bde582
27SHA1 (patch-pyconfig.h.in) = c4544178ecceffb6ed911df39d3a64bff665cb34 27SHA1 (patch-pyconfig.h.in) = c4544178ecceffb6ed911df39d3a64bff665cb34
28SHA1 (patch-xa) = 25f02b03f1c5534e1d839a5489d5a046071f32c0 28SHA1 (patch-xa) = 25f02b03f1c5534e1d839a5489d5a046071f32c0

cvs diff -r1.16 -r1.17 pkgsrc/lang/python27/patches/Attic/patch-am (switch to unified diff)

--- pkgsrc/lang/python27/patches/Attic/patch-am 2014/05/20 16:48:00 1.16
+++ pkgsrc/lang/python27/patches/Attic/patch-am 2014/05/21 00:31:07 1.17
@@ -1,375 +1,389 @@ @@ -1,375 +1,389 @@
1$NetBSD: patch-am,v 1.16 2014/05/20 16:48:00 adam Exp $ 1$NetBSD: patch-am,v 1.17 2014/05/21 00:31:07 obache Exp $
2 2
3Disabled modules for normal build: 3Disabled modules for normal build:
4bsddb 4bsddb
5curses 5curses
6curses_panel 6curses_panel
7elementtree 7elementtree
8sqlite3 8sqlite3
9tkinter 9tkinter
10gdbm 10gdbm
11pyexpat 11pyexpat
12readline 12readline
13{linux,oss,sun}audiodev 13{linux,oss,sun}audiodev
14spwd 14spwd
15Those have separate packages where needed. 15Those have separate packages where needed.
16 16
17Only check the BUILDLINK_DIR for libraries etc, do not pick up random 17Only check the BUILDLINK_DIR for libraries etc, do not pick up random
18headers and libraries from the system. 18headers and libraries from the system.
19 19
20Build the _ssl module with pkgsrc choiced OpenSSL. 20Build the _ssl module with pkgsrc choiced OpenSSL.
21 21
22Build the 1.85 compat module all the time against the BDB version of choice. 22Build the 1.85 compat module all the time against the BDB version of choice.
23 23
24cygwin 2.7.3-no-libm.patch 24cygwin 2.7.3-no-libm.patch
25 25
26--- setup.py.orig 2013-11-10 07:36:41.000000000 +0000 26--- setup.py.orig 2013-11-10 07:36:41.000000000 +0000
27+++ setup.py 27+++ setup.py
28@@ -33,7 +33,7 @@ host_platform = get_platform() 28@@ -33,7 +33,7 @@ host_platform = get_platform()
29 COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS")) 29 COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
30  30
31 # This global variable is used to hold the list of modules to be disabled. 31 # This global variable is used to hold the list of modules to be disabled.
32-disabled_module_list = [] 32-disabled_module_list = []
33+disabled_module_list = ["_bsddb", "_curses", "_curses_panel", "_elementtree", "_sqlite3", "_tkinter", "gdbm", "pyexpat", "readline", "linuxaudiodev", "ossaudiodev", "spwd", "sunaudiodev"] 33+disabled_module_list = ["_bsddb", "_curses", "_curses_panel", "_elementtree", "_sqlite3", "_tkinter", "gdbm", "pyexpat", "readline", "linuxaudiodev", "ossaudiodev", "spwd", "sunaudiodev"]
34  34
35 def add_dir_to_list(dirlist, dir): 35 def add_dir_to_list(dirlist, dir):
36 """Add the directory 'dir' to the list 'dirlist' (at the front) if 36 """Add the directory 'dir' to the list 'dirlist' (at the front) if
37@@ -436,10 +436,15 @@ class PyBuildExt(build_ext): 37@@ -436,10 +436,15 @@ class PyBuildExt(build_ext):
38 os.unlink(tmpfile) 38 os.unlink(tmpfile)
39  39
40 def detect_modules(self): 40 def detect_modules(self):
41- # Ensure that /usr/local is always used 41- # Ensure that /usr/local is always used
42- if not cross_compiling: 42- if not cross_compiling:
43- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') 43- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
44- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') 44- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
45+ # Add the buildlink directories for pkgsrc 45+ # Add the buildlink directories for pkgsrc
46+ if os.environ.has_key('BUILDLINK_DIR'): 46+ if os.environ.has_key('BUILDLINK_DIR'):
47+ dir = os.environ['BUILDLINK_DIR'] 47+ dir = os.environ['BUILDLINK_DIR']
48+ libdir = dir + '/lib' 48+ libdir = dir + '/lib'
49+ incdir = dir + '/include' 49+ incdir = dir + '/include'
50+ if libdir not in self.compiler.library_dirs: 50+ if libdir not in self.compiler.library_dirs:
51+ self.compiler.library_dirs.insert(0, libdir) 51+ self.compiler.library_dirs.insert(0, libdir)
52+ if incdir not in self.compiler.include_dirs: 52+ if incdir not in self.compiler.include_dirs:
53+ self.compiler.include_dirs.insert(0, incdir) 53+ self.compiler.include_dirs.insert(0, incdir)
54 if cross_compiling: 54 if cross_compiling:
55 self.add_gcc_paths() 55 self.add_gcc_paths()
56 self.add_multiarch_paths() 56 self.add_multiarch_paths()
57@@ -551,7 +556,7 @@ class PyBuildExt(build_ext): 57@@ -551,7 +556,7 @@ class PyBuildExt(build_ext):
58  58
59 # Check for MacOS X, which doesn't need libm.a at all 59 # Check for MacOS X, which doesn't need libm.a at all
60 math_libs = ['m'] 60 math_libs = ['m']
61- if host_platform in ['darwin', 'beos']: 61- if host_platform in ['darwin', 'beos']:
62+ if host_platform in ['darwin', 'beos', 'cygwin']: 62+ if host_platform in ['darwin', 'beos', 'cygwin']:
63 math_libs = [] 63 math_libs = []
64  64
65 # XXX Omitted modules: gl, pure, dl, SGI-specific modules 65 # XXX Omitted modules: gl, pure, dl, SGI-specific modules
66@@ -785,8 +790,7 @@ class PyBuildExt(build_ext): 66@@ -785,11 +790,10 @@ class PyBuildExt(build_ext):
67 libraries=math_libs) ) 67 libraries=math_libs) )
68 # Detect SSL support for the socket module (via _ssl) 68 # Detect SSL support for the socket module (via _ssl)
69 search_for_ssl_incs_in = [ 69 search_for_ssl_incs_in = [
70- '/usr/local/ssl/include', 70- '/usr/local/ssl/include',
71- '/usr/contrib/ssl/include/' 71- '/usr/contrib/ssl/include/'
72+ '@SSLBASE@/include' 72+ '@SSLBASE@/include'
73 ] 73 ]
74 ssl_incs = find_file('openssl/ssl.h', inc_dirs, 74- ssl_incs = find_file('openssl/ssl.h', inc_dirs,
75 search_for_ssl_incs_in 75- search_for_ssl_incs_in
 76+ ssl_incs = find_file('openssl/ssl.h', [],
 77+ search_for_ssl_incs_in + inc_dirs
 78 )
 79 if ssl_incs is not None:
 80 krb5_h = find_file('krb5.h', inc_dirs,
76@@ -797,9 +801,7 @@ class PyBuildExt(build_ext): 81@@ -797,9 +801,7 @@ class PyBuildExt(build_ext):
77 if krb5_h: 82 if krb5_h:
78 ssl_incs += krb5_h 83 ssl_incs += krb5_h
79 ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, 84 ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
80- ['/usr/local/ssl/lib', 85- ['/usr/local/ssl/lib',
81- '/usr/contrib/ssl/lib/' 86- '/usr/contrib/ssl/lib/'
82- ] ) 87- ] )
83+ [] ) 88+ [] )
84  89
85 if (ssl_incs is not None and 90 if (ssl_incs is not None and
86 ssl_libs is not None): 91 ssl_libs is not None):
 92@@ -818,7 +820,7 @@ class PyBuildExt(build_ext):
 93
 94 # look for the openssl version header on the compiler search path.
 95 opensslv_h = find_file('openssl/opensslv.h', [],
 96- inc_dirs + search_for_ssl_incs_in)
 97+ search_for_ssl_incs_in + inc_dirs)
 98 if opensslv_h:
 99 name = os.path.join(opensslv_h[0], 'openssl/opensslv.h')
 100 if host_platform == 'darwin' and is_macosx_sdk_path(name):
87@@ -918,175 +920,6 @@ class PyBuildExt(build_ext): 101@@ -918,175 +920,6 @@ class PyBuildExt(build_ext):
88 else: 102 else:
89 raise ValueError("unknown major BerkeleyDB version", major) 103 raise ValueError("unknown major BerkeleyDB version", major)
90  104
91- # construct a list of paths to look for the header file in on 105- # construct a list of paths to look for the header file in on
92- # top of the normal inc_dirs. 106- # top of the normal inc_dirs.
93- db_inc_paths = [ 107- db_inc_paths = [
94- '/usr/include/db4', 108- '/usr/include/db4',
95- '/usr/local/include/db4', 109- '/usr/local/include/db4',
96- '/opt/sfw/include/db4', 110- '/opt/sfw/include/db4',
97- '/usr/include/db3', 111- '/usr/include/db3',
98- '/usr/local/include/db3', 112- '/usr/local/include/db3',
99- '/opt/sfw/include/db3', 113- '/opt/sfw/include/db3',
100- # Fink defaults (http://fink.sourceforge.net/) 114- # Fink defaults (http://fink.sourceforge.net/)
101- '/sw/include/db4', 115- '/sw/include/db4',
102- '/sw/include/db3', 116- '/sw/include/db3',
103- ] 117- ]
104- # 4.x minor number specific paths 118- # 4.x minor number specific paths
105- for x in gen_db_minor_ver_nums(4): 119- for x in gen_db_minor_ver_nums(4):
106- db_inc_paths.append('/usr/include/db4%d' % x) 120- db_inc_paths.append('/usr/include/db4%d' % x)
107- db_inc_paths.append('/usr/include/db4.%d' % x) 121- db_inc_paths.append('/usr/include/db4.%d' % x)
108- db_inc_paths.append('/usr/local/BerkeleyDB.4.%d/include' % x) 122- db_inc_paths.append('/usr/local/BerkeleyDB.4.%d/include' % x)
109- db_inc_paths.append('/usr/local/include/db4%d' % x) 123- db_inc_paths.append('/usr/local/include/db4%d' % x)
110- db_inc_paths.append('/pkg/db-4.%d/include' % x) 124- db_inc_paths.append('/pkg/db-4.%d/include' % x)
111- db_inc_paths.append('/opt/db-4.%d/include' % x) 125- db_inc_paths.append('/opt/db-4.%d/include' % x)
112- # MacPorts default (http://www.macports.org/) 126- # MacPorts default (http://www.macports.org/)
113- db_inc_paths.append('/opt/local/include/db4%d' % x) 127- db_inc_paths.append('/opt/local/include/db4%d' % x)
114- # 3.x minor number specific paths 128- # 3.x minor number specific paths
115- for x in gen_db_minor_ver_nums(3): 129- for x in gen_db_minor_ver_nums(3):
116- db_inc_paths.append('/usr/include/db3%d' % x) 130- db_inc_paths.append('/usr/include/db3%d' % x)
117- db_inc_paths.append('/usr/local/BerkeleyDB.3.%d/include' % x) 131- db_inc_paths.append('/usr/local/BerkeleyDB.3.%d/include' % x)
118- db_inc_paths.append('/usr/local/include/db3%d' % x) 132- db_inc_paths.append('/usr/local/include/db3%d' % x)
119- db_inc_paths.append('/pkg/db-3.%d/include' % x) 133- db_inc_paths.append('/pkg/db-3.%d/include' % x)
120- db_inc_paths.append('/opt/db-3.%d/include' % x) 134- db_inc_paths.append('/opt/db-3.%d/include' % x)
121- 135-
122- if cross_compiling: 136- if cross_compiling:
123- db_inc_paths = [] 137- db_inc_paths = []
124- 138-
125- # Add some common subdirectories for Sleepycat DB to the list, 139- # Add some common subdirectories for Sleepycat DB to the list,
126- # based on the standard include directories. This way DB3/4 gets 140- # based on the standard include directories. This way DB3/4 gets
127- # picked up when it is installed in a non-standard prefix and 141- # picked up when it is installed in a non-standard prefix and
128- # the user has added that prefix into inc_dirs. 142- # the user has added that prefix into inc_dirs.
129- std_variants = [] 143- std_variants = []
130- for dn in inc_dirs: 144- for dn in inc_dirs:
131- std_variants.append(os.path.join(dn, 'db3')) 145- std_variants.append(os.path.join(dn, 'db3'))
132- std_variants.append(os.path.join(dn, 'db4')) 146- std_variants.append(os.path.join(dn, 'db4'))
133- for x in gen_db_minor_ver_nums(4): 147- for x in gen_db_minor_ver_nums(4):
134- std_variants.append(os.path.join(dn, "db4%d"%x)) 148- std_variants.append(os.path.join(dn, "db4%d"%x))
135- std_variants.append(os.path.join(dn, "db4.%d"%x)) 149- std_variants.append(os.path.join(dn, "db4.%d"%x))
136- for x in gen_db_minor_ver_nums(3): 150- for x in gen_db_minor_ver_nums(3):
137- std_variants.append(os.path.join(dn, "db3%d"%x)) 151- std_variants.append(os.path.join(dn, "db3%d"%x))
138- std_variants.append(os.path.join(dn, "db3.%d"%x)) 152- std_variants.append(os.path.join(dn, "db3.%d"%x))
139- 153-
140- db_inc_paths = std_variants + db_inc_paths 154- db_inc_paths = std_variants + db_inc_paths
141- db_inc_paths = [p for p in db_inc_paths if os.path.exists(p)] 155- db_inc_paths = [p for p in db_inc_paths if os.path.exists(p)]
142- 156-
143- db_ver_inc_map = {} 157- db_ver_inc_map = {}
144- 158-
145- if host_platform == 'darwin': 159- if host_platform == 'darwin':
146- sysroot = macosx_sdk_root() 160- sysroot = macosx_sdk_root()
147- 161-
148- class db_found(Exception): pass 162- class db_found(Exception): pass
149- try: 163- try:
150- # See whether there is a Sleepycat header in the standard 164- # See whether there is a Sleepycat header in the standard
151- # search path. 165- # search path.
152- for d in inc_dirs + db_inc_paths: 166- for d in inc_dirs + db_inc_paths:
153- f = os.path.join(d, "db.h") 167- f = os.path.join(d, "db.h")
154- 168-
155- if host_platform == 'darwin' and is_macosx_sdk_path(d): 169- if host_platform == 'darwin' and is_macosx_sdk_path(d):
156- f = os.path.join(sysroot, d[1:], "db.h") 170- f = os.path.join(sysroot, d[1:], "db.h")
157- 171-
158- if db_setup_debug: print "db: looking for db.h in", f 172- if db_setup_debug: print "db: looking for db.h in", f
159- if os.path.exists(f): 173- if os.path.exists(f):
160- f = open(f).read() 174- f = open(f).read()
161- m = re.search(r"#define\WDB_VERSION_MAJOR\W(\d+)", f) 175- m = re.search(r"#define\WDB_VERSION_MAJOR\W(\d+)", f)
162- if m: 176- if m:
163- db_major = int(m.group(1)) 177- db_major = int(m.group(1))
164- m = re.search(r"#define\WDB_VERSION_MINOR\W(\d+)", f) 178- m = re.search(r"#define\WDB_VERSION_MINOR\W(\d+)", f)
165- db_minor = int(m.group(1)) 179- db_minor = int(m.group(1))
166- db_ver = (db_major, db_minor) 180- db_ver = (db_major, db_minor)
167- 181-
168- # Avoid 4.6 prior to 4.6.21 due to a BerkeleyDB bug 182- # Avoid 4.6 prior to 4.6.21 due to a BerkeleyDB bug
169- if db_ver == (4, 6): 183- if db_ver == (4, 6):
170- m = re.search(r"#define\WDB_VERSION_PATCH\W(\d+)", f) 184- m = re.search(r"#define\WDB_VERSION_PATCH\W(\d+)", f)
171- db_patch = int(m.group(1)) 185- db_patch = int(m.group(1))
172- if db_patch < 21: 186- if db_patch < 21:
173- print "db.h:", db_ver, "patch", db_patch, 187- print "db.h:", db_ver, "patch", db_patch,
174- print "being ignored (4.6.x must be >= 4.6.21)" 188- print "being ignored (4.6.x must be >= 4.6.21)"
175- continue 189- continue
176- 190-
177- if ( (db_ver not in db_ver_inc_map) and 191- if ( (db_ver not in db_ver_inc_map) and
178- allow_db_ver(db_ver) ): 192- allow_db_ver(db_ver) ):
179- # save the include directory with the db.h version 193- # save the include directory with the db.h version
180- # (first occurrence only) 194- # (first occurrence only)
181- db_ver_inc_map[db_ver] = d 195- db_ver_inc_map[db_ver] = d
182- if db_setup_debug: 196- if db_setup_debug:
183- print "db.h: found", db_ver, "in", d 197- print "db.h: found", db_ver, "in", d
184- else: 198- else:
185- # we already found a header for this library version 199- # we already found a header for this library version
186- if db_setup_debug: print "db.h: ignoring", d 200- if db_setup_debug: print "db.h: ignoring", d
187- else: 201- else:
188- # ignore this header, it didn't contain a version number 202- # ignore this header, it didn't contain a version number
189- if db_setup_debug: 203- if db_setup_debug:
190- print "db.h: no version number version in", d 204- print "db.h: no version number version in", d
191- 205-
192- db_found_vers = db_ver_inc_map.keys() 206- db_found_vers = db_ver_inc_map.keys()
193- db_found_vers.sort() 207- db_found_vers.sort()
194- 208-
195- while db_found_vers: 209- while db_found_vers:
196- db_ver = db_found_vers.pop() 210- db_ver = db_found_vers.pop()
197- db_incdir = db_ver_inc_map[db_ver] 211- db_incdir = db_ver_inc_map[db_ver]
198- 212-
199- # check lib directories parallel to the location of the header 213- # check lib directories parallel to the location of the header
200- db_dirs_to_check = [ 214- db_dirs_to_check = [
201- db_incdir.replace("include", 'lib64'), 215- db_incdir.replace("include", 'lib64'),
202- db_incdir.replace("include", 'lib'), 216- db_incdir.replace("include", 'lib'),
203- ] 217- ]
204- 218-
205- if host_platform != 'darwin': 219- if host_platform != 'darwin':
206- db_dirs_to_check = filter(os.path.isdir, db_dirs_to_check) 220- db_dirs_to_check = filter(os.path.isdir, db_dirs_to_check)
207- 221-
208- else: 222- else:
209- # Same as other branch, but takes OSX SDK into account 223- # Same as other branch, but takes OSX SDK into account
210- tmp = [] 224- tmp = []
211- for dn in db_dirs_to_check: 225- for dn in db_dirs_to_check:
212- if is_macosx_sdk_path(dn): 226- if is_macosx_sdk_path(dn):
213- if os.path.isdir(os.path.join(sysroot, dn[1:])): 227- if os.path.isdir(os.path.join(sysroot, dn[1:])):
214- tmp.append(dn) 228- tmp.append(dn)
215- else: 229- else:
216- if os.path.isdir(dn): 230- if os.path.isdir(dn):
217- tmp.append(dn) 231- tmp.append(dn)
218- db_dirs_to_check = tmp 232- db_dirs_to_check = tmp
219- 233-
220- # Look for a version specific db-X.Y before an ambiguous dbX 234- # Look for a version specific db-X.Y before an ambiguous dbX
221- # XXX should we -ever- look for a dbX name? Do any 235- # XXX should we -ever- look for a dbX name? Do any
222- # systems really not name their library by version and 236- # systems really not name their library by version and
223- # symlink to more general names? 237- # symlink to more general names?
224- for dblib in (('db-%d.%d' % db_ver), 238- for dblib in (('db-%d.%d' % db_ver),
225- ('db%d%d' % db_ver), 239- ('db%d%d' % db_ver),
226- ('db%d' % db_ver[0])): 240- ('db%d' % db_ver[0])):
227- dblib_file = self.compiler.find_library_file( 241- dblib_file = self.compiler.find_library_file(
228- db_dirs_to_check + lib_dirs, dblib ) 242- db_dirs_to_check + lib_dirs, dblib )
229- if dblib_file: 243- if dblib_file:
230- dblib_dir = [ os.path.abspath(os.path.dirname(dblib_file)) ] 244- dblib_dir = [ os.path.abspath(os.path.dirname(dblib_file)) ]
231- raise db_found 245- raise db_found
232- else: 246- else:
233- if db_setup_debug: print "db lib: ", dblib, "not found" 247- if db_setup_debug: print "db lib: ", dblib, "not found"
234- 248-
235- except db_found: 249- except db_found:
236- if db_setup_debug: 250- if db_setup_debug:
237- print "bsddb using BerkeleyDB lib:", db_ver, dblib 251- print "bsddb using BerkeleyDB lib:", db_ver, dblib
238- print "bsddb lib dir:", dblib_dir, " inc dir:", db_incdir 252- print "bsddb lib dir:", dblib_dir, " inc dir:", db_incdir
239- db_incs = [db_incdir] 253- db_incs = [db_incdir]
240- dblibs = [dblib] 254- dblibs = [dblib]
241- # We add the runtime_library_dirs argument because the 255- # We add the runtime_library_dirs argument because the
242- # BerkeleyDB lib we're linking against often isn't in the 256- # BerkeleyDB lib we're linking against often isn't in the
243- # system dynamic library search path. This is usually 257- # system dynamic library search path. This is usually
244- # correct and most trouble free, but may cause problems in 258- # correct and most trouble free, but may cause problems in
245- # some unusual system configurations (e.g. the directory 259- # some unusual system configurations (e.g. the directory
246- # is on an NFS server that goes away). 260- # is on an NFS server that goes away).
247- exts.append(Extension('_bsddb', ['_bsddb.c'], 261- exts.append(Extension('_bsddb', ['_bsddb.c'],
248- depends = ['bsddb.h'], 262- depends = ['bsddb.h'],
249- library_dirs=dblib_dir, 263- library_dirs=dblib_dir,
250- runtime_library_dirs=dblib_dir, 264- runtime_library_dirs=dblib_dir,
251- include_dirs=db_incs, 265- include_dirs=db_incs,
252- libraries=dblibs)) 266- libraries=dblibs))
253- else: 267- else:
254- if db_setup_debug: print "db: no appropriate library found" 268- if db_setup_debug: print "db: no appropriate library found"
255- db_incs = None 269- db_incs = None
256- dblibs = [] 270- dblibs = []
257- dblib_dir = None 271- dblib_dir = None
258- missing.append('_bsddb') 272- missing.append('_bsddb')
259- 273-
260 # The sqlite interface 274 # The sqlite interface
261 sqlite_setup_debug = False # verbose debug prints from this script? 275 sqlite_setup_debug = False # verbose debug prints from this script?
262  276
263@@ -1204,35 +1037,39 @@ class PyBuildExt(build_ext): 277@@ -1204,35 +1037,39 @@ class PyBuildExt(build_ext):
264 # we do not build this one. Otherwise this build will pick up 278 # we do not build this one. Otherwise this build will pick up
265 # the more recent berkeleydb's db.h file first in the include path 279 # the more recent berkeleydb's db.h file first in the include path
266 # when attempting to compile and it will fail. 280 # when attempting to compile and it will fail.
267- f = "/usr/include/db.h" 281- f = "/usr/include/db.h"
268- 282-
269- if host_platform == 'darwin': 283- if host_platform == 'darwin':
270- if is_macosx_sdk_path(f): 284- if is_macosx_sdk_path(f):
271- sysroot = macosx_sdk_root() 285- sysroot = macosx_sdk_root()
272- f = os.path.join(sysroot, f[1:]) 286- f = os.path.join(sysroot, f[1:])
273- 287-
274- if os.path.exists(f) and not db_incs: 288- if os.path.exists(f) and not db_incs:
275- data = open(f).read() 289- data = open(f).read()
276- m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data) 290- m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)
277- if m is not None: 291- if m is not None:
278- # bingo - old version used hash file format version 2 292- # bingo - old version used hash file format version 2
279- ### XXX this should be fixed to not be platform-dependent 293- ### XXX this should be fixed to not be platform-dependent
280- ### but I don't have direct access to an osf1 platform and 294- ### but I don't have direct access to an osf1 platform and
281- ### seemed to be muffing the search somehow 295- ### seemed to be muffing the search somehow
282- libraries = host_platform == "osf1" and ['db'] or None 296- libraries = host_platform == "osf1" and ['db'] or None
283- if libraries is not None: 297- if libraries is not None:
284- exts.append(Extension('bsddb185', ['bsddbmodule.c'], 298- exts.append(Extension('bsddb185', ['bsddbmodule.c'],
285- libraries=libraries)) 299- libraries=libraries))
286- else: 300- else:
287- exts.append(Extension('bsddb185', ['bsddbmodule.c'])) 301- exts.append(Extension('bsddb185', ['bsddbmodule.c']))
288- else: 302- else:
289- missing.append('bsddb185') 303- missing.append('bsddb185')
290+ libraries = os.getenv("PY_BDB_TYPE", "") 304+ libraries = os.getenv("PY_BDB_TYPE", "")
291+ if libraries: 305+ if libraries:
292+ exts.append(Extension('bsddb185', ['bsddbmodule.c'], 306+ exts.append(Extension('bsddb185', ['bsddbmodule.c'],
293+ libraries=['db'])) 307+ libraries=['db']))
294 else: 308 else:
295- missing.append('bsddb185') 309- missing.append('bsddb185')
296+ exts.append(Extension('bsddb185', ['bsddbmodule.c'])) 310+ exts.append(Extension('bsddb185', ['bsddbmodule.c']))
297  311
298 dbm_order = ['gdbm'] 312 dbm_order = ['gdbm']
299 # The standard Unix dbm module: 313 # The standard Unix dbm module:
300 if host_platform not in ['cygwin']: 314 if host_platform not in ['cygwin']:
301+ ## Top half based on find_file 315+ ## Top half based on find_file
302+ def find_ndbm_h(dirs): 316+ def find_ndbm_h(dirs):
303+ ret = None 317+ ret = None
304+ if sys.platform == 'darwin': 318+ if sys.platform == 'darwin':
305+ sysroot = macosx_sdk_root() 319+ sysroot = macosx_sdk_root()
306+ for dir in dirs: 320+ for dir in dirs:
307+ f = os.path.join(dir, 'ndbm.h') 321+ f = os.path.join(dir, 'ndbm.h')
308+ if sys.platform == 'darwin' and is_macosx_sdk_path(dir): 322+ if sys.platform == 'darwin' and is_macosx_sdk_path(dir):
309+ f = os.path.join(sysroot, dir[1:], 'ndbm.h') 323+ f = os.path.join(sysroot, dir[1:], 'ndbm.h')
310+ if not os.path.exists(f): continue 324+ if not os.path.exists(f): continue
311+ 325+
312+ ret = 'True' 326+ ret = 'True'
313+ input = text_file.TextFile(f) 327+ input = text_file.TextFile(f)
314+ while 1: 328+ while 1:
315+ line = input.readline() 329+ line = input.readline()
316+ if not line: break 330+ if not line: break
317+ if re.search('This file is part of GDBM', line): 331+ if re.search('This file is part of GDBM', line):
318+ ret = None 332+ ret = None
319+ break 333+ break
320+ input.close() 334+ input.close()
321+ break 335+ break
322+ return ret 336+ return ret
323+ 337+
324 config_args = [arg.strip("'") 338 config_args = [arg.strip("'")
325 for arg in sysconfig.get_config_var("CONFIG_ARGS").split()] 339 for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
326 dbm_args = [arg for arg in config_args 340 dbm_args = [arg for arg in config_args
327@@ -1244,7 +1081,7 @@ class PyBuildExt(build_ext): 341@@ -1244,7 +1081,7 @@ class PyBuildExt(build_ext):
328 dbmext = None 342 dbmext = None
329 for cand in dbm_order: 343 for cand in dbm_order:
330 if cand == "ndbm": 344 if cand == "ndbm":
331- if find_file("ndbm.h", inc_dirs, []) is not None: 345- if find_file("ndbm.h", inc_dirs, []) is not None:
332+ if find_ndbm_h(inc_dirs) is not None: 346+ if find_ndbm_h(inc_dirs) is not None:
333 # Some systems have -lndbm, others have -lgdbm_compat, 347 # Some systems have -lndbm, others have -lgdbm_compat,
334 # others don't have either 348 # others don't have either
335 if self.compiler.find_library_file(lib_dirs, 349 if self.compiler.find_library_file(lib_dirs,
336@@ -1288,18 +1125,14 @@ class PyBuildExt(build_ext): 350@@ -1288,18 +1125,14 @@ class PyBuildExt(build_ext):
337 libraries = gdbm_libs) 351 libraries = gdbm_libs)
338 break 352 break
339 elif cand == "bdb": 353 elif cand == "bdb":
340- if db_incs is not None: 354- if db_incs is not None:
341- print "building dbm using bdb" 355- print "building dbm using bdb"
342- dbmext = Extension('dbm', ['dbmmodule.c'], 356- dbmext = Extension('dbm', ['dbmmodule.c'],
343- library_dirs=dblib_dir, 357- library_dirs=dblib_dir,
344- runtime_library_dirs=dblib_dir, 358- runtime_library_dirs=dblib_dir,
345- include_dirs=db_incs, 359- include_dirs=db_incs,
346- define_macros=[ 360- define_macros=[
347- ('HAVE_BERKDB_H', None), 361- ('HAVE_BERKDB_H', None),
348- ('DB_DBM_HSEARCH', None), 362- ('DB_DBM_HSEARCH', None),
349- ], 363- ],
350- libraries=dblibs) 364- libraries=dblibs)
351- break 365- break
352+ print "building dbm using bdb" 366+ print "building dbm using bdb"
353+ dbmext = Extension('dbm', ['dbmmodule.c'], 367+ dbmext = Extension('dbm', ['dbmmodule.c'],
354+ define_macros=[ 368+ define_macros=[
355+ ('HAVE_BERKDB_H', None), 369+ ('HAVE_BERKDB_H', None),
356+ ('DB_DBM_HSEARCH', None), 370+ ('DB_DBM_HSEARCH', None),
357+ ], 371+ ],
358+ libraries=["db"]) 372+ libraries=["db"])
359+ break 373+ break
360 if dbmext is not None: 374 if dbmext is not None:
361 exts.append(dbmext) 375 exts.append(dbmext)
362 else: 376 else:
363@@ -2222,9 +2055,9 @@ def main(): 377@@ -2222,9 +2055,9 @@ def main():
364 ext_modules=[Extension('_struct', ['_struct.c'])], 378 ext_modules=[Extension('_struct', ['_struct.c'])],
365  379
366 # Scripts to install 380 # Scripts to install
367- scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle', 381- scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle',
368- 'Tools/scripts/2to3', 382- 'Tools/scripts/2to3',
369- 'Lib/smtpd.py'] 383- 'Lib/smtpd.py']
370+ scripts = ['Tools/scripts/pydoc2.7', 384+ scripts = ['Tools/scripts/pydoc2.7',
371+ 'Tools/scripts/2to3-2.7', 385+ 'Tools/scripts/2to3-2.7',
372+ 'Tools/scripts/smtpd2.7.py'] 386+ 'Tools/scripts/smtpd2.7.py']
373 ) 387 )
374  388
375 # --install-platlib 389 # --install-platlib