Ticket #44994: 0001-python34-Apply-upstream-Yosemite-fixes.patch
File 0001-python34-Apply-upstream-Yosemite-fixes.patch, 12.9 KB (added by larryv (Lawrence Velázquez), 10 years ago) |
---|
-
dports/lang/python34/Portfile
From 0ab336c6339c907e6fc27685377d5846dd493338 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 1/5] python34: Apply upstream Yosemite fixes Patches from http://bugs.python.org/issue21811. --- dports/lang/python34/Portfile | 5 + .../python34/files/yosemite-configure-fixes.patch | 119 +++++++++++++++ .../python34/files/yosemite-python-fixes.patch | 162 +++++++++++++++++++++ 3 files changed, 286 insertions(+) create mode 100644 dports/lang/python34/files/yosemite-configure-fixes.patch create mode 100644 dports/lang/python34/files/yosemite-python-fixes.patch diff --git a/dports/lang/python34/Portfile b/dports/lang/python34/Portfile index 3d37dde..9664bdc 100644
a b name python34 8 8 9 9 # Remember to keep py34-tkinter and py34-gdbm's versions sync'd with this 10 10 version 3.4.1 11 revision 1 11 12 12 13 epoch 20140519 13 14 … … patchfiles patch-setup.py.diff \ 38 39 patch-setup.py-disabled_modules.diff \ 39 40 patch-libedit.diff 40 41 42 # http://bugs.python.org/issue21811 43 patchfiles-append yosemite-configure-fixes.patch \ 44 yosemite-python-fixes.patch 45 41 46 depends_lib port:zlib port:openssl \ 42 47 port:sqlite3 port:ncurses \ 43 48 port:bzip2 port:libedit port:gettext \ -
new file dports/lang/python34/files/yosemite-configure-fixes.patch
diff --git a/dports/lang/python34/files/yosemite-configure-fixes.patch b/dports/lang/python34/files/yosemite-configure-fixes.patch new file mode 100644 index 0000000..e940ec8
- + 1 2 # HG changeset patch 3 # User Ned Deily <nad@acm.org> 4 # Date 1403729062 25200 5 # Node ID 69ae7e4939f2fbd315b0585a197fb2be854052cc 6 # Parent 14198fda1c709fa366b70f1d078227e0bebfdeea 7 Issue #21811: Anticipated fixes to 3.x configure for OS X 10.10 Yosemite. 8 9 diff --git a/configure b/configure 10 --- configure.orig 11 +++ configure 12 @@ -6551,10 +6551,16 @@ fi 13 14 { $as_echo "$as_me:${as_lineno-$LINENO}: checking which MACOSX_DEPLOYMENT_TARGET to use" >&5 15 $as_echo_n "checking which MACOSX_DEPLOYMENT_TARGET to use... " >&6; } 16 - cur_target=`sw_vers -productVersion | sed 's/\(10\.[0-9]*\).*/\1/'` 17 - if test ${cur_target} '>' 10.2 && \ 18 - test ${cur_target} '<' 10.6 19 + cur_target_major=`sw_vers -productVersion | \ 20 + sed 's/\([0-9]*\)\.\([0-9]*\).*/\1/'` 21 + cur_target_minor=`sw_vers -productVersion | \ 22 + sed 's/\([0-9]*\)\.\([0-9]*\).*/\2/'` 23 + cur_target="${cur_target_major}.${cur_target_minor}" 24 + if test ${cur_target_major} -eq 10 && \ 25 + test ${cur_target_minor} -ge 3 && \ 26 + test ${cur_target_minor} -le 5 27 then 28 + # OS X 10.3 through 10.5 29 cur_target=10.3 30 if test ${enable_universalsdk} 31 then 32 @@ -8540,12 +8546,14 @@ then 33 # Use -undefined dynamic_lookup whenever possible (10.3 and later). 34 # This allows an extension to be used in any Python 35 36 - if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2 37 + dep_target_major=`echo ${MACOSX_DEPLOYMENT_TARGET} | \ 38 + sed 's/\([0-9]*\)\.\([0-9]*\).*/\1/'` 39 + dep_target_minor=`echo ${MACOSX_DEPLOYMENT_TARGET} | \ 40 + sed 's/\([0-9]*\)\.\([0-9]*\).*/\2/'` 41 + if test ${dep_target_major} -eq 10 && \ 42 + test ${dep_target_minor} -le 2 43 then 44 - LDSHARED='$(CC) -bundle -undefined dynamic_lookup' 45 - LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup' 46 - BLDSHARED="$LDSHARED" 47 - else 48 + # building for OS X 10.0 through 10.2 49 LDSHARED='$(CC) -bundle' 50 LDCXXSHARED='$(CXX) -bundle' 51 if test "$enable_framework" ; then 52 @@ -8559,6 +8567,11 @@ then 53 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' 54 LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' 55 fi 56 + else 57 + # building for OS X 10.3 and later 58 + LDSHARED='$(CC) -bundle -undefined dynamic_lookup' 59 + LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup' 60 + BLDSHARED="$LDSHARED" 61 fi 62 ;; 63 Linux*|GNU*|QNX*) 64 diff --git a/configure.ac b/configure.ac 65 --- configure.ac.orig 66 +++ configure.ac 67 @@ -1318,10 +1318,16 @@ yes) 68 # 4. If we are running on OS X 10.2 or earlier, good luck! 69 70 AC_MSG_CHECKING(which MACOSX_DEPLOYMENT_TARGET to use) 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} 86 then 87 @@ -2017,12 +2023,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 - LDSHARED='$(CC) -bundle -undefined dynamic_lookup' 100 - LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup' 101 - BLDSHARED="$LDSHARED" 102 - else 103 + # building for OS X 10.0 through 10.2 104 LDSHARED='$(CC) -bundle' 105 LDCXXSHARED='$(CXX) -bundle' 106 if test "$enable_framework" ; then 107 @@ -2036,6 +2044,11 @@ then 108 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' 109 LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' 110 fi 111 + else 112 + # building for OS X 10.3 and later 113 + LDSHARED='$(CC) -bundle -undefined dynamic_lookup' 114 + LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup' 115 + BLDSHARED="$LDSHARED" 116 fi 117 ;; 118 Linux*|GNU*|QNX*) 119 -
new file dports/lang/python34/files/yosemite-python-fixes.patch
diff --git a/dports/lang/python34/files/yosemite-python-fixes.patch b/dports/lang/python34/files/yosemite-python-fixes.patch new file mode 100644 index 0000000..a164450
- + 1 2 # HG changeset patch 3 # User Ned Deily <nad@acm.org> 4 # Date 1403728574 25200 5 # Node ID 14198fda1c709fa366b70f1d078227e0bebfdeea 6 # Parent dead2b526c3b9d748c6483db4520ac5bc2e1ef4e 7 Issue #21811: Anticipated fixes to 3.x and 2.7 for OS X 10.10 Yosemite. 8 9 diff --git a/Lib/_osx_support.py b/Lib/_osx_support.py 10 --- Lib/_osx_support.py.orig 11 +++ Lib/_osx_support.py 12 @@ -450,8 +450,16 @@ def get_platform_osx(_config_vars, osnam 13 # case and disallow installs. 14 cflags = _config_vars.get(_INITPRE+'CFLAGS', 15 _config_vars.get('CFLAGS', '')) 16 - if ((macrelease + '.') >= '10.4.' and 17 - '-arch' in cflags.strip()): 18 + if macrelease: 19 + try: 20 + macrelease = tuple(int(i) for i in macrelease.split('.')[0:2]) 21 + except ValueError: 22 + macrelease = (10, 0) 23 + else: 24 + # assume no universal support 25 + macrelease = (10, 0) 26 + 27 + if (macrelease >= (10, 4)) and '-arch' in cflags.strip(): 28 # The universal build will build fat binaries, but not on 29 # systems before 10.4 30 31 diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py 32 --- Lib/distutils/tests/test_build_ext.py.orig 33 +++ Lib/distutils/tests/test_build_ext.py 34 @@ -444,8 +444,16 @@ class BuildExtTestCase(TempdirManager, 35 36 # get the deployment target that the interpreter was built with 37 target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') 38 - target = tuple(map(int, target.split('.'))) 39 - target = '%02d%01d0' % target 40 + target = tuple(map(int, target.split('.')[0:2])) 41 + # format the target value as defined in the Apple 42 + # Availability Macros. We can't use the macro names since 43 + # at least one value we test with will not exist yet. 44 + if target[1] < 10: 45 + # for 10.1 through 10.9.x -> "10n0" 46 + target = '%02d%01d0' % target 47 + else: 48 + # for 10.10 and beyond -> "10nn00" 49 + target = '%02d%02d00' % target 50 deptarget_ext = Extension( 51 'deptarget', 52 [deptarget_c], 53 diff --git a/Lib/test/test__osx_support.py b/Lib/test/test__osx_support.py 54 --- Lib/test/test__osx_support.py.orig 55 +++ Lib/test/test__osx_support.py 56 @@ -109,7 +109,9 @@ class Test_OSXSupport(unittest.TestCase) 57 58 def test__supports_universal_builds(self): 59 import platform 60 - self.assertEqual(platform.mac_ver()[0].split('.') >= ['10', '4'], 61 + mac_ver_tuple = tuple(int(i) for i in 62 + platform.mac_ver()[0].split('.')[0:2]) 63 + self.assertEqual(mac_ver_tuple >= (10, 4), 64 _osx_support._supports_universal_builds()) 65 66 def test__find_appropriate_compiler(self): 67 diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py 68 --- Lib/test/test_posix.py.orig 69 +++ Lib/test/test_posix.py 70 @@ -768,7 +768,7 @@ class PosixTester(unittest.TestCase): 71 if sys.platform == 'darwin': 72 import sysconfig 73 dt = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') or '10.0' 74 - if float(dt) < 10.6: 75 + if tuple(int(n) for n in dt.split('.')[0:2]) < (10, 6): 76 raise unittest.SkipTest("getgroups(2) is broken prior to 10.6") 77 78 # 'id -G' and 'os.getgroups()' should return the same 79 diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py 80 --- Mac/BuildScript/build-installer.py.orig 81 +++ Mac/BuildScript/build-installer.py 82 @@ -150,17 +150,19 @@ SRCDIR = os.path.dirname( 83 # $MACOSX_DEPLOYMENT_TARGET -> minimum OS X level 84 DEPTARGET = '10.3' 85 86 -target_cc_map = { 87 +def getDeptargetTuple(): 88 + return tuple([int(n) for n in DEPTARGET.split('.')[0:2]]) 89 + 90 +def getTargetCompilers(): 91 + target_cc_map = { 92 '10.3': ('gcc-4.0', 'g++-4.0'), 93 '10.4': ('gcc-4.0', 'g++-4.0'), 94 '10.5': ('gcc-4.2', 'g++-4.2'), 95 '10.6': ('gcc-4.2', 'g++-4.2'), 96 - '10.7': ('clang', 'clang++'), 97 - '10.8': ('clang', 'clang++'), 98 - '10.9': ('clang', 'clang++'), 99 -} 100 + } 101 + return target_cc_map.get(DEPTARGET, ('clang', 'clang++') ) 102 103 -CC, CXX = target_cc_map[DEPTARGET] 104 +CC, CXX = getTargetCompilers() 105 106 PYTHON_3 = getVersionTuple() >= (3, 0) 107 108 @@ -193,10 +195,10 @@ EXPECTED_SHARED_LIBS = {} 109 def library_recipes(): 110 result = [] 111 112 - LT_10_5 = bool(DEPTARGET < '10.5') 113 + LT_10_5 = bool(getDeptargetTuple() < (10, 5)) 114 115 # Disable for now 116 - if False: # if (DEPTARGET > '10.5') and (getVersionTuple() >= (3, 5)): 117 + if False: # if (getDeptargetTuple() > (10, 5)) and (getVersionTuple() >= (3, 5)): 118 result.extend([ 119 dict( 120 name="Tcl 8.5.15", 121 @@ -304,7 +306,7 @@ def library_recipes(): 122 ), 123 ]) 124 125 - if DEPTARGET < '10.5': 126 + if getDeptargetTuple() < (10, 5): 127 result.extend([ 128 dict( 129 name="Bzip2 1.0.6", 130 @@ -458,7 +460,7 @@ def pkg_recipes(): 131 ) 132 ) 133 134 - if DEPTARGET < '10.4' and not PYTHON_3: 135 + if getDeptargetTuple() < (10, 4) and not PYTHON_3: 136 result.append( 137 dict( 138 name="PythonSystemFixes", 139 @@ -679,7 +681,7 @@ def parseOptions(args=None): 140 SDKPATH=os.path.abspath(SDKPATH) 141 DEPSRC=os.path.abspath(DEPSRC) 142 143 - CC, CXX=target_cc_map[DEPTARGET] 144 + CC, CXX = getTargetCompilers() 145 146 print("Settings:") 147 print(" * Source directory:", SRCDIR) 148 diff --git a/setup.py b/setup.py 149 --- setup.py.orig 150 +++ setup.py 151 @@ -697,7 +697,9 @@ class PyBuildExt(build_ext): 152 if host_platform == 'darwin': 153 os_release = int(os.uname()[2].split('.')[0]) 154 dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') 155 - if dep_target and dep_target.split('.') < ['10', '5']: 156 + if (dep_target and 157 + (tuple(int(n) for n in dep_target.split('.')[0:2]) 158 + < (10, 5) ) ): 159 os_release = 8 160 if os_release < 9: 161 # MacOSX 10.4 has a broken readline. Don't try to build 162