[125556] trunk/dports/lang/python32

larryv at macports.org larryv at macports.org
Sat Sep 20 19:20:45 PDT 2014


Revision: 125556
          https://trac.macports.org/changeset/125556
Author:   larryv at macports.org
Date:     2014-09-20 19:20:44 -0700 (Sat, 20 Sep 2014)
Log Message:
-----------
python32: Apply upstream Yosemite fixes

Patches adapted from http://bugs.python.org/issue21811.

Modified Paths:
--------------
    trunk/dports/lang/python32/Portfile

Added Paths:
-----------
    trunk/dports/lang/python32/files/yosemite-configure-fixes.patch
    trunk/dports/lang/python32/files/yosemite-python-fixes.patch

Modified: trunk/dports/lang/python32/Portfile
===================================================================
--- trunk/dports/lang/python32/Portfile	2014-09-21 02:20:41 UTC (rev 125555)
+++ trunk/dports/lang/python32/Portfile	2014-09-21 02:20:44 UTC (rev 125556)
@@ -8,6 +8,7 @@
 epoch                   20120412
 # Remember to keep py32-tkinter and py32-gdbm's versions sync'd with this
 version                 3.2.5
+revision                1
 
 set major               [lindex [split $version .] 0]
 set branch              [join [lrange [split ${version} .] 0 1] .]
@@ -37,6 +38,10 @@
                         patch-setup.py-disabled_modules.diff \
                         patch-libedit.diff
 
+# http://bugs.python.org/issue21811
+patchfiles-append       yosemite-configure-fixes.patch \
+                        yosemite-python-fixes.patch
+
 depends_lib             port:zlib port:openssl \
                         port:sqlite3 port:ncurses \
                         port:bzip2 port:libedit port:gettext

Added: trunk/dports/lang/python32/files/yosemite-configure-fixes.patch
===================================================================
--- trunk/dports/lang/python32/files/yosemite-configure-fixes.patch	                        (rev 0)
+++ trunk/dports/lang/python32/files/yosemite-configure-fixes.patch	2014-09-21 02:20:44 UTC (rev 125556)
@@ -0,0 +1,122 @@
+Index: configure
+===================================================================
+--- configure.orig
++++ configure
+@@ -5789,8 +5789,16 @@ $as_echo "$CC" >&6; }
+ 
+ 	    # Calculate the right deployment target for this build.
+ 	    #
+-	    cur_target=`sw_vers -productVersion | sed 's/\(10\.[0-9]*\).*/\1/'`
+-	    if test ${cur_target} '>' 10.2; then
++	    cur_target_major=`sw_vers -productVersion | \
++		    sed 's/\([0-9]*\)\.\([0-9]*\).*/\1/'`
++	    cur_target_minor=`sw_vers -productVersion | \
++		    sed 's/\([0-9]*\)\.\([0-9]*\).*/\2/'`
++	    cur_target="${cur_target_major}.${cur_target_minor}"
++	    if test ${cur_target_major} -eq 10 && \
++	       test ${cur_target_minor} -ge 3 && \
++	       test ${cur_target_minor} -le 5
++	    then
++		    # OS X 10.3 through 10.5
+ 		    cur_target=10.3
+ 		    if test ${enable_universalsdk}; then
+ 			    if test "${UNIVERSAL_ARCHS}" = "all"; then
+@@ -7783,15 +7791,14 @@ then
+ 		# Use -undefined dynamic_lookup whenever possible (10.3 and later).
+ 		# This allows an extension to be used in any Python
+ 
+-		if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2
++		dep_target_major=`echo ${MACOSX_DEPLOYMENT_TARGET} | \
++				sed 's/\([0-9]*\)\.\([0-9]*\).*/\1/'`
++		dep_target_minor=`echo ${MACOSX_DEPLOYMENT_TARGET} | \
++				sed 's/\([0-9]*\)\.\([0-9]*\).*/\2/'`
++		if test ${dep_target_major} -eq 10 && \
++		   test ${dep_target_minor} -le 2
+ 		then
+-			if test "${enable_universalsdk}"; then
+-				LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
+-			fi
+-			LDSHARED='$(CC) -bundle -undefined dynamic_lookup'
+-			LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup'
+-			BLDSHARED="$LDSHARED"
+-		else
++			# building for OS X 10.0 through 10.2
+ 			LDSHARED='$(CC) -bundle'
+ 			LDCXXSHARED='$(CXX) -bundle'
+ 			if test "$enable_framework" ; then
+@@ -7805,6 +7812,14 @@ then
+ 				LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
+ 				LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
+ 			fi
++		else
++			# building for OS X 10.3 and later
++			if test "${enable_universalsdk}"; then
++				LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
++			fi
++			LDSHARED='$(CC) -bundle -undefined dynamic_lookup'
++			LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup'
++			BLDSHARED="$LDSHARED"
+ 		fi
+ 		;;
+ 	Linux*|GNU*|QNX*)
+Index: configure.ac
+===================================================================
+--- configure.ac.orig
++++ configure.ac
+@@ -1099,8 +1099,16 @@ yes)
+ 
+ 	    # Calculate the right deployment target for this build.
+ 	    #
+-	    cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
+-	    if test ${cur_target} '>' 10.2; then
++	    cur_target_major=`sw_vers -productVersion | \
++		    sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
++	    cur_target_minor=`sw_vers -productVersion | \
++		    sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
++	    cur_target="${cur_target_major}.${cur_target_minor}"
++	    if test ${cur_target_major} -eq 10 && \
++	       test ${cur_target_minor} -ge 3 && \
++	       test ${cur_target_minor} -le 5
++	    then
++		    # OS X 10.3 through 10.5
+ 		    cur_target=10.3
+ 		    if test ${enable_universalsdk}; then
+ 			    if test "${UNIVERSAL_ARCHS}" = "all"; then
+@@ -1806,15 +1814,14 @@ then
+ 		# Use -undefined dynamic_lookup whenever possible (10.3 and later).
+ 		# This allows an extension to be used in any Python
+ 
+-		if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2
++		dep_target_major=`echo ${MACOSX_DEPLOYMENT_TARGET} | \
++				sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
++		dep_target_minor=`echo ${MACOSX_DEPLOYMENT_TARGET} | \
++				sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
++		if test ${dep_target_major} -eq 10 && \
++		   test ${dep_target_minor} -le 2
+ 		then
+-			if test "${enable_universalsdk}"; then
+-				LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
+-			fi
+-			LDSHARED='$(CC) -bundle -undefined dynamic_lookup'
+-			LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup'
+-			BLDSHARED="$LDSHARED"
+-		else
++			# building for OS X 10.0 through 10.2
+ 			LDSHARED='$(CC) -bundle'
+ 			LDCXXSHARED='$(CXX) -bundle'
+ 			if test "$enable_framework" ; then
+@@ -1828,6 +1835,14 @@ then
+ 				LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
+ 				LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
+ 			fi
++		else
++			# building for OS X 10.3 and later
++			if test "${enable_universalsdk}"; then
++				LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
++			fi
++			LDSHARED='$(CC) -bundle -undefined dynamic_lookup'
++			LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup'
++			BLDSHARED="$LDSHARED"
+ 		fi
+ 		;;
+ 	Linux*|GNU*|QNX*)

