Ticket #44994: 0002-python33-Apply-upstream-Yosemite-fixes.patch
File 0002-python33-Apply-upstream-Yosemite-fixes.patch, 13.0 KB (added by larryv (Lawrence Velázquez), 10 years ago) |
---|
-
dports/lang/python33/Portfile
From c53f37c2347d931e391ad279b5e845a63384a845 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 2/5] python33: Apply upstream Yosemite fixes Patches adapted from http://bugs.python.org/issue21811. --- dports/lang/python33/Portfile | 5 + .../python33/files/yosemite-configure-fixes.patch | 124 ++++++++++++++++ .../python33/files/yosemite-python-fixes.patch | 158 +++++++++++++++++++++ 3 files changed, 287 insertions(+) create mode 100644 dports/lang/python33/files/yosemite-configure-fixes.patch create mode 100644 dports/lang/python33/files/yosemite-python-fixes.patch diff --git a/dports/lang/python33/Portfile b/dports/lang/python33/Portfile index 7cc049d..a6258c6 100644
a b name python33 8 8 9 9 # Remember to keep py33-tkinter and py33-gdbm's versions sync'd with this 10 10 version 3.3.5 11 revision 1 11 12 # typo in epoch, day and month switched in previous, correct in September 12 13 epoch 20140903 13 14 … … patchfiles patch-setup.py.diff \ 40 41 patch-setup.py-disabled_modules.diff \ 41 42 patch-libedit.diff 42 43 44 # http://bugs.python.org/issue21811 45 patchfiles-append yosemite-configure-fixes.patch \ 46 yosemite-python-fixes.patch 47 43 48 depends_lib port:zlib port:openssl \ 44 49 port:sqlite3 port:ncurses \ 45 50 port:bzip2 port:libedit port:gettext \ -
new file dports/lang/python33/files/yosemite-configure-fixes.patch
diff --git a/dports/lang/python33/files/yosemite-configure-fixes.patch b/dports/lang/python33/files/yosemite-configure-fixes.patch new file mode 100644 index 0000000..c6ad10e
- + 1 Index: configure 2 =================================================================== 3 --- configure.orig 4 +++ configure 5 @@ -6459,10 +6459,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 && \ 11 - test ${cur_target} '<' 10.6 12 + cur_target_major=`sw_vers -productVersion | \ 13 + sed 's/\([0-9]*\)\.\([0-9]*\).*/\1/'` 14 + cur_target_minor=`sw_vers -productVersion | \ 15 + sed 's/\([0-9]*\)\.\([0-9]*\).*/\2/'` 16 + cur_target="${cur_target_major}.${cur_target_minor}" 17 + if test ${cur_target_major} -eq 10 && \ 18 + test ${cur_target_minor} -ge 3 && \ 19 + test ${cur_target_minor} -le 5 20 then 21 + # OS X 10.3 through 10.5 22 cur_target=10.3 23 if test ${enable_universalsdk}; then 24 if test "${UNIVERSAL_ARCHS}" = "all"; then 25 @@ -8481,15 +8487,14 @@ then 26 # Use -undefined dynamic_lookup whenever possible (10.3 and later). 27 # This allows an extension to be used in any Python 28 29 - if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2 30 + dep_target_major=`echo ${MACOSX_DEPLOYMENT_TARGET} | \ 31 + sed 's/\([0-9]*\)\.\([0-9]*\).*/\1/'` 32 + dep_target_minor=`echo ${MACOSX_DEPLOYMENT_TARGET} | \ 33 + sed 's/\([0-9]*\)\.\([0-9]*\).*/\2/'` 34 + if test ${dep_target_major} -eq 10 && \ 35 + test ${dep_target_minor} -le 2 36 then 37 - if test "${enable_universalsdk}"; then 38 - LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}" 39 - fi 40 - LDSHARED='$(CC) -bundle -undefined dynamic_lookup' 41 - LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup' 42 - BLDSHARED="$LDSHARED" 43 - else 44 + # building for OS X 10.0 through 10.2 45 LDSHARED='$(CC) -bundle' 46 LDCXXSHARED='$(CXX) -bundle' 47 if test "$enable_framework" ; then 48 @@ -8503,6 +8508,14 @@ then 49 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' 50 LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' 51 fi 52 + else 53 + # building for OS X 10.3 and later 54 + if test "${enable_universalsdk}"; then 55 + LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}" 56 + fi 57 + LDSHARED='$(CC) -bundle -undefined dynamic_lookup' 58 + LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup' 59 + BLDSHARED="$LDSHARED" 60 fi 61 ;; 62 Linux*|GNU*|QNX*) 63 Index: configure.ac 64 =================================================================== 65 --- configure.ac.orig 66 +++ configure.ac 67 @@ -1258,10 +1258,16 @@ yes) 68 69 # Calculate the right deployment target for this build. 70 # 71 - cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'` 72 - if test ${cur_target} '>' 10.2 && \ 73 - test ${cur_target} '<' 10.6 74 + cur_target_major=`sw_vers -productVersion | \ 75 + sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` 76 + cur_target_minor=`sw_vers -productVersion | \ 77 + sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` 78 + cur_target="${cur_target_major}.${cur_target_minor}" 79 + if test ${cur_target_major} -eq 10 && \ 80 + test ${cur_target_minor} -ge 3 && \ 81 + test ${cur_target_minor} -le 5 82 then 83 + # OS X 10.3 through 10.5 84 cur_target=10.3 85 if test ${enable_universalsdk}; then 86 if test "${UNIVERSAL_ARCHS}" = "all"; then 87 @@ -1980,15 +1986,14 @@ then 88 # Use -undefined dynamic_lookup whenever possible (10.3 and later). 89 # This allows an extension to be used in any Python 90 91 - if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2 92 + dep_target_major=`echo ${MACOSX_DEPLOYMENT_TARGET} | \ 93 + sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` 94 + dep_target_minor=`echo ${MACOSX_DEPLOYMENT_TARGET} | \ 95 + sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` 96 + if test ${dep_target_major} -eq 10 && \ 97 + test ${dep_target_minor} -le 2 98 then 99 - if test "${enable_universalsdk}"; then 100 - LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}" 101 - fi 102 - LDSHARED='$(CC) -bundle -undefined dynamic_lookup' 103 - LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup' 104 - BLDSHARED="$LDSHARED" 105 - else 106 + # building for OS X 10.0 through 10.2 107 LDSHARED='$(CC) -bundle' 108 LDCXXSHARED='$(CXX) -bundle' 109 if test "$enable_framework" ; then 110 @@ -2002,6 +2007,14 @@ then 111 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' 112 LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' 113 fi 114 + else 115 + # building for OS X 10.3 and later 116 + if test "${enable_universalsdk}"; then 117 + LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}" 118 + fi 119 + LDSHARED='$(CC) -bundle -undefined dynamic_lookup' 120 + LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup' 121 + BLDSHARED="$LDSHARED" 122 fi 123 ;; 124 Linux*|GNU*|QNX*) -
new file dports/lang/python33/files/yosemite-python-fixes.patch
diff --git a/dports/lang/python33/files/yosemite-python-fixes.patch b/dports/lang/python33/files/yosemite-python-fixes.patch new file mode 100644 index 0000000..beaefa4
- + 1 Index: Lib/_osx_support.py 2 =================================================================== 3 --- Lib/_osx_support.py.orig 4 +++ Lib/_osx_support.py 5 @@ -450,8 +450,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 @@ -444,8 +444,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 @@ -768,7 +768,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,17 +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 - '10.9': ('clang', 'clang++'), 96 -} 97 + } 98 + return target_cc_map.get(DEPTARGET, ('clang', 'clang++') ) 99 100 -CC, CXX = target_cc_map[DEPTARGET] 101 +CC, CXX = getTargetCompilers() 102 103 PYTHON_3 = getVersionTuple() >= (3, 0) 104 105 @@ -191,9 +193,9 @@ EXPECTED_SHARED_LIBS = {} 106 def library_recipes(): 107 result = [] 108 109 - LT_10_5 = bool(DEPTARGET < '10.5') 110 + LT_10_5 = bool(getDeptargetTuple() < (10, 5)) 111 112 - if (DEPTARGET > '10.5') and (getVersionTuple() >= (3, 4)): 113 + if (getDeptargetTuple() > (10, 5)) and (getVersionTuple() >= (3, 4)): 114 result.extend([ 115 dict( 116 name="Tcl 8.5.15", 117 @@ -301,7 +303,7 @@ def library_recipes(): 118 ), 119 ]) 120 121 - if DEPTARGET < '10.5': 122 + if getDeptargetTuple() < (10, 5): 123 result.extend([ 124 dict( 125 name="Bzip2 1.0.6", 126 @@ -436,7 +438,7 @@ def pkg_recipes(): 127 ), 128 ] 129 130 - if DEPTARGET < '10.4' and not PYTHON_3: 131 + if getDeptargetTuple() < (10, 4) and not PYTHON_3: 132 result.append( 133 dict( 134 name="PythonSystemFixes", 135 @@ -666,7 +668,7 @@ def parseOptions(args=None): 136 SDKPATH=os.path.abspath(SDKPATH) 137 DEPSRC=os.path.abspath(DEPSRC) 138 139 - CC, CXX=target_cc_map[DEPTARGET] 140 + CC, CXX = getTargetCompilers() 141 142 print("Settings:") 143 print(" * Source directory:", SRCDIR) 144 Index: setup.py 145 =================================================================== 146 --- setup.py.orig 147 +++ setup.py 148 @@ -687,7 +687,9 @@ class PyBuildExt(build_ext): 149 if host_platform == 'darwin': 150 os_release = int(os.uname()[2].split('.')[0]) 151 dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') 152 - if dep_target and dep_target.split('.') < ['10', '5']: 153 + if (dep_target and 154 + (tuple(int(n) for n in dep_target.split('.')[0:2]) 155 + < (10, 5) ) ): 156 os_release = 8 157 if os_release < 9: 158 # MacOSX 10.4 has a broken readline. Don't try to build