| @@ -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 | |
3 | Disabled modules for normal build: | | 3 | Disabled modules for normal build: |
4 | bsddb | | 4 | bsddb |
5 | curses | | 5 | curses |
6 | curses_panel | | 6 | curses_panel |
7 | elementtree | | 7 | elementtree |
8 | sqlite3 | | 8 | sqlite3 |
9 | tkinter | | 9 | tkinter |
10 | gdbm | | 10 | gdbm |
11 | pyexpat | | 11 | pyexpat |
12 | readline | | 12 | readline |
13 | {linux,oss,sun}audiodev | | 13 | {linux,oss,sun}audiodev |
14 | spwd | | 14 | spwd |
15 | Those have separate packages where needed. | | 15 | Those have separate packages where needed. |
16 | | | 16 | |
17 | Only check the BUILDLINK_DIR for libraries etc, do not pick up random | | 17 | Only check the BUILDLINK_DIR for libraries etc, do not pick up random |
18 | headers and libraries from the system. | | 18 | headers and libraries from the system. |
19 | | | 19 | |
20 | Build the 1.85 compat module all the time against the BDB version of choice. | | 20 | Build 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 | | 22 | Add in Debian multiarch support (retrofitted from Python 2.7.2) to |
23 | +++ setup.py | | 23 | support 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 |