Ticket #44994: 0003-python32-Apply-upstream-Yosemite-fixes.patch
File 0003-python32-Apply-upstream-Yosemite-fixes.patch, 12.8 KB (added by larryv (Lawrence Velázquez), 10 years ago) |
---|
-
dports/lang/python32/Portfile
From 73ad7b12cac2c9e6cd65f2045f5c3952ed6b19a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lawrence=20Vel=C3=A1zquez?= <larryv@macports.org> Date: Sat, 13 Sep 2014 16:50:08 -0400 Subject: [PATCH 3/5] python32: Apply upstream Yosemite fixes Patches adapted from http://bugs.python.org/issue21811. --- dports/lang/python32/Portfile | 5 + .../python32/files/yosemite-configure-fixes.patch | 122 ++++++++++++++++ .../python32/files/yosemite-python-fixes.patch | 154 +++++++++++++++++++++ 3 files changed, 281 insertions(+) create mode 100644 dports/lang/python32/files/yosemite-configure-fixes.patch create mode 100644 dports/lang/python32/files/yosemite-python-fixes.patch diff --git a/dports/lang/python32/Portfile b/dports/lang/python32/Portfile index f8795bc..a31395d 100644
a b name python32 8 8 epoch 20120412 9 9 # Remember to keep py32-tkinter and py32-gdbm's versions sync'd with this 10 10 version 3.2.5 11 revision 1 11 12 12 13 set major [lindex [split $version .] 0] 13 14 set branch [join [lrange [split ${version} .] 0 1] .] … … patchfiles patch-setup.py.diff \ 37 38 patch-setup.py-disabled_modules.diff \ 38 39 patch-libedit.diff 39 40 41 # http://bugs.python.org/issue21811 42 patchfiles-append yosemite-configure-fixes.patch \ 43 yosemite-python-fixes.patch 44 40 45 depends_lib port:zlib port:openssl \ 41 46 port:sqlite3 port:ncurses \ 42 47 port:bzip2 port:libedit port:gettext -
new file dports/lang/python32/files/yosemite-configure-fixes.patch
diff --git a/dports/lang/python32/files/yosemite-configure-fixes.patch b/dports/lang/python32/files/yosemite-configure-fixes.patch new file mode 100644 index 0000000..88f7f71
- + 1 Index: configure 2 =================================================================== 3 --- configure.orig 4 +++ configure 5 @@ -5789,8 +5789,16 @@ $as_echo "$CC" >&6; } 6 7 # Calculate the right deployment target for this build. 8 # 9 - cur_target=`sw_vers -productVersion | sed 's/\(10\.[0-9]*\).*/\1/'` 10 - if test ${cur_target} '>' 10.2; then 11 + cur_target_major=`sw_vers -productVersion | \ 12 + sed 's/\([0-9]*\)\.\([0-9]*\).*/\1/'` 13 + cur_target_minor=`sw_vers -productVersion | \ 14 + sed 's/\([0-9]*\)\.\([0-9]*\).*/\2/'` 15 + cur_target="${cur_target_major}.${cur_target_minor}" 16 + if test ${cur_target_major} -eq 10 && \ 17 + test ${cur_target_minor} -ge 3 && \ 18 + test ${cur_target_minor} -le 5 19 + then 20 + # OS X 10.3 through 10.5 21 cur_target=10.3 22 if test ${enable_universalsdk}; then 23 if test "${UNIVERSAL_ARCHS}" = "all"; then 24 @@ -7783,15 +7791,14 @@ then 25 # Use -undefined dynamic_lookup whenever possible (10.3 and later). 26 # This allows an extension to be used in any Python 27 28 - if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2 29 + dep_target_major=`echo ${MACOSX_DEPLOYMENT_TARGET} | \ 30 + sed 's/\([0-9]*\)\.\([0-9]*\).*/\1/'` 31 + dep_target_minor=`echo ${MACOSX_DEPLOYMENT_TARGET} | \ 32 + sed 's/\([0-9]*\)\.\([0-9]*\).*/\2/'` 33 + if test ${dep_target_major} -eq 10 && \ 34 + test ${dep_target_minor} -le 2 35 then 36 - if test "${enable_universalsdk}"; then 37 - LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}" 38 - fi 39 - LDSHARED='$(CC) -bundle -undefined dynamic_lookup' 40 - LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup' 41 - BLDSHARED="$LDSHARED" 42 - else 43 + # building for OS X 10.0 through 10.2 44 LDSHARED='$(CC) -bundle' 45 LDCXXSHARED='$(CXX) -bundle' 46 if test "$enable_framework" ; then 47 @@ -7805,6 +7812,14 @@ then 48 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' 49 LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' 50 fi 51 + else 52 + # building for OS X 10.3 and later 53 + if test "${enable_universalsdk}"; then 54 + LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}" 55 + fi 56 + LDSHARED='$(CC) -bundle -undefined dynamic_lookup' 57 + LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup' 58 + BLDSHARED="$LDSHARED" 59 fi 60 ;; 61 Linux*|GNU*|QNX*) 62 Index: configure.ac 63 =================================================================== 64 --- configure.ac.orig 65 +++ configure.ac 66 @@ -1099,8 +1099,16 @@ yes) 67 68 # Calculate the right deployment target for this build. 69 # 70 - cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'` 71 - if test ${cur_target} '>' 10.2; then 72 + cur_target_major=`sw_vers -productVersion | \ 73 + sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` 74 + cur_target_minor=`sw_vers -productVersion | \ 75 + sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` 76 + cur_target="${cur_target_major}.${cur_target_minor}" 77 + if test ${cur_target_major} -eq 10 && \ 78 + test ${cur_target_minor} -ge 3 && \ 79 + test ${cur_target_minor} -le 5 80 + then 81 + # OS X 10.3 through 10.5 82 cur_target=10.3 83 if test ${enable_universalsdk}; then 84 if test "${UNIVERSAL_ARCHS}" = "all"; then 85 @@ -1806,15 +1814,14 @@ then 86 # Use -undefined dynamic_lookup whenever possible (10.3 and later). 87 # This allows an extension to be used in any Python 88 89 - if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2 90 + dep_target_major=`echo ${MACOSX_DEPLOYMENT_TARGET} | \ 91 + sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` 92 + dep_target_minor=`echo ${MACOSX_DEPLOYMENT_TARGET} | \ 93 + sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` 94 + if test ${dep_target_major} -eq 10 && \ 95 + test ${dep_target_minor} -le 2 96 then 97 - if test "${enable_universalsdk}"; then 98 - LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}" 99 - fi 100 - LDSHARED='$(CC) -bundle -undefined dynamic_lookup' 101 - LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup' 102 - BLDSHARED="$LDSHARED" 103 - else 104 + # building for OS X 10.0 through 10.2 105 LDSHARED='$(CC) -bundle' 106 LDCXXSHARED='$(CXX) -bundle' 107 if test "$enable_framework" ; then 108 @@ -1828,6 +1835,14 @@ then 109 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' 110 LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' 111 fi 112 + else 113 + # building for OS X 10.3 and later 114 + if test "${enable_universalsdk}"; then 115 + LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}" 116 + fi 117 + LDSHARED='$(CC) -bundle -undefined dynamic_lookup' 118 + LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup' 119 + BLDSHARED="$LDSHARED" 120 fi 121 ;; 122 Linux*|GNU*|QNX*) -
new file dports/lang/python32/files/yosemite-python-fixes.patch
diff --git a/dports/lang/python32/files/yosemite-python-fixes.patch b/dports/lang/python32/files/yosemite-python-fixes.patch new file mode 100644 index 0000000..0b807b9
- + 1 Index: Lib/_osx_support.py 2 =================================================================== 3 --- Lib/_osx_support.py.orig 4 +++ Lib/_osx_support.py 5 @@ -444,8 +444,16 @@ def get_platform_osx(_config_vars, osnam 6 # case and disallow installs. 7 cflags = _config_vars.get(_INITPRE+'CFLAGS', 8 _config_vars.get('CFLAGS', '')) 9 - if ((macrelease + '.') >= '10.4.' and 10 - '-arch' in cflags.strip()): 11 + if macrelease: 12 + try: 13 + macrelease = tuple(int(i) for i in macrelease.split('.')[0:2]) 14 + except ValueError: 15 + macrelease = (10, 0) 16 + else: 17 + # assume no universal support 18 + macrelease = (10, 0) 19 + 20 + if (macrelease >= (10, 4)) and '-arch' in cflags.strip(): 21 # The universal build will build fat binaries, but not on 22 # systems before 10.4 23 24 Index: Lib/distutils/tests/test_build_ext.py 25 =================================================================== 26 --- Lib/distutils/tests/test_build_ext.py.orig 27 +++ Lib/distutils/tests/test_build_ext.py 28 @@ -448,8 +448,16 @@ class BuildExtTestCase(TempdirManager, 29 30 # get the deployment target that the interpreter was built with 31 target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') 32 - target = tuple(map(int, target.split('.'))) 33 - target = '%02d%01d0' % target 34 + target = tuple(map(int, target.split('.')[0:2])) 35 + # format the target value as defined in the Apple 36 + # Availability Macros. We can't use the macro names since 37 + # at least one value we test with will not exist yet. 38 + if target[1] < 10: 39 + # for 10.1 through 10.9.x -> "10n0" 40 + target = '%02d%01d0' % target 41 + else: 42 + # for 10.10 and beyond -> "10nn00" 43 + target = '%02d%02d00' % target 44 deptarget_ext = Extension( 45 'deptarget', 46 [deptarget_c], 47 Index: Lib/test/test__osx_support.py 48 =================================================================== 49 --- Lib/test/test__osx_support.py.orig 50 +++ Lib/test/test__osx_support.py 51 @@ -109,7 +109,9 @@ class Test_OSXSupport(unittest.TestCase) 52 53 def test__supports_universal_builds(self): 54 import platform 55 - self.assertEqual(platform.mac_ver()[0].split('.') >= ['10', '4'], 56 + mac_ver_tuple = tuple(int(i) for i in 57 + platform.mac_ver()[0].split('.')[0:2]) 58 + self.assertEqual(mac_ver_tuple >= (10, 4), 59 _osx_support._supports_universal_builds()) 60 61 def test__find_appropriate_compiler(self): 62 Index: Lib/test/test_posix.py 63 =================================================================== 64 --- Lib/test/test_posix.py.orig 65 +++ Lib/test/test_posix.py 66 @@ -487,7 +487,7 @@ class PosixTester(unittest.TestCase): 67 if sys.platform == 'darwin': 68 import sysconfig 69 dt = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') or '10.0' 70 - if float(dt) < 10.6: 71 + if tuple(int(n) for n in dt.split('.')[0:2]) < (10, 6): 72 raise unittest.SkipTest("getgroups(2) is broken prior to 10.6") 73 74 # 'id -G' and 'os.getgroups()' should return the same 75 Index: Mac/BuildScript/build-installer.py 76 =================================================================== 77 --- Mac/BuildScript/build-installer.py.orig 78 +++ Mac/BuildScript/build-installer.py 79 @@ -148,16 +148,19 @@ SRCDIR = os.path.dirname( 80 # $MACOSX_DEPLOYMENT_TARGET -> minimum OS X level 81 DEPTARGET = '10.3' 82 83 -target_cc_map = { 84 +def getDeptargetTuple(): 85 + return tuple([int(n) for n in DEPTARGET.split('.')[0:2]]) 86 + 87 +def getTargetCompilers(): 88 + target_cc_map = { 89 '10.3': ('gcc-4.0', 'g++-4.0'), 90 '10.4': ('gcc-4.0', 'g++-4.0'), 91 '10.5': ('gcc-4.2', 'g++-4.2'), 92 '10.6': ('gcc-4.2', 'g++-4.2'), 93 - '10.7': ('clang', 'clang++'), 94 - '10.8': ('clang', 'clang++'), 95 -} 96 + } 97 + return target_cc_map.get(DEPTARGET, ('clang', 'clang++') ) 98 99 -CC, CXX = target_cc_map[DEPTARGET] 100 +CC, CXX = getTargetCompilers() 101 102 PYTHON_3 = getVersionTuple() >= (3, 0) 103 104 @@ -190,7 +193,7 @@ EXPECTED_SHARED_LIBS = {} 105 def library_recipes(): 106 result = [] 107 108 - LT_10_5 = bool(DEPTARGET < '10.5') 109 + LT_10_5 = bool(getDeptargetTuple() < (10, 5)) 110 111 if getVersionTuple() >= (3, 3): 112 result.extend([ 113 @@ -259,7 +262,7 @@ def library_recipes(): 114 ), 115 ]) 116 117 - if DEPTARGET < '10.5': 118 + if getDeptargetTuple() < (10, 5): 119 result.extend([ 120 dict( 121 name="Bzip2 1.0.6", 122 @@ -394,7 +397,7 @@ def pkg_recipes(): 123 ), 124 ] 125 126 - if DEPTARGET < '10.4' and not PYTHON_3: 127 + if getDeptargetTuple() < (10, 4) and not PYTHON_3: 128 result.append( 129 dict( 130 name="PythonSystemFixes", 131 @@ -610,7 +613,7 @@ def parseOptions(args=None): 132 SDKPATH=os.path.abspath(SDKPATH) 133 DEPSRC=os.path.abspath(DEPSRC) 134 135 - CC, CXX=target_cc_map[DEPTARGET] 136 + CC, CXX = getTargetCompilers() 137 138 print("Settings:") 139 print(" * Source directory:", SRCDIR) 140 Index: setup.py 141 =================================================================== 142 --- setup.py.orig 143 +++ setup.py 144 @@ -639,7 +639,9 @@ class PyBuildExt(build_ext): 145 if platform == 'darwin': 146 os_release = int(os.uname()[2].split('.')[0]) 147 dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') 148 - if dep_target and dep_target.split('.') < ['10', '5']: 149 + if (dep_target and 150 + (tuple(int(n) for n in dep_target.split('.')[0:2]) 151 + < (10, 5) ) ): 152 os_release = 8 153 if os_release < 9: 154 # MacOSX 10.4 has a broken readline. Don't try to build