Permalink
Browse files

Clean up MacOS version method usage

The MacOS.version? family of methods (other than "leopard?") are poorly
defined and lead to confusing code. Replace them in formulae with more
explicit comparisons.

"MacOS.version" is a special version object that can be compared to
numerics, symbols, and strings using the standard Ruby comparison
methods.

The old methods were moved to compat when the version comparison code
was merged, and they must remain there "forever", but they should not be
used in new code.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
  • Loading branch information...
1 parent db74b9b commit 6b8d25f2d21a3c19ecb0809d619999137cb94565 @jacknagel jacknagel committed Sep 5, 2012
Showing with 94 additions and 90 deletions.
  1. +1 −1 Library/Formula/abyss.rb
  2. +1 −1 Library/Formula/alpine.rb
  3. +1 −1 Library/Formula/aria2.rb
  4. +1 −1 Library/Formula/avidemux.rb
  5. +2 −2 Library/Formula/bind.rb
  6. +1 −1 Library/Formula/cairo.rb
  7. +1 −1 Library/Formula/clisp.rb
  8. +1 −1 Library/Formula/collectd.rb
  9. +1 −1 Library/Formula/couchdb.rb
  10. +1 −1 Library/Formula/disco.rb
  11. +1 −1 Library/Formula/e2fsprogs.rb
  12. +2 −2 Library/Formula/ejabberd.rb
  13. +1 −1 Library/Formula/erlang.rb
  14. +1 −1 Library/Formula/ffmbc.rb
  15. +2 −2 Library/Formula/ffmpeg.rb
  16. +1 −1 Library/Formula/fontforge.rb
  17. +1 −1 Library/Formula/ghc.rb
  18. +1 −1 Library/Formula/git.rb
  19. +1 −1 Library/Formula/gnunet.rb
  20. +1 −1 Library/Formula/google-js-test.rb
  21. +1 −1 Library/Formula/graphicsmagick.rb
  22. +3 −3 Library/Formula/grass.rb
  23. +1 −1 Library/Formula/imap-uw.rb
  24. +1 −1 Library/Formula/iodine.rb
  25. +1 −1 Library/Formula/jstalk.rb
  26. +1 −1 Library/Formula/lftp.rb
  27. +1 −1 Library/Formula/libagg.rb
  28. +1 −1 Library/Formula/libmemcached.rb
  29. +1 −1 Library/Formula/libmms.rb
  30. +1 −1 Library/Formula/librasterlite.rb
  31. +1 −1 Library/Formula/librets.rb
  32. +1 −1 Library/Formula/libvirt.rb
  33. +1 −1 Library/Formula/libxml++.rb
  34. +1 −1 Library/Formula/macvim.rb
  35. +2 −2 Library/Formula/mapserver.rb
  36. +1 −1 Library/Formula/md.rb
  37. +1 −1 Library/Formula/mpd.rb
  38. +2 −2 Library/Formula/mysql.rb
  39. +2 −2 Library/Formula/nmap.rb
  40. +1 −1 Library/Formula/node.rb
  41. +1 −1 Library/Formula/nspr.rb
  42. +1 −1 Library/Formula/nu.rb
  43. +8 −5 Library/Formula/octave.rb
  44. +1 −1 Library/Formula/open-scene-graph.rb
  45. +1 −1 Library/Formula/opencolorio.rb
  46. +1 −1 Library/Formula/phantomjs.rb
  47. +1 −1 Library/Formula/portaudio.rb
  48. +2 −2 Library/Formula/postgresql.rb
  49. +1 −1 Library/Formula/povray.rb
  50. +5 −5 Library/Formula/qt.rb
  51. +1 −1 Library/Formula/rabbitmq.rb
  52. +1 −1 Library/Formula/recode.rb
  53. +1 −1 Library/Formula/rtmpdump.rb
  54. +1 −1 Library/Formula/rtorrent.rb
  55. +1 −1 Library/Formula/sdl.rb
  56. +1 −1 Library/Formula/spidermonkey.rb
  57. +1 −1 Library/Formula/stormfs.rb
  58. +1 −1 Library/Formula/subversion.rb
  59. +1 −1 Library/Formula/swi-prolog.rb
  60. +1 −1 Library/Formula/tcpflow.rb
  61. +1 −1 Library/Formula/texi2html.rb
  62. +1 −1 Library/Formula/trafshow.rb
  63. +1 −1 Library/Formula/vpnc.rb
  64. +1 −1 Library/Formula/wget.rb
  65. +1 −1 Library/Formula/wine.rb
  66. +1 −3 Library/Formula/xmlrpc-c.rb
  67. +1 −1 Library/Formula/ykpers.rb
  68. +1 −0 Library/Homebrew/compat/compatibility.rb
  69. +3 −1 Library/Homebrew/macos.rb
  70. +3 −3 Library/Homebrew/superenv.rb
