[90018] trunk/base/src/macports1.0/macports.tcl

jberry at macports.org jberry at macports.org
Sun Feb 19 12:08:13 PST 2012


Revision: 90018
          http://trac.macports.org/changeset/90018
Author:   jberry at macports.org
Date:     2012-02-19 12:08:13 -0800 (Sun, 19 Feb 2012)
Log Message:
-----------
Show proper xcode-select statement for the xcode discovered, depending on whether it's newer or older than verson 4.3

Modified Paths:
--------------
    trunk/base/src/macports1.0/macports.tcl

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2012-02-19 20:04:24 UTC (rev 90017)
+++ trunk/base/src/macports1.0/macports.tcl	2012-02-19 20:08:13 UTC (rev 90018)
@@ -442,14 +442,22 @@
         if {![catch {findBinary mdfind /usr/bin/mdfind} mdfind]} {
             set installed_xcodes [exec $mdfind "kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode'"]
         }
-        if {[llength $installed_xcodes] > 0} {
+        if {[llength $installed_xcodes] > 0 && ![catch {findBinary mdls /usr/bin/mdls} mdls]} {
             # One, or more than one, Xcode installations found
             ui_error "No valid Xcode installation is properly selected."
-
+            
             ui_error
             ui_error "Please use xcode-select to select an Xcode installation:"
             foreach xcode $installed_xcodes {
-                ui_error "    sudo xcode-select -switch ${xcode}"
+                regexp {kMDItemVersion = "([\d.]+)"} [exec $mdls -name kMDItemVersion $xcode] match vers
+                if {![info exists vers]} { set vers "unknown" }
+                if {[vercmp $vers 4.3] >= 0 || [_is_valid_developer_dir "${xcode}/Contents/Developer"]} {
+                    ui_error "    sudo xcode-select -switch ${xcode} # version ${vers}"
+                } elseif {[_is_valid_developer_dir "${xcode}/../.."]} {
+                    ui_error "    sudo xcode-select -switch [file normalize ${xcode}/../..] # version ${vers}"
+                } else {
+                    ui_error "    # malformed xcode at ${xcode}, version ${vers}"
+                }
             }
             ui_error
         }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120219/7f13305b/attachment.html>


More information about the macports-changes mailing list