<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[125558] trunk/dports/lang/python26</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="https://trac.macports.org/changeset/125558">125558</a></dd>
<dt>Author</dt> <dd>larryv@macports.org</dd>
<dt>Date</dt> <dd>2014-09-20 19:20:50 -0700 (Sat, 20 Sep 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>python26: Apply upstream Yosemite fixes

Patches adapted from http://bugs.python.org/issue21811.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkdportslangpython26Portfile">trunk/dports/lang/python26/Portfile</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkdportslangpython26filesyosemiteconfigurefixespatch">trunk/dports/lang/python26/files/yosemite-configure-fixes.patch</a></li>
<li><a href="#trunkdportslangpython26filesyosemitepythonfixespatch">trunk/dports/lang/python26/files/yosemite-python-fixes.patch</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkdportslangpython26Portfile"></a>
<div class="modfile"><h4>Modified: trunk/dports/lang/python26/Portfile (125557 => 125558)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/lang/python26/Portfile        2014-09-21 02:20:47 UTC (rev 125557)
+++ trunk/dports/lang/python26/Portfile        2014-09-21 02:20:50 UTC (rev 125558)
</span><span class="lines">@@ -7,6 +7,7 @@
</span><span class="cx"> name                    python26
</span><span class="cx"> # Remember to keep py26-tkinter and py26-gdbm's versions sync'd with this
</span><span class="cx"> version                 2.6.9
</span><ins>+revision                1
</ins><span class="cx"> set major               [lindex [split $version .] 0]
</span><span class="cx"> set branch              [join [lrange [split ${version} .] 0 1] .]
</span><span class="cx"> categories              lang
</span><span class="lines">@@ -46,6 +47,10 @@
</span><span class="cx">                         patch-setup.py-disabled_modules.diff \
</span><span class="cx">                         patch-libedit.diff
</span><span class="cx"> 
</span><ins>+# http://bugs.python.org/issue21811
+patchfiles-append       yosemite-configure-fixes.patch \
+                        yosemite-python-fixes.patch
+
</ins><span class="cx"> depends_lib             port:gettext port:zlib port:openssl \
</span><span class="cx">                         port:sqlite3 port:db46 port:ncurses \
</span><span class="cx">                         port:bzip2 port:libedit
</span></span></pre></div>
<a id="trunkdportslangpython26filesyosemiteconfigurefixespatch"></a>
<div class="addfile"><h4>Added: trunk/dports/lang/python26/files/yosemite-configure-fixes.patch (0 => 125558)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/lang/python26/files/yosemite-configure-fixes.patch                                (rev 0)
+++ trunk/dports/lang/python26/files/yosemite-configure-fixes.patch        2014-09-21 02:20:50 UTC (rev 125558)
</span><span class="lines">@@ -0,0 +1,114 @@
</span><ins>+Index: configure
+===================================================================
+--- configure.orig
++++ configure
+@@ -5313,8 +5313,14 @@ $as_echo &quot;$CC&quot; &gt;&amp;6; }

+             # Calculate the right deployment target for this build.
+             #
+-            cur_target=`sw_vers -productVersion | sed 's/\(10\.[0-9]*\).*/\1/'`
+-            if test ${cur_target} '&gt;' 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=&quot;${cur_target_major}.${cur_target_minor}&quot;
++            if test ${cur_target_major} -eq 10 &amp;&amp; \
++               test ${cur_target_minor} -ge 3
++            then
+                     cur_target=10.3
+                     if test ${enable_universalsdk}; then
+                             if test &quot;${UNIVERSAL_ARCHS}&quot; = &quot;all&quot;; then
+@@ -7366,14 +7372,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} '&gt;' 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 &amp;&amp; \
++                   test ${dep_target_minor} -le 2
+                 then
+-                        if test &quot;${enable_universalsdk}&quot;; then
+-                                LDFLAGS=&quot;${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}&quot;
+-                        fi
+-                        LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
+-                        BLDSHARED=&quot;$LDSHARED&quot;
+-                else
++                        # building for OS X 10.0 through 10.2
+                         LDSHARED='$(CC) $(LDFLAGS) -bundle'
+                         if test &quot;$enable_framework&quot; ; then
+                                 # Link against the framework. All externals should be defined.
+@@ -7384,6 +7390,13 @@ then
+                                 BLDSHARED=&quot;$LDSHARED &quot;'-bundle_loader $(BUILDPYTHON)'
+                                 LDSHARED=&quot;$LDSHARED &quot;'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
+                         fi
++                else
++                        # building for OS X 10.3 and later
++                        if test &quot;${enable_universalsdk}&quot;; then
++                                LDFLAGS=&quot;${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}&quot;
++                        fi
++                        LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
++                        BLDSHARED=&quot;$LDSHARED&quot;
+                 fi
+                 ;
+         Linux*|GNU*|QNX*) LDSHARED='$(CC) -shared';;
+Index: configure.in
+===================================================================
+--- configure.in.orig
++++ configure.in
+@@ -1011,8 +1011,14 @@ yes)

