diff -ruN Python-2.7.17.orig/Lib/ctypes/macholib/dyld.py Python-2.7.17/Lib/ctypes/macholib/dyld.py --- Python-2.7.17.orig/Lib/ctypes/macholib/dyld.py 2019-10-19 13:38:44.000000000 -0500 +++ Python-2.7.17/Lib/ctypes/macholib/dyld.py 2020-04-21 04:12:43.000000000 -0500 @@ -23,6 +23,7 @@ DEFAULT_LIBRARY_FALLBACK = [ os.path.expanduser("~/lib"), + "@PREFIX@/lib", "/usr/local/lib", "/lib", "/usr/lib", diff -ruN Python-2.7.17.orig/Lib/platform.py Python-2.7.17/Lib/platform.py --- Python-2.7.17.orig/Lib/platform.py 2019-10-19 13:38:44.000000000 -0500 +++ Python-2.7.17/Lib/platform.py 2020-04-21 04:12:43.000000000 -0500 @@ -804,6 +804,15 @@ if info is not None: return info + # If that doesn't work fall back to posix.uname + import posix + major,minor,patch=string.split(posix.uname()[2],'.') + release = '%s.%s.%s' %('10',int(major)-4, minor) + if posix.uname()[4]=='Power Macintosh': + machine='PowerPC' + else: + machine='i386' + # If that also doesn't work return the default values return release,versioninfo,machine diff -ruN Python-2.7.17.orig/Lib/sysconfig.py Python-2.7.17/Lib/sysconfig.py --- Python-2.7.17.orig/Lib/sysconfig.py 2019-10-19 13:38:44.000000000 -0500 +++ Python-2.7.17/Lib/sysconfig.py 2020-04-21 04:12:43.000000000 -0500 @@ -312,12 +312,6 @@ msg = msg + " (%s)" % e.strerror raise IOError(msg) - # On AIX, there are wrong paths to the linker scripts in the Makefile - # -- these paths are relative to the Python source, but when installed - # the scripts are in another directory. - if _PYTHON_BUILD: - vars['LDSHARED'] = vars['BLDSHARED'] - # There's a chicken-and-egg situation on OS X with regards to the # _sysconfigdata module after the changes introduced by #15298: # get_config_vars() is called by get_platform() as part of the diff -ruN Python-2.7.17.orig/Lib/test/test_uuid.py Python-2.7.17/Lib/test/test_uuid.py --- Python-2.7.17.orig/Lib/test/test_uuid.py 2019-10-19 13:38:44.000000000 -0500 +++ Python-2.7.17/Lib/test/test_uuid.py 2020-04-21 04:12:43.000000000 -0500 @@ -471,7 +471,7 @@ self.assertTrue(0 < node < (1L << 48), "%s is not an RFC 4122 node ID" % hex) - @unittest.skipUnless(os.name == 'posix', 'requires Posix') + @unittest.skip('macOS 10.13+ returns 64 bit address') def test_ifconfig_getnode(self): node = uuid._ifconfig_getnode() self.check_node(node, 'ifconfig') diff -ruN Python-2.7.17.orig/Makefile.pre.in Python-2.7.17/Makefile.pre.in --- Python-2.7.17.orig/Makefile.pre.in 2019-10-19 13:38:44.000000000 -0500 +++ Python-2.7.17/Makefile.pre.in 2020-04-21 04:12:43.000000000 -0500 @@ -548,7 +548,7 @@ fi libpython$(VERSION).dylib: $(LIBRARY_OBJS) - $(CC) -dynamiclib -Wl,-single_module $(LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(VERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \ + $(CC) -dynamiclib -Wl,-single_module $(LDFLAGS) @LIBTOOL_CRUFT@ -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LDLAST) libpython$(VERSION).sl: $(LIBRARY_OBJS) @@ -998,7 +998,7 @@ # Install the interpreter with $(VERSION) affixed # This goes into $(exec_prefix) altbininstall: $(BUILDPYTHON) - @for i in $(BINDIR) $(LIBDIR); \ + @for i in $(BINDIR) $(LIBDIR) $(LIBPL); \ do \ if test ! -d $(DESTDIR)$$i; then \ echo "Creating directory $$i"; \ @@ -1011,9 +1011,9 @@ if test -n "$(DLLLIBRARY)" ; then \ $(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \ else \ - $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \ + $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBPL)/$(INSTSONAME); \ if test $(LDLIBRARY) != $(INSTSONAME); then \ - (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) $(LDLIBRARY)) \ + (cd $(DESTDIR)$(LIBPL); $(LN) -sf $(INSTSONAME) $(LDLIBRARY)) \ fi \ fi; \ else true; \ diff -ruN Python-2.7.17.orig/Misc/python-config.in Python-2.7.17/Misc/python-config.in --- Python-2.7.17.orig/Misc/python-config.in 2019-10-19 13:38:44.000000000 -0500 +++ Python-2.7.17/Misc/python-config.in 2020-04-21 04:12:43.000000000 -0500 @@ -47,12 +47,10 @@ libs = ['-lpython' + pyver] libs += getvar('LIBS').split() libs += getvar('SYSLIBS').split() - # add the prefix/lib/pythonX.Y/config dir, but only if there is no - # shared library in prefix/lib/. + # add the prefix/lib/pythonX.Y/config dir (fink keeps shared + # library there too) if opt == '--ldflags': - if not getvar('Py_ENABLE_SHARED'): - libs.insert(0, '-L' + getvar('LIBPL')) - if not getvar('PYTHONFRAMEWORK'): - libs.extend(getvar('LINKFORSHARED').split()) + libs.insert(0, '-L' + getvar('LIBPL')) + libs.extend(getvar('LINKFORSHARED').split()) print ' '.join(libs) diff -ruN Python-2.7.17.orig/Misc/python.pc.in Python-2.7.17/Misc/python.pc.in --- Python-2.7.17.orig/Misc/python.pc.in 2019-10-19 13:38:44.000000000 -0500 +++ Python-2.7.17/Misc/python.pc.in 2020-04-21 04:12:43.000000000 -0500 @@ -1,6 +1,6 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ -libdir=@libdir@ +libdir=@libdir@/python@VERSION@/config includedir=@includedir@ Name: Python diff -ruN Python-2.7.17.orig/Modules/dbmmodule.c Python-2.7.17/Modules/dbmmodule.c --- Python-2.7.17.orig/Modules/dbmmodule.c 2019-10-19 13:38:44.000000000 -0500 +++ Python-2.7.17/Modules/dbmmodule.c 2020-04-21 04:12:43.000000000 -0500 @@ -19,7 +19,7 @@ static char *which_dbm = "GNU gdbm"; /* EMX port of GDBM */ #endif #elif defined(HAVE_GDBM_NDBM_H) -#include +#include static char *which_dbm = "GNU gdbm"; #elif defined(HAVE_GDBM_DASH_NDBM_H) #include diff -ruN Python-2.7.17.orig/configure Python-2.7.17/configure --- Python-2.7.17.orig/configure 2019-10-19 13:38:44.000000000 -0500 +++ Python-2.7.17/configure 2020-04-21 04:12:43.000000000 -0500 @@ -5516,7 +5516,7 @@ ;; Darwin*) LDLIBRARY='libpython$(VERSION).dylib' - BLDLIBRARY='-L. -lpython$(VERSION)' + BLDLIBRARY="`pwd`/$LDLIBRARY" RUNSHARED=DYLD_LIBRARY_PATH=`pwd`${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}} ;; AIX*) @@ -8421,7 +8421,7 @@ LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; Darwin/*) gcc_version=`gcc -dumpversion` - if test ${gcc_version} '<' 4.0 + if test `echo ${gcc_version} | cut -f1 -d.` -lt 4 then LIBTOOL_CRUFT="-lcc_dynamic" else @@ -8481,8 +8481,8 @@ fi - LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}" - LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' + LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs" + LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(BINLIBDEST)/config/$(INSTSONAME)' LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; esac @@ -8655,9 +8655,9 @@ fi else # building for OS X 10.3 and later - LDSHARED='$(CC) -bundle -undefined dynamic_lookup' - LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup' - BLDSHARED="$LDSHARED" + LDSHARED='$(CC) $(LDFLAGS) -bundle -L$(BINLIBDEST)/config -lpython$(VERSION)' + LDCXXSHARED='$(CXX) $(LDFLAGS) -bundle -L$(BINLIBDEST)/config -lpython$(VERSION)' + BLDSHARED='$(CC) $(LDFLAGS) -bundle $(BLDLIBRARY)' fi ;; Linux*|GNU*|QNX*) @@ -9048,7 +9048,7 @@ if test "x$ac_cv_lib_intl_textdomain" = xyes; then : $as_echo "#define WITH_LIBINTL 1" >>confdefs.h - +LIBS="-lintl $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing bind_textdomain_codeset" >&5 @@ -14609,7 +14609,7 @@ # first curses configure check ac_save_cppflags="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw" +CPPFLAGS="$CPPFLAGS -I@PREFIX@/include/ncursesw" for ac_header in curses.h ncurses.h do : @@ -15214,7 +15214,7 @@ if test $ac_sys_system = Darwin then - LIBS="$LIBS -framework CoreFoundation" + LIBS="$LIBS -Wl,-framework,CoreFoundation" fi diff -ruN Python-2.7.17.orig/setup.py Python-2.7.17/setup.py --- Python-2.7.17.orig/setup.py 2019-10-19 13:38:44.000000000 -0500 +++ Python-2.7.17/setup.py 2020-04-21 04:12:43.000000000 -0500 @@ -328,13 +328,17 @@ longest, g) if missing: + num_missing=len(missing) print print ("Python build finished, but the necessary bits to build " "these modules were not found:") print_three_column(missing) print ("To find the necessary bits, look in setup.py in" " detect_modules() for the module's name.") + print ("(Fink package build should have 5 missing)") print + if num_missing != 5: + sys.exit(1) if self.failed: failed = self.failed[:] @@ -342,6 +346,7 @@ print "Failed to build these modules:" print_three_column(failed) print + sys.exit(1) def build_extension(self, ext): @@ -501,9 +506,9 @@ def detect_modules(self): # Ensure that /usr/local is always used - if not cross_compiling: - add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') - add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') + # if not cross_compiling: + # add_dir_to_list(self.compiler.library_dirs, '/usr/lib') + # add_dir_to_list(self.compiler.include_dirs, '/usr/include') if cross_compiling: self.add_gcc_paths() self.add_multiarch_paths() @@ -991,53 +996,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', - '/usr/include/db3', - '/usr/local/include/db3', - '/opt/sfw/include/db3', - # Fink defaults (http://fink.sourceforge.net/) - '/sw/include/db4', - '/sw/include/db3', + '@PREFIX@/include/db4' ] - # 4.x minor number specific paths - for x in gen_db_minor_ver_nums(4): - 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) - # MacPorts default (http://www.macports.org/) - db_inc_paths.append('/opt/local/include/db4%d' % x) - # 3.x minor number specific paths - for x in gen_db_minor_ver_nums(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) - - if cross_compiling: - db_inc_paths = [] - - # 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 gen_db_minor_ver_nums(4): - std_variants.append(os.path.join(dn, "db4%d"%x)) - std_variants.append(os.path.join(dn, "db4.%d"%x)) - for x in gen_db_minor_ver_nums(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_inc_paths = [p for p in db_inc_paths if os.path.exists(p)] db_ver_inc_map = {} @@ -1163,12 +1123,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' ] if cross_compiling: sqlite_inc_paths = [] @@ -1182,7 +1137,7 @@ if host_platform == 'darwin': sysroot = macosx_sdk_root() - for d_ in inc_dirs + sqlite_inc_paths: + for d_ in sqlite_inc_paths: d = d_ if host_platform == 'darwin' and is_macosx_sdk_path(d): d = os.path.join(sysroot, d[1:]) @@ -1214,11 +1169,9 @@ sqlite_dirs_to_check = [ os.path.join(sqlite_incdir, '..', 'lib64'), os.path.join(sqlite_incdir, '..', 'lib'), - os.path.join(sqlite_incdir, '..', '..', 'lib64'), - os.path.join(sqlite_incdir, '..', '..', 'lib'), ] sqlite_libfile = self.compiler.find_library_file( - sqlite_dirs_to_check + lib_dirs, 'sqlite3') + sqlite_dirs_to_check, 'sqlite3') if sqlite_libfile: sqlite_libdir = [os.path.abspath(os.path.dirname(sqlite_libfile))] @@ -1338,7 +1291,7 @@ if self.compiler.find_library_file(lib_dirs, 'gdbm_compat'): gdbm_libs.append('gdbm_compat') - if find_file("gdbm/ndbm.h", inc_dirs, []) is not None: + if find_file("ndbm.h", inc_dirs, []) is not None: print "building dbm using gdbm" dbmext = Extension( 'dbm', ['dbmmodule.c'], @@ -1408,7 +1361,7 @@ # _curses_panel.so must link with panelw. panel_library = 'panelw' curses_libs = [curses_library] - curses_incs = find_file('curses.h', inc_dirs, + curses_incs = find_file('curses.h', ["@PREFIX/include"], [os.path.join(d, 'ncursesw') for d in inc_dirs]) exts.append( Extension('_curses', ['_cursesmodule.c'], include_dirs = curses_incs, @@ -2157,7 +2110,8 @@ sources=sources, depends=depends) ext_test = Extension('_ctypes_test', - sources=['_ctypes/_ctypes_test.c']) + sources=['_ctypes/_ctypes_test.c'], + extra_compile_args=['-O0']) self.extensions.extend([ext, ext_test]) if not '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"):