Added: trunk/dports/lang/python32/files/yosemite-python-fixes.patch
===================================================================
--- trunk/dports/lang/python32/files/yosemite-python-fixes.patch	                        (rev 0)
+++ trunk/dports/lang/python32/files/yosemite-python-fixes.patch	2014-09-21 02:20:44 UTC (rev 125556)
@@ -0,0 +1,154 @@
+Index: Lib/_osx_support.py
+===================================================================
+--- Lib/_osx_support.py.orig
++++ Lib/_osx_support.py
+@@ -444,8 +444,16 @@ def get_platform_osx(_config_vars, osnam
+         # case and disallow installs.
+         cflags = _config_vars.get(_INITPRE+'CFLAGS',
+                                     _config_vars.get('CFLAGS', ''))
+-        if ((macrelease + '.') >= '10.4.' and
+-            '-arch' in cflags.strip()):
++        if macrelease:
++            try:
++                macrelease = tuple(int(i) for i in macrelease.split('.')[0:2])
++            except ValueError:
++                macrelease = (10, 0)
++        else:
++            # assume no universal support
++            macrelease = (10, 0)
++
++        if (macrelease >= (10, 4)) and '-arch' in cflags.strip():
+             # The universal build will build fat binaries, but not on
+             # systems before 10.4
+ 
+Index: Lib/distutils/tests/test_build_ext.py
+===================================================================
+--- Lib/distutils/tests/test_build_ext.py.orig
++++ Lib/distutils/tests/test_build_ext.py
+@@ -448,8 +448,16 @@ class BuildExtTestCase(TempdirManager,
+ 
+         # get the deployment target that the interpreter was built with
+         target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
+-        target = tuple(map(int, target.split('.')))
+-        target = '%02d%01d0' % target
++        target = tuple(map(int, target.split('.')[0:2]))
++        # format the target value as defined in the Apple
++        # Availability Macros.  We can't use the macro names since
++        # at least one value we test with will not exist yet.
++        if target[1] < 10:
++            # for 10.1 through 10.9.x -> "10n0"
++            target = '%02d%01d0' % target
++        else:
++            # for 10.10 and beyond -> "10nn00"
++            target = '%02d%02d00' % target
+         deptarget_ext = Extension(
+             'deptarget',
+             [deptarget_c],
+Index: Lib/test/test__osx_support.py
+===================================================================
+--- Lib/test/test__osx_support.py.orig
++++ Lib/test/test__osx_support.py
+@@ -109,7 +109,9 @@ class Test_OSXSupport(unittest.TestCase)
+ 
+     def test__supports_universal_builds(self):
+         import platform
+-        self.assertEqual(platform.mac_ver()[0].split('.') >= ['10', '4'],
++        mac_ver_tuple = tuple(int(i) for i in
++                            platform.mac_ver()[0].split('.')[0:2])
++        self.assertEqual(mac_ver_tuple >= (10, 4),
+                             _osx_support._supports_universal_builds())
+ 
+     def test__find_appropriate_compiler(self):
+Index: Lib/test/test_posix.py
+===================================================================
+--- Lib/test/test_posix.py.orig
++++ Lib/test/test_posix.py
+@@ -487,7 +487,7 @@ class PosixTester(unittest.TestCase):
+         if sys.platform == 'darwin':
+             import sysconfig
+             dt = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') or '10.0'
+-            if float(dt) < 10.6:
++            if tuple(int(n) for n in dt.split('.')[0:2]) < (10, 6):
+                 raise unittest.SkipTest("getgroups(2) is broken prior to 10.6")
+ 
+         # 'id -G' and 'os.getgroups()' should return the same
+Index: Mac/BuildScript/build-installer.py
+===================================================================
+--- Mac/BuildScript/build-installer.py.orig
++++ Mac/BuildScript/build-installer.py
+@@ -148,16 +148,19 @@ SRCDIR = os.path.dirname(
+ # $MACOSX_DEPLOYMENT_TARGET -> minimum OS X level
+ DEPTARGET = '10.3'
+ 
+-target_cc_map = {
++def getDeptargetTuple():
++    return tuple([int(n) for n in DEPTARGET.split('.')[0:2]])
++
++def getTargetCompilers():
++    target_cc_map = {
+         '10.3': ('gcc-4.0', 'g++-4.0'),
+         '10.4': ('gcc-4.0', 'g++-4.0'),
+         '10.5': ('gcc-4.2', 'g++-4.2'),
+         '10.6': ('gcc-4.2', 'g++-4.2'),
+-        '10.7': ('clang', 'clang++'),
+-        '10.8': ('clang', 'clang++'),
+-}
++    }
++    return target_cc_map.get(DEPTARGET, ('clang', 'clang++') )
+ 
+-CC, CXX = target_cc_map[DEPTARGET]
++CC, CXX = getTargetCompilers()
+ 
+ PYTHON_3 = getVersionTuple() >= (3, 0)
+ 
+@@ -190,7 +193,7 @@ EXPECTED_SHARED_LIBS = {}
+ def library_recipes():
+     result = []
+ 
+-    LT_10_5 = bool(DEPTARGET < '10.5')
++    LT_10_5 = bool(getDeptargetTuple() < (10, 5))
+ 
+     if getVersionTuple() >= (3, 3):
+         result.extend([
+@@ -259,7 +262,7 @@ def library_recipes():
+           ),
+         ])
+ 
+-    if DEPTARGET < '10.5':
++    if getDeptargetTuple() < (10, 5):
+         result.extend([
+           dict(
+               name="Bzip2 1.0.6",
+@@ -394,7 +397,7 @@ def pkg_recipes():
+         ),
+     ]
+ 
+-    if DEPTARGET < '10.4' and not PYTHON_3:
++    if getDeptargetTuple() < (10, 4) and not PYTHON_3:
+         result.append(
+             dict(
+                 name="PythonSystemFixes",
+@@ -610,7 +613,7 @@ def parseOptions(args=None):
+     SDKPATH=os.path.abspath(SDKPATH)
+     DEPSRC=os.path.abspath(DEPSRC)
+ 
+-    CC, CXX=target_cc_map[DEPTARGET]
++    CC, CXX = getTargetCompilers()
+ 
+     print("Settings:")
+     print(" * Source directory:", SRCDIR)
+Index: setup.py
+===================================================================
+--- setup.py.orig
++++ setup.py
+@@ -639,7 +639,9 @@ class PyBuildExt(build_ext):
+         if platform == 'darwin':
+             os_release = int(os.uname()[2].split('.')[0])
+             dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
+-            if dep_target and dep_target.split('.') < ['10', '5']:
++            if (dep_target and
++                    (tuple(int(n) for n in dep_target.split('.')[0:2])
++                        < (10, 5) ) ):
+                 os_release = 8
+             if os_release < 9:
+                 # MacOSX 10.4 has a broken readline. Don't try to build
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140920/cf34c67a/attachment.html>


More information about the macports-changes mailing list