Sat Oct 1 03:11:15 2011 UTC ()
Debian (and therefore Ubuntu) have taken to hiding some libraries
awkwardly, leading to Python 2.6 failing to build.

Python 2.7 builds ok, because it has been taught to deal with this.
This patch retro-fits the 2.7 code into 2.6, and allows 2.6 to build on
Ubuntu 11.04.

Ok'd by wiz@


(dsainty)
diff -r1.37 -r1.38 pkgsrc/lang/python26/distinfo
diff -r1.15 -r1.16 pkgsrc/lang/python26/patches/patch-am

cvs diff -r1.37 -r1.38 pkgsrc/lang/python26/Attic/distinfo (expand / switch to unified diff)

--- pkgsrc/lang/python26/Attic/distinfo 2011/09/30 08:34:26 1.37
+++ pkgsrc/lang/python26/Attic/distinfo 2011/10/01 03:11:15 1.38
@@ -1,26 +1,26 @@ @@ -1,26 +1,26 @@
1$NetBSD: distinfo,v 1.37 2011/09/30 08:34:26 yyamano Exp $ 1$NetBSD: distinfo,v 1.38 2011/10/01 03:11:15 dsainty Exp $
2 2
3SHA1 (Python-2.6.7.tar.bz2) = 5d35eb746e85fb3deaff8518448137c9b9fb6daa 3SHA1 (Python-2.6.7.tar.bz2) = 5d35eb746e85fb3deaff8518448137c9b9fb6daa
4RMD160 (Python-2.6.7.tar.bz2) = 513e84a7cb76ca876e3803bb03ed558bd0378063 4RMD160 (Python-2.6.7.tar.bz2) = 513e84a7cb76ca876e3803bb03ed558bd0378063
5Size (Python-2.6.7.tar.bz2) = 11084667 bytes 5Size (Python-2.6.7.tar.bz2) = 11084667 bytes
6SHA1 (patch-Mac_Modules_fm___Fmmodule.c) = b9314bccb51b4fe672b81559068f7a79d2965f94 6SHA1 (patch-Mac_Modules_fm___Fmmodule.c) = b9314bccb51b4fe672b81559068f7a79d2965f94
7SHA1 (patch-Mac_Modules_qd___Qdmodule.c) = 45c748b15b9436d45ba137460389638aa7108c8d 7SHA1 (patch-Mac_Modules_qd___Qdmodule.c) = 45c748b15b9436d45ba137460389638aa7108c8d
8SHA1 (patch-Mac_Modules_qdoffs___Qdoffsmodule.c) = 9994f0c1a908f18f1f3df3f05b184f082c018365 8SHA1 (patch-Mac_Modules_qdoffs___Qdoffsmodule.c) = 9994f0c1a908f18f1f3df3f05b184f082c018365
9SHA1 (patch-SA43463) = a0285ce9eb1d994bb05cd54812f3fc9cb678fe7f 9SHA1 (patch-SA43463) = a0285ce9eb1d994bb05cd54812f3fc9cb678fe7f
10SHA1 (patch-aa) = 0528fc5da76d5f1d19586ea3dda1acd09a4b0113 10SHA1 (patch-aa) = 0528fc5da76d5f1d19586ea3dda1acd09a4b0113
11SHA1 (patch-ab) = b47aa9d18a7c1a99ac8cc8b29c64867443f303e5 11SHA1 (patch-ab) = b47aa9d18a7c1a99ac8cc8b29c64867443f303e5
12SHA1 (patch-ac) = 57c88d47f82630e67bcd27ab61bf4362035da2f2 12SHA1 (patch-ac) = 57c88d47f82630e67bcd27ab61bf4362035da2f2
13SHA1 (patch-ad) = a997e39d16a8f0023125362b180d19ee97ab519b 13SHA1 (patch-ad) = a997e39d16a8f0023125362b180d19ee97ab519b
14SHA1 (patch-ae) = a6d578b5f12eb42fbbcc11791576d2686a4807d9 14SHA1 (patch-ae) = a6d578b5f12eb42fbbcc11791576d2686a4807d9
15SHA1 (patch-ah) = 501d220b41e578402f3400fe88e582aa2408a147 15SHA1 (patch-ah) = 501d220b41e578402f3400fe88e582aa2408a147
16SHA1 (patch-al) = e18800d53de022e4c24055f7d03b69af2837b089 16SHA1 (patch-al) = e18800d53de022e4c24055f7d03b69af2837b089
17SHA1 (patch-am) = 60c108d05a16c531ee6cf99e5c7ad9a5f27c5f01 17SHA1 (patch-am) = aebb81db4aa38c3c1ef57ed4e25422685c362db2
18SHA1 (patch-an) = 17b4e17b3b562c29a050e9bb20447084ce82b8ab 18SHA1 (patch-an) = 17b4e17b3b562c29a050e9bb20447084ce82b8ab
19SHA1 (patch-ao) = 8c6a156b0f0c2a6d319658477fff348e6a0c3603 19SHA1 (patch-ao) = 8c6a156b0f0c2a6d319658477fff348e6a0c3603
20SHA1 (patch-ap) = d23a869a449ab9dc166cfa149913b20c9acad9cb 20SHA1 (patch-ap) = d23a869a449ab9dc166cfa149913b20c9acad9cb
21SHA1 (patch-au) = 38030fc45afc2a8f53a41f26b649e731642b9148 21SHA1 (patch-au) = 38030fc45afc2a8f53a41f26b649e731642b9148
22SHA1 (patch-av) = d6bf0419015656a8d2f13d3132873e453c8a6b6e 22SHA1 (patch-av) = d6bf0419015656a8d2f13d3132873e453c8a6b6e
23SHA1 (patch-az) = 473419352f6e1ff3c6e6268e81457e6f8a1fccb8 23SHA1 (patch-az) = 473419352f6e1ff3c6e6268e81457e6f8a1fccb8
24SHA1 (patch-ba) = 97dcf72d7380a2d257220669845c52a698165fcf 24SHA1 (patch-ba) = 97dcf72d7380a2d257220669845c52a698165fcf
25SHA1 (patch-bb) = 6cdd94dd1e69630159194c7c153b6c4e46c81456 25SHA1 (patch-bb) = 6cdd94dd1e69630159194c7c153b6c4e46c81456
26SHA1 (patch-bc) = 09aaa254a54109026bb262a949b4006235df7858 26SHA1 (patch-bc) = 09aaa254a54109026bb262a949b4006235df7858

