Ignore:
Timestamp:
Jun 17, 2012, 8:28:22 PM (7 years ago)
Author:
jmr@…
Message:

add smart python.default_version autoselection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/_resources/port1.0/group/python-1.0.tcl

    r91291 r94386  
    6060options python.versions python.version python.default_version
    6161option_proc python.versions python_set_versions
    62 # py-foo historically meant python24
    63 default python.default_version {24}
     62default python.default_version {[python_get_default_version]}
    6463default python.version {[python_get_version]}
    6564
     
    6968    } else {
    7069        return [option python.default_version]
     70    }
     71}
     72proc python_get_default_version {} {
     73    global python.versions
     74    # py-foo historically meant python24, so we default to that if present
     75    if {[info exists python.versions]} {
     76        if {[lsearch -exact ${python.versions} 24] != -1} {
     77            return 24
     78        } elseif {[lsearch -exact ${python.versions} 27] != -1} {
     79            # this is the actual preferred version
     80            return 27
     81        } else {
     82            return [lindex ${python.versions} end]
     83        }
     84    } else {
     85        return 24
    7186    }
    7287}
Note: See TracChangeset for help on using the changeset viewer.