[94386] trunk/dports/_resources/port1.0/group/python-1.0.tcl

jmr at macports.org jmr at macports.org
Sun Jun 17 13:28:26 PDT 2012


Revision: 94386
          https://trac.macports.org/changeset/94386
Author:   jmr at macports.org
Date:     2012-06-17 13:28:22 -0700 (Sun, 17 Jun 2012)
Log Message:
-----------
add smart python.default_version autoselection

Modified Paths:
--------------
    trunk/dports/_resources/port1.0/group/python-1.0.tcl

Modified: trunk/dports/_resources/port1.0/group/python-1.0.tcl
===================================================================
--- trunk/dports/_resources/port1.0/group/python-1.0.tcl	2012-06-17 19:28:44 UTC (rev 94385)
+++ trunk/dports/_resources/port1.0/group/python-1.0.tcl	2012-06-17 20:28:22 UTC (rev 94386)
@@ -59,8 +59,7 @@
 
 options python.versions python.version python.default_version
 option_proc python.versions python_set_versions
-# py-foo historically meant python24
-default python.default_version {24}
+default python.default_version {[python_get_default_version]}
 default python.version {[python_get_version]}
 
 proc python_get_version {} {
@@ -70,6 +69,22 @@
         return [option python.default_version]
     }
 }
+proc python_get_default_version {} {
+    global python.versions
+    # py-foo historically meant python24, so we default to that if present
+    if {[info exists python.versions]} {
+        if {[lsearch -exact ${python.versions} 24] != -1} {
+            return 24
+        } elseif {[lsearch -exact ${python.versions} 27] != -1} {
+            # this is the actual preferred version
+            return 27
+        } else {
+            return [lindex ${python.versions} end]
+        }
+    } else {
+        return 24
+    }
+}
 
 proc python_set_versions {option action args} {
     if {$action != "set"} {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120617/70ce927e/attachment.html>


More information about the macports-changes mailing list