diff -Nurd -x'*~' Python-2.5.6.orig/Lib/locale.py Python-2.5.6/Lib/locale.py --- Python-2.5.6.orig/Lib/locale.py 2007-05-01 02:08:20.000000000 -0400 +++ Python-2.5.6/Lib/locale.py 2011-06-16 02:36:13.000000000 -0400 @@ -487,7 +487,7 @@ """ _setlocale(category, _build_localename(getdefaultlocale())) -if sys.platform in ('win32', 'darwin', 'mac'): +if sys.platform in ('win32', 'mac'): # On Win32, this will return the ANSI code page # On the Mac, it should return the system encoding; # it might return "ascii" instead diff -Nurd -x'*~' Python-2.5.6.orig/Lib/pydoc.py Python-2.5.6/Lib/pydoc.py --- Python-2.5.6.orig/Lib/pydoc.py 2008-12-10 21:09:36.000000000 -0500 +++ Python-2.5.6/Lib/pydoc.py 2011-06-16 02:36:13.000000000 -0400 @@ -1621,19 +1621,7 @@ def __init__(self, input, output): self.input = input self.output = output - self.docdir = None - execdir = os.path.dirname(sys.executable) - homedir = os.environ.get('PYTHONHOME') - for dir in [os.environ.get('PYTHONDOCS'), - homedir and os.path.join(homedir, 'doc'), - os.path.join(execdir, 'doc'), - '/usr/doc/python-docs-' + split(sys.version)[0], - '/usr/doc/python-' + split(sys.version)[0], - '/usr/doc/python-docs-' + sys.version[:3], - '/usr/doc/python-' + sys.version[:3], - os.path.join(sys.prefix, 'Resources/English.lproj/Documentation')]: - if dir and os.path.isdir(os.path.join(dir, 'lib')): - self.docdir = dir + self.docdir = os.path.join(sys.prefix, 'share','doc','python'+sys.version[0]+sys.version[2],'html') def __repr__(self): if inspect.stack()[1][3] == '?': diff -Nurd -x'*~' Python-2.5.6.orig/Modules/_bsddb.c Python-2.5.6/Modules/_bsddb.c --- Python-2.5.6.orig/Modules/_bsddb.c 2008-05-17 02:46:39.000000000 -0400 +++ Python-2.5.6/Modules/_bsddb.c 2011-06-16 02:55:56.000000000 -0400 @@ -87,6 +87,7 @@ #include /* for offsetof() */ #include +#undef _POSIX_C_SOURCE #include /* --------------------------------------------------------------------- */ diff -Nurd -x'*~' Python-2.5.6.orig/Modules/_ctypes/libffi/src/darwin/ffitarget.h Python-2.5.6/Modules/_ctypes/libffi/src/darwin/ffitarget.h --- Python-2.5.6.orig/Modules/_ctypes/libffi/src/darwin/ffitarget.h 2006-05-25 17:58:05.000000000 -0400 +++ Python-2.5.6/Modules/_ctypes/libffi/src/darwin/ffitarget.h 2011-06-16 03:43:08.000000000 -0400 @@ -4,7 +4,7 @@ * created by configure). This makes is possible to build a univeral binary * of ctypes in one go. */ -#if defined(__i386__) +#if defined(__i386__) || defined(__x86_64__) #ifndef X86_DARWIN #define X86_DARWIN @@ -13,7 +13,7 @@ #include "../src/x86/ffitarget.h" -#elif defined(__ppc__) +#elif defined(__ppc__) || defined(__ppc64__) #ifndef POWERPC_DARWIN #define POWERPC_DARWIN diff -Nurd -x'*~' Python-2.5.6.orig/Modules/_ctypes/malloc_closure.c Python-2.5.6/Modules/_ctypes/malloc_closure.c --- Python-2.5.6.orig/Modules/_ctypes/malloc_closure.c 2006-06-12 16:56:48.000000000 -0400 +++ Python-2.5.6/Modules/_ctypes/malloc_closure.c 2011-06-16 02:36:29.000000000 -0400 @@ -7,6 +7,7 @@ #ifdef MS_WIN32 #include #else +#define _DARWIN_C_SOURCE #include #include # if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) diff -Nurd -x'*~' Python-2.5.6.orig/Modules/_localemodule.c Python-2.5.6/Modules/_localemodule.c --- Python-2.5.6.orig/Modules/_localemodule.c 2007-04-03 00:39:34.000000000 -0400 +++ Python-2.5.6/Modules/_localemodule.c 2011-06-16 02:36:13.000000000 -0400 @@ -32,7 +32,7 @@ #include #endif -#if defined(__APPLE__) +#if 0 #include #endif @@ -410,7 +410,7 @@ } #endif -#if defined(__APPLE__) +#if 0 /* ** Find out what the current script is. ** Donated by Fredrik Lundh. @@ -683,7 +683,7 @@ METH_VARARGS, strcoll__doc__}, {"strxfrm", (PyCFunction) PyLocale_strxfrm, METH_VARARGS, strxfrm__doc__}, -#if defined(MS_WINDOWS) || defined(__APPLE__) +#if defined(MS_WINDOWS) || 0 {"_getdefaultlocale", (PyCFunction) PyLocale_getdefaultlocale, METH_NOARGS}, #endif #ifdef HAVE_LANGINFO_H diff -Nurd -x'*~' Python-2.5.6.orig/Modules/mmapmodule.c Python-2.5.6/Modules/mmapmodule.c --- Python-2.5.6.orig/Modules/mmapmodule.c 2008-07-31 13:08:14.000000000 -0400 +++ Python-2.5.6/Modules/mmapmodule.c 2011-06-16 02:36:13.000000000 -0400 @@ -55,6 +55,11 @@ #include #endif /* HAVE_SYS_TYPES_H */ +/* Force inclusion of fcntl.h, seems to be broken on MacOS 10.6. */ +#ifndef _SYS_FCNTL_H_ +#include +#endif /* _SYS_FCNTL_H_ */ + /* Prefer MAP_ANONYMOUS since MAP_ANON is deprecated according to man page. */ #if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) # define MAP_ANONYMOUS MAP_ANON diff -Nurd -x'*~' Python-2.5.6.orig/Modules/nismodule.c Python-2.5.6/Modules/nismodule.c --- Python-2.5.6.orig/Modules/nismodule.c 2006-02-27 11:46:16.000000000 -0500 +++ Python-2.5.6/Modules/nismodule.c 2011-06-16 02:56:48.000000000 -0400 @@ -12,6 +12,7 @@ #include "Python.h" +#undef _POSIX_C_SOURCE #include #include #include diff -Nurd -x'*~' Python-2.5.6.orig/Modules/posixmodule.c Python-2.5.6/Modules/posixmodule.c --- Python-2.5.6.orig/Modules/posixmodule.c 2008-12-13 10:14:30.000000000 -0500 +++ Python-2.5.6/Modules/posixmodule.c 2011-06-16 02:36:13.000000000 -0400 @@ -339,7 +339,7 @@ #endif /* Return a dictionary corresponding to the POSIX environment table */ -#ifdef WITH_NEXT_FRAMEWORK +#ifdef __APPLE__ /* On Darwin/MacOSX a shared library or framework has no access to ** environ directly, we must obtain it with _NSGetEnviron(). */ @@ -357,7 +357,7 @@ d = PyDict_New(); if (d == NULL) return NULL; -#ifdef WITH_NEXT_FRAMEWORK +#ifdef __APPLE__ if (environ == NULL) environ = *_NSGetEnviron(); #endif diff -Nurd -x'*~' Python-2.5.6.orig/configure Python-2.5.6/configure --- Python-2.5.6.orig/configure 2008-12-13 09:13:52.000000000 -0500 +++ Python-2.5.6/configure 2011-06-16 02:36:14.000000000 -0400 @@ -4534,7 +4534,7 @@ ;; # is there any other compiler on Darwin besides gcc? Darwin*) - BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd" + BASECFLAGS="$BASECFLAGS -Wno-long-double -mno-fused-madd -fno-common" if test "${enable_universalsdk}"; then BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}" fi @@ -11491,7 +11491,7 @@ LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' else # No framework. Ignore undefined symbols, assuming they come from Python - LDSHARED="$LDSHARED -undefined suppress" + LDSHARED="$LDSHARED -flat_namespace -undefined suppress" fi ;; Darwin/1.4*|Darwin/5.*|Darwin/6.*) LDSHARED='$(CC) $(LDFLAGS) -bundle' @@ -11501,8 +11501,8 @@ LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' else # No framework, use the Python app as bundle-loader - BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)' - LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' + BLDSHARED="$LDSHARED -flat_namespace -undefined suppress" + LDSHARED="$LDSHARED -flat_namespace -undefined suppress" fi ;; Darwin/*) # Use -undefined dynamic_lookup whenever possible (10.3 and later). @@ -11536,8 +11536,8 @@ LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' else # No framework, use the Python app as bundle-loader - BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)' - LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' + BLDSHARED="$LDSHARED -flat_namespace -undefined suppress" + LDSHARED="$LDSHARED -flat_namespace -undefined suppress" fi fi ;; diff -Nurd -x'*~' Python-2.5.6.orig/setup.py Python-2.5.6/setup.py --- Python-2.5.6.orig/setup.py 2008-10-16 14:58:19.000000000 -0400 +++ Python-2.5.6/setup.py 2011-06-16 02:36:14.000000000 -0400 @@ -244,8 +244,8 @@ def detect_modules(self): # Ensure that /usr/local is always used - add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') - add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') + add_dir_to_list(self.compiler.library_dirs, '@PREFIX@/lib') + add_dir_to_list(self.compiler.include_dirs, '@PREFIX@/include') # Add paths specified in the environment variables LDFLAGS and # CPPFLAGS for header and library files. @@ -295,11 +295,11 @@ # lib_dirs and inc_dirs are used to search for files; # if a file is found in one of those directories, it can # be assumed that no additional -I,-L directives are needed. - lib_dirs = self.compiler.library_dirs + [ + lib_dirs = self.compiler.library_dirs + ['@PREFIX@/lib', '/lib64', '/usr/lib64', '/lib', '/usr/lib', ] - inc_dirs = self.compiler.include_dirs + ['/usr/include'] + inc_dirs = self.compiler.include_dirs + ['@PREFIX@/include','/usr/include'] exts = [] config_h = sysconfig.get_config_h_filename() @@ -522,10 +522,9 @@ depends = ['socketmodule.h']) ) # Detect SSL support for the socket module (via _ssl) search_for_ssl_incs_in = [ - '/usr/local/ssl/include', - '/usr/contrib/ssl/include/' + '@PREFIX@/lib/system-openssl/include' ] - ssl_incs = find_file('openssl/ssl.h', inc_dirs, + ssl_incs = find_file('openssl/ssl.h', [], search_for_ssl_incs_in ) if ssl_incs is not None: @@ -533,9 +532,8 @@ ['/usr/kerberos/include']) if krb5_h: ssl_incs += krb5_h - ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, - ['/usr/local/ssl/lib', - '/usr/contrib/ssl/lib/' + ssl_libs = find_library_file(self.compiler, 'ssl', [], + ['@PREFIX@/lib/system-openssl/lib' ] ) if (ssl_incs is not None and @@ -550,7 +548,7 @@ openssl_ver = 0 openssl_ver_re = re.compile( '^\s*#\s*define\s+OPENSSL_VERSION_NUMBER\s+(0x[0-9a-fA-F]+)' ) - for ssl_inc_dir in inc_dirs + search_for_ssl_incs_in: + for ssl_inc_dir in search_for_ssl_incs_in: name = os.path.join(ssl_inc_dir, 'openssl', 'opensslv.h') if os.path.isfile(name): try: @@ -619,47 +617,8 @@ # construct a list of paths to look for the header file in on # top of the normal inc_dirs. db_inc_paths = [ - '/usr/include/db4', - '/usr/local/include/db4', - '/opt/sfw/include/db4', - '/sw/include/db4', - '/usr/include/db3', - '/usr/local/include/db3', - '/opt/sfw/include/db3', - '/sw/include/db3', + '@PREFIX@/include/db4' ] - # 4.x minor number specific paths - for x in range(max_db_ver[1]+1): - db_inc_paths.append('/usr/include/db4%d' % x) - db_inc_paths.append('/usr/include/db4.%d' % x) - db_inc_paths.append('/usr/local/BerkeleyDB.4.%d/include' % x) - db_inc_paths.append('/usr/local/include/db4%d' % x) - db_inc_paths.append('/pkg/db-4.%d/include' % x) - db_inc_paths.append('/opt/db-4.%d/include' % x) - # 3.x minor number specific paths - for x in (3,): - db_inc_paths.append('/usr/include/db3%d' % x) - db_inc_paths.append('/usr/local/BerkeleyDB.3.%d/include' % x) - db_inc_paths.append('/usr/local/include/db3%d' % x) - db_inc_paths.append('/pkg/db-3.%d/include' % x) - db_inc_paths.append('/opt/db-3.%d/include' % x) - - # Add some common subdirectories for Sleepycat DB to the list, - # based on the standard include directories. This way DB3/4 gets - # picked up when it is installed in a non-standard prefix and - # the user has added that prefix into inc_dirs. - std_variants = [] - for dn in inc_dirs: - std_variants.append(os.path.join(dn, 'db3')) - std_variants.append(os.path.join(dn, 'db4')) - for x in range(max_db_ver[1]+1): - std_variants.append(os.path.join(dn, "db4%d"%x)) - std_variants.append(os.path.join(dn, "db4.%d"%x)) - for x in (2,3): - std_variants.append(os.path.join(dn, "db3%d"%x)) - std_variants.append(os.path.join(dn, "db3.%d"%x)) - - db_inc_paths = std_variants + db_inc_paths db_ver_inc_map = {} @@ -761,12 +720,7 @@ # We hunt for #define SQLITE_VERSION "n.n.n" # We need to find >= sqlite version 3.0.8 sqlite_incdir = sqlite_libdir = None - sqlite_inc_paths = [ '/usr/include', - '/usr/include/sqlite', - '/usr/include/sqlite3', - '/usr/local/include', - '/usr/local/include/sqlite', - '/usr/local/include/sqlite3', + sqlite_inc_paths = [ '@PREFIX@/include' ] MIN_SQLITE_VERSION_NUMBER = (3, 0, 8) MIN_SQLITE_VERSION = ".".join([str(x) @@ -1216,15 +1170,12 @@ # AquaTk is a separate method. Only one Tkinter will be built on # Darwin - either AquaTk, if it is found, or X11 based Tk. platform = self.get_platform() - if (platform == 'darwin' and - self.detect_tkinter_darwin(inc_dirs, lib_dirs)): - return # Assume we haven't found any of the libraries or include files # The versions with dots are used on Unix, and the versions without # dots on Windows, for detection by cygwin. tcllib = tklib = tcl_includes = tk_includes = None - for version in ['8.5', '85', '8.4', '84', '8.3', '83', '8.2', + for version in ['8.4', '84', '8.3', '83', '8.2', '82', '8.1', '81', '8.0', '80']: tklib = self.compiler.find_library_file(lib_dirs, 'tk' + version) tcllib = self.compiler.find_library_file(lib_dirs, 'tcl' + version)