cvs diff -r1.15 -r1.16 pkgsrc/lang/python26/patches/Attic/patch-am (expand / switch to unified diff)

--- pkgsrc/lang/python26/patches/Attic/patch-am 2010/09/16 13:24:47 1.15
+++ pkgsrc/lang/python26/patches/Attic/patch-am 2011/10/01 03:11:15 1.16
@@ -1,76 +1,104 @@ @@ -1,76 +1,104 @@
1$NetBSD: patch-am,v 1.15 2010/09/16 13:24:47 obache Exp $ 1$NetBSD: patch-am,v 1.16 2011/10/01 03:11:15 dsainty 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 1.85 compat module all the time against the BDB version of choice. 20Build the 1.85 compat module all the time against the BDB version of choice.
21 21
22--- setup.py.orig 2010-07-17 12:31:09.000000000 +0000 22Add in Debian multiarch support (retrofitted from Python 2.7.2) to
23+++ setup.py 23support building the "nis" and "crypt" modules.
24@@ -18,7 +18,7 @@ from distutils.command.install_lib impor 24
 25--- setup.py 2010-07-18 00:31:09.000000000 +1200
 26+++ setup.py 2011-09-23 01:51:17.757519638 +1200
 27@@ -18,7 +18,7 @@
25 from distutils.spawn import find_executable 28 from distutils.spawn import find_executable
26  29
27 # This global variable is used to hold the list of modules to be disabled. 30 # This global variable is used to hold the list of modules to be disabled.
28-disabled_module_list = [] 31-disabled_module_list = []
29+disabled_module_list = ["_bsddb", "_curses", "_curses_panel", "_elementtree", "_sqlite3", "_tkinter", "gdbm", "pyexpat", "readline", "linuxaudiodev", "ossaudiodev", "spwd", "sunaudiodev"] 32+disabled_module_list = ["_bsddb", "_curses", "_curses_panel", "_elementtree", "_sqlite3", "_tkinter", "gdbm", "pyexpat", "readline", "linuxaudiodev", "ossaudiodev", "spwd", "sunaudiodev"]
30  33
31 def add_dir_to_list(dirlist, dir): 34 def add_dir_to_list(dirlist, dir):
32 """Add the directory 'dir' to the list 'dirlist' (at the front) if 35 """Add the directory 'dir' to the list 'dirlist' (at the front) if
33@@ -355,9 +355,15 @@ class PyBuildExt(build_ext): 36@@ -354,10 +354,40 @@
 37 return platform
