From 65567eb55fc97925b023737456b1e989d48d68f2 Mon Sep 17 00:00:00 2001 From: Camillo Lugaresi Date: Wed, 6 Jun 2012 22:29:52 +0200 Subject: [PATCH] add method to find XQuartz version --- Library/Homebrew/macos.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Library/Homebrew/macos.rb b/Library/Homebrew/macos.rb index 632077dbf2..c0d31e6fed 100644 --- a/Library/Homebrew/macos.rb +++ b/Library/Homebrew/macos.rb @@ -5,6 +5,8 @@ module MacOS extend self XCODE_3_BUNDLE_ID = "com.apple.Xcode" CLT_STANDALONE_PKG_ID = "com.apple.pkg.DeveloperToolsCLILeo" CLT_FROM_XCODE_PKG_ID = "com.apple.pkg.DeveloperToolsCLI" + APPLE_X11_BUNDLE_ID = "org.x.X11" + XQUARTZ_BUNDLE_ID = "org.macosforge.xquartz.X11" def version MACOS_VERSION @@ -313,6 +315,16 @@ module MacOS extend self end end + def xquartz_version + # This returns the version number of XQuartz, not of the upstream X.org + # (which is why it is not called x11_version). Note that the X11.app + # distributed by Apple is also XQuartz, and therefore covered by this method. + path = app_with_bundle_id(XQUARTZ_BUNDLE_ID) or app_with_bundle_id(APPLE_X11_BUNDLE_ID) + version = if not path.nil? and path.exist? + `mdls -raw -name kMDItemVersion #{path}`.strip + end + end + def x11_prefix @x11_prefix ||= if Pathname.new('/opt/X11/lib/libpng.dylib').exist? Pathname.new('/opt/X11')