+             # Calculate the right deployment target for this build.
+             #
+-            cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
+-            if test ${cur_target} '&gt;' 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=&quot;${cur_target_major}.${cur_target_minor}&quot;
++            if test ${cur_target_major} -eq 10 &amp;&amp; \
++               test ${cur_target_minor} -ge 3
++            then
+                     cur_target=10.3
+                     if test ${enable_universalsdk}; then
+                             if test &quot;${UNIVERSAL_ARCHS}&quot; = &quot;all&quot;; then
+@@ -1809,14 +1815,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} '&gt;' 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 &amp;&amp; \
++                   test ${dep_target_minor} -le 2
+                 then
+-                        if test &quot;${enable_universalsdk}&quot;; then
+-                                LDFLAGS=&quot;${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}&quot;
+-                        fi
+-                        LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
+-                        BLDSHARED=&quot;$LDSHARED&quot;
+-                else
++                        # building for OS X 10.0 through 10.2
+                         LDSHARED='$(CC) $(LDFLAGS) -bundle'
+                         if test &quot;$enable_framework&quot; ; then
+                                 # Link against the framework. All externals should be defined.
+@@ -1827,6 +1833,13 @@ then
+                                 BLDSHARED=&quot;$LDSHARED &quot;'-bundle_loader $(BUILDPYTHON)'
+                                 LDSHARED=&quot;$LDSHARED &quot;'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
+                         fi
++                else
++                        # building for OS X 10.3 and later
++                        if test &quot;${enable_universalsdk}&quot;; then
++                                LDFLAGS=&quot;${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}&quot;
++                        fi
++                        LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
++                        BLDSHARED=&quot;$LDSHARED&quot;
+                 fi
+                 ;
+         Linux*|GNU*|QNX*) LDSHARED='$(CC) -shared';;
</ins></span></pre></div>
<a id="trunkdportslangpython26filesyosemitepythonfixespatch"></a>
<div class="addfile"><h4>Added: trunk/dports/lang/python26/files/yosemite-python-fixes.patch (0 => 125558)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/lang/python26/files/yosemite-python-fixes.patch                                (rev 0)
+++ trunk/dports/lang/python26/files/yosemite-python-fixes.patch        2014-09-21 02:20:50 UTC (rev 125558)
</span><span class="lines">@@ -0,0 +1,91 @@
</span><ins>+Index: Lib/distutils/util.py
+===================================================================
+--- Lib/distutils/util.py.orig
++++ Lib/distutils/util.py
+@@ -132,7 +132,16 @@ def get_platform ():
+             release = macver
+             osname = &quot;macosx&quot;

+-            if (macrelease + '.') &gt;= '10.4.' and \
++            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 &gt;= (10, 4)) and \
+                     '-arch' in get_config_vars().get('CFLAGS', '').strip():
+                 # The universal build will build fat binaries, but not on
+                 # systems before 10.4
+Index: Mac/BuildScript/build-installer.py
+===================================================================
+--- Mac/BuildScript/build-installer.py.orig
++++ Mac/BuildScript/build-installer.py
+@@ -105,14 +105,19 @@ SRCDIR = os.path.dirname(
+ # $MACOSX_DEPLOYMENT_TARGET -&gt; minimum OS X level
+ DEPTARGET = '10.3'

+-target_cc_map = {
++def getDeptargetTuple():
++    return tuple([int(n) for n in DEPTARGET.split('.')[0:2]])
++
++def getTargetCompiler():
++    target_cc_map = {
+         '10.3': 'gcc-4.0',
+         '10.4': 'gcc-4.0',
+         '10.5': 'gcc-4.0',
+         '10.6': 'gcc-4.2',
+-}
++    }
++    return target_cc_map.get(DEPTARGET, 'clang')

+-CC = target_cc_map[DEPTARGET]
++CC = getTargetCompiler()

+ USAGE = textwrap.dedent(&quot;&quot;&quot;\
+     Usage: build_python [options]
+@@ -136,7 +141,7 @@ USAGE = textwrap.dedent(&quot;&quot;&quot;\
+ def library_recipes():
+     result = []

+-    if DEPTARGET &lt; '10.5':
++    if getDeptargetTuple() &lt; (10, 5):
+         result.extend([
+           dict(
+               name=&quot;Bzip2 1.0.5&quot;,
+@@ -307,7 +312,7 @@ def pkg_recipes():
+         ),
+     ]

+-    if DEPTARGET &lt; '10.4':
++    if getDeptargetTuple() &lt; (10, 4):
+         result.append(
+             dict(
+                 name=&quot;PythonSystemFixes&quot;,
+@@ -497,7 +502,7 @@ def parseOptions(args=None):
+     SDKPATH=os.path.abspath(SDKPATH)
+     DEPSRC=os.path.abspath(DEPSRC)

+-    CC=target_cc_map[DEPTARGET]
++    CC=getTargetCompiler()

+     print &quot;Settings:&quot;
+     print &quot; * Source directory:&quot;, SRCDIR
+Index: setup.py
+===================================================================
+--- setup.py.orig
++++ setup.py
+@@ -637,7 +637,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('.') &lt; ['10', '5']:
++            if (dep_target and
++                    (tuple(int(n) for n in dep_target.split('.')[0:2])
++                        &lt; (10, 5) ) ):
+                 os_release = 8
+             if os_release &lt; 9:
+                 # MacOSX 10.4 has a broken readline. Don't try to build
</ins></span></pre>
</div>
</div>

</body>
</html>