34 return sys.platform 38 return sys.platform
35  39
 40+ def add_multiarch_paths(self):
 41+ # Debian/Ubuntu multiarch support.
 42+ # https://wiki.ubuntu.com/MultiarchSpec
 43+ if not find_executable('dpkg-architecture'):
 44+ return
 45+ tmpfile = os.path.join(self.build_temp, 'multiarch')
 46+ if not os.path.exists(self.build_temp):
 47+ os.makedirs(self.build_temp)
 48+ ret = os.system(
 49+ 'dpkg-architecture -qDEB_HOST_MULTIARCH > %s 2> /dev/null' %
 50+ tmpfile)
 51+ try:
 52+ if ret >> 8 == 0:
 53+ with open(tmpfile) as fp:
 54+ multiarch_path_component = fp.readline().strip()
 55+ add_dir_to_list(self.compiler.library_dirs,
 56+ '/usr/lib/' + multiarch_path_component)
 57+ add_dir_to_list(self.compiler.include_dirs,
 58+ '/usr/include/' + multiarch_path_component)
 59+ finally:
 60+ os.unlink(tmpfile)
 61+
36 def detect_modules(self): 62 def detect_modules(self):
37- # Ensure that /usr/local is always used 63- # Ensure that /usr/local is always used
38- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') 64- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
39- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') 65- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
40+ # Add the buildlink directories for pkgsrc 66+ # Add the buildlink directories for pkgsrc
41+ if os.environ.has_key('BUILDLINK_DIR'): 67+ if os.environ.has_key('BUILDLINK_DIR'):
42+ dir = os.environ['BUILDLINK_DIR'] 68+ dir = os.environ['BUILDLINK_DIR']
43+ libdir = dir + '/lib' 69+ libdir = dir + '/lib'
44+ incdir = dir + '/include' 70+ incdir = dir + '/include'
45+ if libdir not in self.compiler.library_dirs: 71+ if libdir not in self.compiler.library_dirs:
46+ self.compiler.library_dirs.insert(0, libdir) 72+ self.compiler.library_dirs.insert(0, libdir)
47+ if incdir not in self.compiler.include_dirs: 73+ if incdir not in self.compiler.include_dirs:
48+ self.compiler.include_dirs.insert(0, incdir) 74+ self.compiler.include_dirs.insert(0, incdir)
 75+
 76+ self.add_multiarch_paths()
