[90071] trunk/base/src/macports1.0/macports.tcl
jberry at macports.org
jberry at macports.org
Mon Feb 20 14:23:51 PST 2012
Revision: 90071
http://trac.macports.org/changeset/90071
Author: jberry at macports.org
Date: 2012-02-20 14:23:51 -0800 (Mon, 20 Feb 2012)
Log Message:
-----------
Add additional robustness to Xcode search.
- In the event that mdfind fails to find anything, also look for Xcode.app in /Applications and /Developer/Applications
- If no Xcode.app is found, present a message to the user asking them to install it.
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-20 21:54:35 UTC (rev 90070)
+++ trunk/base/src/macports1.0/macports.tcl 2012-02-20 22:23:51 UTC (rev 90071)
@@ -439,6 +439,7 @@
}
# The directory from xcode-select isn't correct.
+
# Ask mdfind where Xcode is and make some suggestions for the user,
# searching by bundle identifier for various Xcode versions (3.x and 4.x)
set installed_xcodes {}
@@ -448,15 +449,26 @@
[exec $mdfind "kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode'"] \
]
}
+
+ # In case mdfind metadata wasn't complete, also look in two well-known locations for Xcode.app
+ foreach app {/Applications/Xcode.app /Developer/Applications/Xcode.app} {
+ if {[file isdirectory $app]} {
+ lappend installed_xcodes $app
+ }
+ }
+
+ # Form a list of unique xcode installations
+ set installed_xcodes [lsort -unique $installed_xcodes]
+
+ # Present instructions to the user
+ ui_error
if {[llength $installed_xcodes] > 0 && ![catch {findBinary mdls $macports::autoconf::mdls_path} 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 {
set vers [exec $mdls -raw -name kMDItemVersion $xcode]
- if { $vers == "(null)" } { set vers "unknown" }
+ if {$vers == "(null)"} { 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}/../.."]} {
@@ -465,8 +477,11 @@
ui_error " # malformed Xcode at ${xcode}, version ${vers}"
}
}
- ui_error
+ } else {
+ ui_error "No Xcode installation was found."
+ ui_error "Please install Xcode and run xcode-select to specify its location."
}
+ ui_error
}
# Try the default
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120220/f7c16fda/attachment.html>
More information about the macports-changes
mailing list