@@ -11,7 +11,7 @@ class Abyss < Formula
depends_on 'google-sparsehash' => :build
# Snow Leopard comes with mpi but Lion does not
- depends_on 'open-mpi' if MacOS.lion?
+ depends_on 'open-mpi' if MacOS.version >= :lion
# strip breaks the ability to read compressed files.
skip_clean 'bin'
@@ -10,7 +10,7 @@ class Alpine < Formula
# http://trac.macports.org/ticket/20971
def patches
"https://trac.macports.org/export/89747/trunk/dports/mail/alpine/files/alpine-osx-10.6.patch"
- end if MacOS.snow_leopard?
+ end if MacOS.version >= :snow_leopard
def install
ENV.j1
@@ -8,7 +8,7 @@ class Aria2 < Formula
depends_on 'pkg-config' => :build
# Leopard's libxml2 is too old.
- depends_on 'libxml2' if MacOS.leopard?
+ depends_on 'libxml2' if MacOS.version == :leopard
def install
system "./configure", "--disable-dependency-tracking",
@@ -63,7 +63,7 @@ def install
# For 32-bit compilation under gcc 4.2, see:
# http://trac.macports.org/ticket/20938#comment:22
- if MacOS.leopard? or Hardware.is_32_bit?
+ if MacOS.version == :leopard or Hardware.is_32_bit?
inreplace 'cmake/admFFmpegBuild.cmake',
'${CMAKE_INSTALL_PREFIX})',
'${CMAKE_INSTALL_PREFIX} --extra-cflags=-mdynamic-no-pic)'
@@ -6,7 +6,7 @@ class Bind < Formula
version '9.9.1-p2'
sha1 '449b12c32682b5bef64c7b53cd0fc0c6b731c8a7'
- depends_on "openssl" if MacOS.leopard?
+ depends_on "openssl" if MacOS.version == :leopard
def install
ENV.libxml2
@@ -23,7 +23,7 @@ def install
# For Xcode-only systems we help a bit to find openssl.
# If CLT.installed?, it evaluates to "/usr", which works.
- args << "--with-openssl=#{MacOS.sdk_path.to_s}/usr" unless MacOS.leopard?
+ args << "--with-openssl=#{MacOS.sdk_path.to_s}/usr" unless MacOS.version == :leopard
system "./configure", *args
@@ -29,7 +29,7 @@ def install
]
args << '--with-x' unless build.include? 'without-x'
- args << '--enable-xcb=no' if MacOS.leopard?
+ args << '--enable-xcb=no' if MacOS.version == :leopard
system "./configure", *args
system "make install"
@@ -42,7 +42,7 @@ def install
# The ulimit must be set, otherwise `make` will fail and tell you to do so
system "ulimit -s 16384 && make"
- if MacOS.lion?
+ if MacOS.version >= :lion
opoo "`make check` fails on Lion, so we are skipping it."
puts "But it probably means there will be other issues too."
puts "Please take them upstream to the clisp project itself."
@@ -27,7 +27,7 @@ def install
--localstatedir=#{var}
--with-python=/usr/bin]
- args << "--disable-embedded-perl" if MacOS.leopard?
+ args << "--disable-embedded-perl" if MacOS.version == :leopard
system "./configure", *args
system "make install"
@@ -11,7 +11,7 @@ class Couchdb < Formula
depends_on 'spidermonkey'
depends_on 'icu4c'
depends_on 'erlang'
- depends_on 'curl' if MacOS.leopard?
+ depends_on 'curl' if MacOS.version == :leopard
def install
system "./bootstrap" if File.exists? "bootstrap"
@@ -9,7 +9,7 @@ class Disco < Formula
head 'https://github.com/tuulos/disco.git'
depends_on 'erlang'
- depends_on 'simplejson' => :python if MacOS.leopard?
+ depends_on 'simplejson' => :python if MacOS.version == :leopard
depends_on 'libcmph'
def install
@@ -18,7 +18,7 @@ def patches
]}
# MacPorts patch to allow compilation on Leopard.
- if MacOS.leopard?
+ if MacOS.version == :leopard
p[:p0] << "https://trac.macports.org/export/92117/trunk/dports/sysutils/e2fsprogs/files/patch-lib-ext2fs-inline.c.diff"
end
@@ -5,7 +5,7 @@ class Ejabberd < Formula
url "http://www.process-one.net/downloads/ejabberd/2.1.11/ejabberd-2.1.11.tgz"
sha1 'ae2c521d5e93fbd5bc826052c5524b5222dcfae6'
- depends_on "openssl" if MacOS.leopard?
+ depends_on "openssl" if MacOS.version == :leopard
depends_on "erlang"
option "32-bit"
@@ -28,7 +28,7 @@ def install
"--sysconfdir=#{etc}",
"--localstatedir=#{var}"]
- if MacOS.leopard?
+ if MacOS.version == :leopard
openssl = Formula.factory('openssl')
args << "--with-openssl=#{openssl.prefix}"
end
@@ -76,7 +76,7 @@ def install
"--enable-shared-zlib",
"--enable-smp-support"]
- args << "--with-dynamic-trace=dtrace" unless MacOS.leopard?
+ args << "--with-dynamic-trace=dtrace" unless MacOS.version == :leopard
unless build.include? 'disable-hipe'
# HIPE doesn't strike me as that reliable on OS X
@@ -17,7 +17,7 @@ class Ffmbc < Formula
option "with-libvpx", "Enable VP8 video format"
# manpages won't be built without texi2html
- depends_on 'texi2html' => :build if MacOS.mountain_lion?
+ depends_on 'texi2html' => :build if MacOS.version >= :mountain_lion
depends_on 'yasm' => :build
depends_on 'x264' unless build.include? 'without-x264'
@@ -26,7 +26,7 @@ class Ffmpeg < Formula
option 'with-tools', 'Enable additional FFmpeg tools'
# manpages won't be built without texi2html
- depends_on 'texi2html' => :build if MacOS.mountain_lion?
+ depends_on 'texi2html' => :build if MacOS.version >= :mountain_lion
depends_on 'yasm' => :build
depends_on 'x264' unless build.include? 'without-x264'
@@ -79,7 +79,7 @@ def install
# For 32-bit compilation under gcc 4.2, see:
# http://trac.macports.org/ticket/20938#comment:22
- ENV.append_to_cflags "-mdynamic-no-pic" if MacOS.leopard? or Hardware.is_32_bit?
+ ENV.append_to_cflags "-mdynamic-no-pic" if MacOS.version == :leopard or Hardware.is_32_bit?
system "./configure", *args
@@ -31,7 +31,7 @@ def install
# MACOSX_DEPLOYMENT_TARGET fixes ensuing Python 10.7 vs 10.8 clash.
# Discussed: https://github.com/mxcl/homebrew/pull/14097
# Reported: Not yet.
- if MacOS.mountain_lion?
+ if MacOS.version >= :mountain_lion
ENV.macosxsdk("10.7")
ENV.append "CFLAGS", "-isysroot #{MacOS.sdk_path(10.7)}"
ENV["MACOSX_DEPLOYMENT_TARGET"] = "10.8"
@@ -2,7 +2,7 @@
class NeedsSnowLeopard < Requirement
def satisfied?
- MacOS.snow_leopard?
+ MacOS.version >= :snow_leopard
end
def message; <<-EOS.undent
@@ -33,7 +33,7 @@ def install
ENV['PYTHON_PATH'] = which 'python' # python can be brewed or unbrewed
# Clean XCode 4.x installs don't include Perl MakeMaker
- ENV['NO_PERL_MAKEMAKER'] = '1' if MacOS.lion?
+ ENV['NO_PERL_MAKEMAKER'] = '1' if MacOS.version >= :lion
ENV['BLK_SHA1'] = '1' if build.include? 'with-blk-sha1'
@@ -8,7 +8,7 @@ class Gnunet < Formula
depends_on 'libgcrypt'
depends_on 'libextractor'
- depends_on 'curl' unless MacOS.lion? # needs >= v7.20.1
+ depends_on 'curl' if MacOS.version < :lion # needs >= v7.20.1
def install
system "./configure", "--disable-debug",
@@ -6,7 +6,7 @@ def message
end
def satisfied?
- MacOS.snow_leopard?
+ MacOS.version >= :snow_leopard
end
end
@@ -56,7 +56,7 @@ def install
"--prefix=#{prefix}",
"--enable-shared", "--disable-static"]
args << "--without-magick-plus-plus" if build.include? 'without-magick-plus-plus'
- args << "--disable-openmp" if MacOS.leopard? or ENV.compiler == :clang # libgomp unavailable
+ args << "--disable-openmp" if MacOS.version == :leopard or ENV.compiler == :clang # libgomp unavailable
args << "--with-gslib" if ghostscript_srsly?
args << "--with-gs-font-dir=#{HOMEBREW_PREFIX}/share/ghostscript/fonts" \
unless ghostscript_fonts?
@@ -14,7 +14,7 @@ def headless?
#
# This restriction can be lifted once WxMac hits a stable release that is
# 64-bit capable.
- ARGV.include? '--without-gui' or MacOS.lion?
+ ARGV.include? '--without-gui' or MacOS.version >= :lion
end
class Grass < Formula
@@ -31,7 +31,7 @@ class Grass < Formula
depends_on "libtiff"
depends_on "unixodbc"
depends_on "fftw"
- depends_on "cairo" if MacOS.leopard?
+ depends_on "cairo" if MacOS.version == :leopard
depends_on :x11
# Patches ensure 32 bit system python is used for wxWidgets and that files
@@ -101,7 +101,7 @@ def install
end
# Deal with Cairo support
- if MacOS.leopard?
+ if MacOS.version == :leopard
cairo = Formula.factory('cairo')
args << "--with-cairo-includes=#{cairo.include}/cairo"
args << "--with-cairo-libs=#{cairo.lib}"
@@ -6,7 +6,7 @@ class ImapUw < Formula
sha1 '7a82ebd5aae57a5dede96ac4923b63f850ff4fa7'
def patches
- if MacOS.snow_leopard?
+ if MacOS.version >= :snow_leopard
{ :p0 =>
'https://trac.macports.org/export/63088/trunk/dports/mail/imap-uw/files/patch-snowleopard.diff'
}
@@ -6,7 +6,7 @@ class Iodine < Formula
sha1 '4fa9a248b8a84df8a727a5d749e669e58136edca'
def install
- unless MacOS.leopard?
+ unless MacOS.version == :leopard
inreplace ["src/common.c", "src/dns.c", "src/iodine.c", "src/iodined.c"],
"arpa/nameser8_compat", "arpa/nameser_compat"
end
@@ -2,7 +2,7 @@
class NeedsSnowLeopard < Requirement
def satisfied?
- MacOS.snow_leopard?
+ MacOS.version >= :snow_leopard
end
def message
@@ -11,7 +11,7 @@ class Lftp < Formula
def install
# Bus error
- ENV.no_optimization if MacOS.leopard?
+ ENV.no_optimization if MacOS.version == :leopard
system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}"
system "make install"
@@ -11,7 +11,7 @@ class Libagg < Formula
depends_on 'pkg-config' => :build
depends_on 'sdl'
depends_on :freetype => :optional if build.include? "with-freetype"
- depends_on :libtool unless MacOS.mountain_lion?
+ depends_on :libtool unless MacOS.version >= :mountain_lion
fails_with :clang do
build 421
@@ -8,7 +8,7 @@ class Libmemcached < Formula
depends_on 'memcached'
def install
- ENV.append_to_cflags "-undefined dynamic_lookup" if MacOS.leopard?
+ ENV.append_to_cflags "-undefined dynamic_lookup" if MacOS.version == :leopard
system "./configure", "--prefix=#{prefix}"
system "make install"
@@ -10,7 +10,7 @@ class Libmms < Formula
def patches
# see https://trac.macports.org/ticket/27988
- if MacOS.leopard?
+ if MacOS.version == :leopard
{ :p0 => "https://trac.macports.org/export/87883/trunk/dports/multimedia/libmms/files/src_mms-common.h.patch" }
end
end
@@ -5,7 +5,7 @@ class Librasterlite < Formula
url 'http://www.gaia-gis.it/gaia-sins/librasterlite-sources/librasterlite-1.1c.tar.gz'
sha1 'c54f38ef2974bc92410e2c2196088af14bd9c21a'
- depends_on "pkg-config" => :build unless MacOS.mountain_lion?
+ depends_on "pkg-config" => :build unless MacOS.version >= :mountain_lion
depends_on :libpng
depends_on "libgeotiff"
depends_on "libspatialite"
@@ -6,7 +6,7 @@ class Librets < Formula
sha1 '2de4d9e9cb26533eb0a9a090b3354a70ed3c41ec'
depends_on 'boost'
- depends_on 'swig' if MacOS.lion?
+ depends_on 'swig' if MacOS.version >= :lion
def install
system "./configure", "--disable-debug",
@@ -16,7 +16,7 @@ class Libvirt < Formula
depends_on "gnutls"
depends_on "yajl"
- if MacOS.leopard?
+ if MacOS.version == :leopard
# Definitely needed on Leopard, but not on Snow Leopard.
depends_on "readline"
depends_on "libxml2"
@@ -7,7 +7,7 @@ class Libxmlxx < Formula
depends_on 'glibmm'
# LibXML++ can't compile agains the version of LibXML shipped with Leopard
- depends_on 'libxml2' if MacOS.leopard?
+ depends_on 'libxml2' if MacOS.version == :leopard
def install
system "./configure", "--disable-dependency-tracking",
@@ -25,7 +25,7 @@ def install
# If building for 10.8, make sure that CC is set to "clang".
# Reference: https://github.com/b4winckler/macvim/wiki/building
- ENV['CC'] = "clang" if MacOS.mountain_lion?
+ ENV['CC'] = "clang" if MacOS.version >= :mountain_lion
args = %W[
--with-features=huge
@@ -18,7 +18,7 @@ class Mapserver < Formula
depends_on 'gdal'
depends_on 'geos' if build.include? 'with-geos'
- depends_on 'postgresql' if build.include? 'with-postgresql' and not MacOS.lion?
+ depends_on 'postgresql' if build.include? 'with-postgresql' and not MacOS.version >= :lion
depends_on 'fcgi' if build.include? 'with-fastcgi'
def patches
@@ -41,7 +41,7 @@ def install
args << "--with-php=/usr/include/php" if build.include? 'with-php'
if build.include? 'with-postgresql'
- if MacOS.lion? # Lion ships with PostgreSQL libs
+ if MacOS.version >= :lion # Lion ships with PostgreSQL libs
args << "--with-postgis"
else
args << "--with-postgis=#{HOMEBREW_PREFIX}/bin/pg_config"
@@ -6,7 +6,7 @@ class Md < Formula
sha1 '0128de65a4da2ef9655f3b1e6a94d2f8ae292414'
# OS X up to and including Lion 10.7 includes 'md'
- keg_only :provided_by_osx unless MacOS.mountain_lion?
+ keg_only :provided_by_osx unless MacOS.version >= :mountain_lion
def install
cd 'md' do
@@ -36,7 +36,7 @@ def install
"--enable-fluidsynth",
"--enable-zip",
"--enable-lame-encoder"]
- args << "--disable-curl" if MacOS.leopard?
+ args << "--disable-curl" if MacOS.version == :leopard
args << "--enable-lastfm" if build.include?("lastfm")
system "./configure", *args
Oops, something went wrong. Retry.

0 comments on commit 6b8d25f

Please sign in to comment.