49  77
50 # Add paths specified in the environment variables LDFLAGS and 78 # Add paths specified in the environment variables LDFLAGS and
51 # CPPFLAGS for header and library files. 79 # CPPFLAGS for header and library files.
52@@ -703,9 +709,7 @@ class PyBuildExt(build_ext): 80@@ -703,9 +733,7 @@
53 if krb5_h: 81 if krb5_h:
54 ssl_incs += krb5_h 82 ssl_incs += krb5_h
55 ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, 83 ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
56- ['/usr/local/ssl/lib', 84- ['/usr/local/ssl/lib',
57- '/usr/contrib/ssl/lib/' 85- '/usr/contrib/ssl/lib/'
58- ] ) 86- ] )
59+ [] ) 87+ [] )
60  88
61 if (ssl_incs is not None and 89 if (ssl_incs is not None and
62 ssl_libs is not None): 90 ssl_libs is not None):
63@@ -815,172 +819,6 @@ class PyBuildExt(build_ext): 91@@ -815,172 +843,6 @@
64 else: 92 else:
65 raise ValueError("unknown major BerkeleyDB version", major) 93 raise ValueError("unknown major BerkeleyDB version", major)
66  94
67- # construct a list of paths to look for the header file in on 95- # construct a list of paths to look for the header file in on
68- # top of the normal inc_dirs. 96- # top of the normal inc_dirs.
69- db_inc_paths = [ 97- db_inc_paths = [
70- '/usr/include/db4', 98- '/usr/include/db4',
71- '/usr/local/include/db4', 99- '/usr/local/include/db4',
72- '/opt/sfw/include/db4', 100- '/opt/sfw/include/db4',
73- '/usr/include/db3', 101- '/usr/include/db3',
74- '/usr/local/include/db3', 102- '/usr/local/include/db3',
75- '/opt/sfw/include/db3', 103- '/opt/sfw/include/db3',
76- # Fink defaults (http://fink.sourceforge.net/) 104- # Fink defaults (http://fink.sourceforge.net/)
@@ -223,27 +251,27 @@ Build the 1.85 compat module all the tim @@ -223,27 +251,27 @@ Build the 1.85 compat module all the tim
223- runtime_library_dirs=dblib_dir, 251- runtime_library_dirs=dblib_dir,
224- include_dirs=db_incs, 252- include_dirs=db_incs,
225- libraries=dblibs)) 253- libraries=dblibs))
226- else: 254- else:
227- if db_setup_debug: print "db: no appropriate library found" 255- if db_setup_debug: print "db: no appropriate library found"
228- db_incs = None 256- db_incs = None
229- dblibs = [] 257- dblibs = []
230- dblib_dir = None 258- dblib_dir = None
231- missing.append('_bsddb') 259- missing.append('_bsddb')
232- 260-
233 # The sqlite interface 261 # The sqlite interface
234 sqlite_setup_debug = False # verbose debug prints from this script? 262 sqlite_setup_debug = False # verbose debug prints from this script?
235  263
236@@ -1094,31 +932,12 @@ class PyBuildExt(build_ext): 264@@ -1094,31 +956,12 @@
237 # we do not build this one. Otherwise this build will pick up 265 # we do not build this one. Otherwise this build will pick up
238 # the more recent berkeleydb's db.h file first in the include path 266 # the more recent berkeleydb's db.h file first in the include path
239 # when attempting to compile and it will fail. 267 # when attempting to compile and it will fail.
240- f = "/usr/include/db.h" 268- f = "/usr/include/db.h"
241- 269-
242- if sys.platform == 'darwin': 270- if sys.platform == 'darwin':
243- if is_macosx_sdk_path(f): 271- if is_macosx_sdk_path(f):
244- sysroot = macosx_sdk_root() 272- sysroot = macosx_sdk_root()
245- f = os.path.join(sysroot, f[1:]) 273- f = os.path.join(sysroot, f[1:])
246- 274-
247- if os.path.exists(f) and not db_incs: 275- if os.path.exists(f) and not db_incs:
248- data = open(f).read() 276- data = open(f).read()
249- m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data) 277- m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)
@@ -260,67 +288,67 @@ Build the 1.85 compat module all the tim @@ -260,67 +288,67 @@ Build the 1.85 compat module all the tim
260- exts.append(Extension('bsddb185', ['bsddbmodule.c'])) 288- exts.append(Extension('bsddb185', ['bsddbmodule.c']))
261- else: 289- else:
262- missing.append('bsddb185') 290- missing.append('bsddb185')
263+ libraries = os.getenv("PY_BDB_TYPE", "") 291+ libraries = os.getenv("PY_BDB_TYPE", "")
264+ if libraries: 292+ if libraries:
265+ exts.append(Extension('bsddb185', ['bsddbmodule.c'], 293+ exts.append(Extension('bsddb185', ['bsddbmodule.c'],
266+ libraries=["db"])) 294+ libraries=["db"]))
267 else: 295 else:
268- missing.append('bsddb185') 296- missing.append('bsddb185')
269+ exts.append(Extension('bsddb185', ['bsddbmodule.c'])) 297+ exts.append(Extension('bsddb185', ['bsddbmodule.c']))
270  298
271 # The standard Unix dbm module: 299 # The standard Unix dbm module:
272 if platform not in ['cygwin']: 300 if platform not in ['cygwin']:
273@@ -1131,7 +950,7 @@ class PyBuildExt(build_ext): 301@@ -1131,7 +974,7 @@
274 exts.append( Extension('dbm', ['dbmmodule.c'], 302 exts.append( Extension('dbm', ['dbmmodule.c'],
275 define_macros=[('HAVE_NDBM_H',None)], 303 define_macros=[('HAVE_NDBM_H',None)],
276 libraries = ndbm_libs ) ) 304 libraries = ndbm_libs ) )
277- elif self.compiler.find_library_file(lib_dirs, 'gdbm'): 305- elif self.compiler.find_library_file(lib_dirs, 'gdbm'):
278+ elif 1==0 and self.compiler.find_library_file(lib_dirs, 'gdbm'): 306+ elif 1==0 and self.compiler.find_library_file(lib_dirs, 'gdbm'):
279 gdbm_libs = ['gdbm'] 307 gdbm_libs = ['gdbm']
280 if self.compiler.find_library_file(lib_dirs, 'gdbm_compat'): 308 if self.compiler.find_library_file(lib_dirs, 'gdbm_compat'):
281 gdbm_libs.append('gdbm_compat') 309 gdbm_libs.append('gdbm_compat')
282@@ -1147,14 +966,11 @@ class PyBuildExt(build_ext): 310@@ -1147,14 +990,11 @@
283 libraries = gdbm_libs ) ) 311 libraries = gdbm_libs ) )
284 else: 312 else:
285 missing.append('dbm') 313 missing.append('dbm')
286- elif db_incs is not None: 314- elif db_incs is not None:
287+ elif 1==1: 315+ elif 1==1:
288 exts.append( Extension('dbm', ['dbmmodule.c'], 316 exts.append( Extension('dbm', ['dbmmodule.c'],
289- library_dirs=dblib_dir, 317- library_dirs=dblib_dir,
290- runtime_library_dirs=dblib_dir, 318- runtime_library_dirs=dblib_dir,
291- include_dirs=db_incs, 319- include_dirs=db_incs,
292 define_macros=[('HAVE_BERKDB_H',None), 320 define_macros=[('HAVE_BERKDB_H',None),
293 ('DB_DBM_HSEARCH',None)], 321 ('DB_DBM_HSEARCH',None)],
294- libraries=dblibs)) 322- libraries=dblibs))
295+ libraries=["db"])) 323+ libraries=["db"]))
296 else: 324 else:
297 missing.append('dbm') 325 missing.append('dbm')
298  326
299@@ -1408,6 +1224,14 @@ class PyBuildExt(build_ext): 327@@ -1408,6 +1248,14 @@
300 ) 328 )
301 libraries = [] 329 libraries = []
302  330
303+ elif platform.startswith('dragonfly'): 331+ elif platform.startswith('dragonfly'):
304+ macros = dict( 332+ macros = dict(
305+ HAVE_SEM_OPEN=0, 333+ HAVE_SEM_OPEN=0,
306+ HAVE_SEM_TIMEDWAIT=0, 334+ HAVE_SEM_TIMEDWAIT=0,
307+ HAVE_FD_TRANSFER=1, 335+ HAVE_FD_TRANSFER=1,
308+ ) 336+ )
309+ libraries = [] 337+ libraries = []
310+ 338+
311 else: # Linux and other unices 339 else: # Linux and other unices
312 macros = dict( 340 macros = dict(
313 HAVE_SEM_OPEN=1, 341 HAVE_SEM_OPEN=1,
314@@ -2026,9 +1850,9 @@ def main(): 342@@ -2026,9 +1874,9 @@
315 ext_modules=[Extension('_struct', ['_struct.c'])], 343 ext_modules=[Extension('_struct', ['_struct.c'])],
316  344
317 # Scripts to install 345 # Scripts to install
318- scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle', 346- scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle',
319- 'Tools/scripts/2to3', 347- 'Tools/scripts/2to3',
320- 'Lib/smtpd.py'] 348- 'Lib/smtpd.py']
321+ scripts = ['Tools/scripts/pydoc2.6', 349+ scripts = ['Tools/scripts/pydoc2.6',
322+ 'Tools/scripts/2to3-2.6', 350+ 'Tools/scripts/2to3-2.6',
323+ 'Lib/smtpd2.6.py'] 351+ 'Lib/smtpd2.6.py']
324 ) 352 )
325  353
326 # --install-platlib 354 # --install-platlib