Skip to content
This repository
Browse code

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...
commit 6b8d25f2d21a3c19ecb0809d619999137cb94565 1 parent db74b9b
Jack Nagel authored September 04, 2012

Showing 70 changed files with 94 additions and 90 deletions. Show diff stats Hide diff stats

  1. 2  Library/Formula/abyss.rb
  2. 2  Library/Formula/alpine.rb
  3. 2  Library/Formula/aria2.rb
  4. 2  Library/Formula/avidemux.rb
  5. 4  Library/Formula/bind.rb
  6. 2  Library/Formula/cairo.rb
  7. 2  Library/Formula/clisp.rb
  8. 2  Library/Formula/collectd.rb
  9. 2  Library/Formula/couchdb.rb
  10. 2  Library/Formula/disco.rb
  11. 2  Library/Formula/e2fsprogs.rb
  12. 4  Library/Formula/ejabberd.rb
  13. 2  Library/Formula/erlang.rb
  14. 2  Library/Formula/ffmbc.rb
  15. 4  Library/Formula/ffmpeg.rb
  16. 2  Library/Formula/fontforge.rb
  17. 2  Library/Formula/ghc.rb
  18. 2  Library/Formula/git.rb
  19. 2  Library/Formula/gnunet.rb
  20. 2  Library/Formula/google-js-test.rb
  21. 2  Library/Formula/graphicsmagick.rb
  22. 6  Library/Formula/grass.rb
  23. 2  Library/Formula/imap-uw.rb
  24. 2  Library/Formula/iodine.rb
  25. 2  Library/Formula/jstalk.rb
  26. 2  Library/Formula/lftp.rb
  27. 2  Library/Formula/libagg.rb
  28. 2  Library/Formula/libmemcached.rb
  29. 2  Library/Formula/libmms.rb
  30. 2  Library/Formula/librasterlite.rb
  31. 2  Library/Formula/librets.rb
  32. 2  Library/Formula/libvirt.rb
  33. 2  Library/Formula/libxml++.rb
  34. 2  Library/Formula/macvim.rb
  35. 4  Library/Formula/mapserver.rb
  36. 2  Library/Formula/md.rb
  37. 2  Library/Formula/mpd.rb
  38. 4  Library/Formula/mysql.rb
  39. 4  Library/Formula/nmap.rb
  40. 2  Library/Formula/node.rb
  41. 2  Library/Formula/nspr.rb
  42. 2  Library/Formula/nu.rb
  43. 13  Library/Formula/octave.rb
  44. 2  Library/Formula/open-scene-graph.rb
  45. 2  Library/Formula/opencolorio.rb
  46. 2  Library/Formula/phantomjs.rb
  47. 2  Library/Formula/portaudio.rb
  48. 4  Library/Formula/postgresql.rb
  49. 2  Library/Formula/povray.rb
  50. 10  Library/Formula/qt.rb
  51. 2  Library/Formula/rabbitmq.rb
  52. 2  Library/Formula/recode.rb
  53. 2  Library/Formula/rtmpdump.rb
  54. 2  Library/Formula/rtorrent.rb
  55. 2  Library/Formula/sdl.rb
  56. 2  Library/Formula/spidermonkey.rb
  57. 2  Library/Formula/stormfs.rb
  58. 2  Library/Formula/subversion.rb
  59. 2  Library/Formula/swi-prolog.rb
  60. 2  Library/Formula/tcpflow.rb
  61. 2  Library/Formula/texi2html.rb
  62. 2  Library/Formula/trafshow.rb
  63. 2  Library/Formula/vpnc.rb
  64. 2  Library/Formula/wget.rb
  65. 2  Library/Formula/wine.rb
  66. 4  Library/Formula/xmlrpc-c.rb
  67. 2  Library/Formula/ykpers.rb
  68. 1  Library/Homebrew/compat/compatibility.rb
  69. 4  Library/Homebrew/macos.rb
  70. 6  Library/Homebrew/superenv.rb
2  Library/Formula/abyss.rb
@@ -11,7 +11,7 @@ class Abyss < Formula
11 11
   depends_on 'google-sparsehash' => :build
12 12
 
13 13
   # Snow Leopard comes with mpi but Lion does not
14  
-  depends_on 'open-mpi' if MacOS.lion?
  14
+  depends_on 'open-mpi' if MacOS.version >= :lion
15 15
 
16 16
   # strip breaks the ability to read compressed files.
17 17
   skip_clean 'bin'
2  Library/Formula/alpine.rb
@@ -10,7 +10,7 @@ class Alpine < Formula
10 10
   # http://trac.macports.org/ticket/20971
11 11
   def patches
12 12
     "https://trac.macports.org/export/89747/trunk/dports/mail/alpine/files/alpine-osx-10.6.patch"
13  
-  end if MacOS.snow_leopard?
  13
+  end if MacOS.version >= :snow_leopard
14 14
 
15 15
   def install
16 16
     ENV.j1
2  Library/Formula/aria2.rb
@@ -8,7 +8,7 @@ class Aria2 < Formula
8 8
   depends_on 'pkg-config' => :build
9 9
 
10 10
   # Leopard's libxml2 is too old.
11  
-  depends_on 'libxml2' if MacOS.leopard?
  11
+  depends_on 'libxml2' if MacOS.version == :leopard
12 12
 
13 13
   def install
14 14
     system "./configure", "--disable-dependency-tracking",
2  Library/Formula/avidemux.rb
@@ -63,7 +63,7 @@ def install
63 63
 
64 64
     # For 32-bit compilation under gcc 4.2, see:
65 65
     # http://trac.macports.org/ticket/20938#comment:22
66  
-    if MacOS.leopard? or Hardware.is_32_bit?
  66
+    if MacOS.version == :leopard or Hardware.is_32_bit?
67 67
       inreplace 'cmake/admFFmpegBuild.cmake',
68 68
         '${CMAKE_INSTALL_PREFIX})',
69 69
         '${CMAKE_INSTALL_PREFIX} --extra-cflags=-mdynamic-no-pic)'
4  Library/Formula/bind.rb
@@ -6,7 +6,7 @@ class Bind < Formula
6 6
   version '9.9.1-p2'
7 7
   sha1 '449b12c32682b5bef64c7b53cd0fc0c6b731c8a7'
8 8
 
9  
-  depends_on "openssl" if MacOS.leopard?
  9
+  depends_on "openssl" if MacOS.version == :leopard
10 10
 
11 11
   def install
12 12
     ENV.libxml2
@@ -23,7 +23,7 @@ def install
23 23
 
24 24
     # For Xcode-only systems we help a bit to find openssl.
25 25
     # If CLT.installed?, it evaluates to "/usr", which works.
26  
-    args << "--with-openssl=#{MacOS.sdk_path.to_s}/usr" unless MacOS.leopard?
  26
+    args << "--with-openssl=#{MacOS.sdk_path.to_s}/usr" unless MacOS.version == :leopard
27 27
 
28 28
     system "./configure", *args
29 29
 
2  Library/Formula/cairo.rb
@@ -29,7 +29,7 @@ def install
29 29
     ]
30 30
 
31 31
     args << '--with-x' unless build.include? 'without-x'
32  
-    args << '--enable-xcb=no' if MacOS.leopard?
  32
+    args << '--enable-xcb=no' if MacOS.version == :leopard
33 33
 
34 34
     system "./configure", *args
35 35
     system "make install"
2  Library/Formula/clisp.rb
@@ -42,7 +42,7 @@ def install
42 42
       # The ulimit must be set, otherwise `make` will fail and tell you to do so
43 43
       system "ulimit -s 16384 && make"
44 44
 
45  
-      if MacOS.lion?
  45
+      if MacOS.version >= :lion
46 46
         opoo "`make check` fails on Lion, so we are skipping it."
47 47
         puts "But it probably means there will be other issues too."
48 48
         puts "Please take them upstream to the clisp project itself."
2  Library/Formula/collectd.rb
@@ -27,7 +27,7 @@ def install
27 27
               --localstatedir=#{var}
28 28
               --with-python=/usr/bin]
29 29
 
30  
-    args << "--disable-embedded-perl" if MacOS.leopard?
  30
+    args << "--disable-embedded-perl" if MacOS.version == :leopard
31 31
 
32 32
     system "./configure", *args
33 33
     system "make install"
2  Library/Formula/couchdb.rb
@@ -11,7 +11,7 @@ class Couchdb < Formula
11 11
   depends_on 'spidermonkey'
12 12
   depends_on 'icu4c'
13 13
   depends_on 'erlang'
14  
-  depends_on 'curl' if MacOS.leopard?
  14
+  depends_on 'curl' if MacOS.version == :leopard
15 15
 
16 16
   def install
17 17
     system "./bootstrap" if File.exists? "bootstrap"
2  Library/Formula/disco.rb
@@ -9,7 +9,7 @@ class Disco < Formula
9 9
   head 'https://github.com/tuulos/disco.git'
10 10
 
11 11
   depends_on 'erlang'
12  
-  depends_on 'simplejson' => :python if MacOS.leopard?
  12
+  depends_on 'simplejson' => :python if MacOS.version == :leopard
13 13
   depends_on 'libcmph'
14 14
 
15 15
   def install
2  Library/Formula/e2fsprogs.rb
@@ -18,7 +18,7 @@ def patches
18 18
     ]}
19 19
 
20 20
     # MacPorts patch to allow compilation on Leopard.
21  
-    if MacOS.leopard?
  21
+    if MacOS.version == :leopard
22 22
       p[:p0] << "https://trac.macports.org/export/92117/trunk/dports/sysutils/e2fsprogs/files/patch-lib-ext2fs-inline.c.diff"
23 23
     end
24 24
 
4  Library/Formula/ejabberd.rb
@@ -5,7 +5,7 @@ class Ejabberd < Formula
5 5
   url "http://www.process-one.net/downloads/ejabberd/2.1.11/ejabberd-2.1.11.tgz"
6 6
   sha1 'ae2c521d5e93fbd5bc826052c5524b5222dcfae6'
7 7
 
8  
-  depends_on "openssl" if MacOS.leopard?
  8
+  depends_on "openssl" if MacOS.version == :leopard
9 9
   depends_on "erlang"
10 10
 
11 11
   option "32-bit"
@@ -28,7 +28,7 @@ def install
28 28
               "--sysconfdir=#{etc}",
29 29
               "--localstatedir=#{var}"]
30 30
 
31  
-      if MacOS.leopard?
  31
+      if MacOS.version == :leopard
32 32
         openssl = Formula.factory('openssl')
33 33
         args << "--with-openssl=#{openssl.prefix}"
34 34
       end
2  Library/Formula/erlang.rb
@@ -76,7 +76,7 @@ def install
76 76
             "--enable-shared-zlib",
77 77
             "--enable-smp-support"]
78 78
 
79  
-    args << "--with-dynamic-trace=dtrace" unless MacOS.leopard?
  79
+    args << "--with-dynamic-trace=dtrace" unless MacOS.version == :leopard
80 80
 
81 81
     unless build.include? 'disable-hipe'
82 82
       # HIPE doesn't strike me as that reliable on OS X
2  Library/Formula/ffmbc.rb
@@ -17,7 +17,7 @@ class Ffmbc < Formula
17 17
   option "with-libvpx", "Enable VP8 video format"
18 18
 
19 19
   # manpages won't be built without texi2html
20  
-  depends_on 'texi2html' => :build if MacOS.mountain_lion?
  20
+  depends_on 'texi2html' => :build if MacOS.version >= :mountain_lion
21 21
   depends_on 'yasm' => :build
22 22
 
23 23
   depends_on 'x264' unless build.include? 'without-x264'
4  Library/Formula/ffmpeg.rb
@@ -26,7 +26,7 @@ class Ffmpeg < Formula
26 26
   option 'with-tools', 'Enable additional FFmpeg tools'
27 27
 
28 28
   # manpages won't be built without texi2html
29  
-  depends_on 'texi2html' => :build if MacOS.mountain_lion?
  29
+  depends_on 'texi2html' => :build if MacOS.version >= :mountain_lion
30 30
   depends_on 'yasm' => :build
31 31
 
32 32
   depends_on 'x264' unless build.include? 'without-x264'
@@ -79,7 +79,7 @@ def install
79 79
 
80 80
     # For 32-bit compilation under gcc 4.2, see:
81 81
     # http://trac.macports.org/ticket/20938#comment:22
82  
-    ENV.append_to_cflags "-mdynamic-no-pic" if MacOS.leopard? or Hardware.is_32_bit?
  82
+    ENV.append_to_cflags "-mdynamic-no-pic" if MacOS.version == :leopard or Hardware.is_32_bit?
83 83
 
84 84
     system "./configure", *args
85 85
 
2  Library/Formula/fontforge.rb
@@ -31,7 +31,7 @@ def install
31 31
     #         MACOSX_DEPLOYMENT_TARGET fixes ensuing Python 10.7 vs 10.8 clash.
32 32
     # Discussed: https://github.com/mxcl/homebrew/pull/14097
33 33
     # Reported:  Not yet.
34  
-    if MacOS.mountain_lion?
  34
+    if MacOS.version >= :mountain_lion
35 35
       ENV.macosxsdk("10.7")
36 36
       ENV.append "CFLAGS", "-isysroot #{MacOS.sdk_path(10.7)}"
37 37
       ENV["MACOSX_DEPLOYMENT_TARGET"] = "10.8"
2  Library/Formula/ghc.rb
@@ -2,7 +2,7 @@
2 2
 
3 3
 class NeedsSnowLeopard < Requirement
4 4
   def satisfied?
5  
-    MacOS.snow_leopard?
  5
+    MacOS.version >= :snow_leopard
6 6
   end
7 7
 
8 8
   def message; <<-EOS.undent
2  Library/Formula/git.rb
@@ -33,7 +33,7 @@ def install
33 33
     ENV['PYTHON_PATH'] = which 'python' # python can be brewed or unbrewed
34 34
 
35 35
     # Clean XCode 4.x installs don't include Perl MakeMaker
36  
-    ENV['NO_PERL_MAKEMAKER'] = '1' if MacOS.lion?
  36
+    ENV['NO_PERL_MAKEMAKER'] = '1' if MacOS.version >= :lion
37 37
 
38 38
     ENV['BLK_SHA1'] = '1' if build.include? 'with-blk-sha1'
39 39
 
2  Library/Formula/gnunet.rb
@@ -8,7 +8,7 @@ class Gnunet < Formula
8 8
 
9 9
   depends_on 'libgcrypt'
10 10
   depends_on 'libextractor'
11  
-  depends_on 'curl' unless MacOS.lion? # needs >= v7.20.1
  11
+  depends_on 'curl' if MacOS.version < :lion # needs >= v7.20.1
12 12
 
13 13
   def install
14 14
     system "./configure", "--disable-debug",
2  Library/Formula/google-js-test.rb
@@ -6,7 +6,7 @@ def message
6 6
   end
7 7
 
8 8
   def satisfied?
9  
-    MacOS.snow_leopard?
  9
+    MacOS.version >= :snow_leopard
10 10
   end
11 11
 end
12 12
 
2  Library/Formula/graphicsmagick.rb
@@ -56,7 +56,7 @@ def install
56 56
             "--prefix=#{prefix}",
57 57
             "--enable-shared", "--disable-static"]
58 58
     args << "--without-magick-plus-plus" if build.include? 'without-magick-plus-plus'
59  
-    args << "--disable-openmp" if MacOS.leopard? or ENV.compiler == :clang # libgomp unavailable
  59
+    args << "--disable-openmp" if MacOS.version == :leopard or ENV.compiler == :clang # libgomp unavailable
60 60
     args << "--with-gslib" if ghostscript_srsly?
61 61
     args << "--with-gs-font-dir=#{HOMEBREW_PREFIX}/share/ghostscript/fonts" \
62 62
               unless ghostscript_fonts?
6  Library/Formula/grass.rb
@@ -14,7 +14,7 @@ def headless?
14 14
   #
15 15
   # This restriction can be lifted once WxMac hits a stable release that is
16 16
   # 64-bit capable.
17  
-  ARGV.include? '--without-gui' or MacOS.lion?
  17
+  ARGV.include? '--without-gui' or MacOS.version >= :lion
18 18
 end
19 19
 
20 20
 class Grass < Formula
@@ -31,7 +31,7 @@ class Grass < Formula
31 31
   depends_on "libtiff"
32 32
   depends_on "unixodbc"
33 33
   depends_on "fftw"
34  
-  depends_on "cairo" if MacOS.leopard?
  34
+  depends_on "cairo" if MacOS.version == :leopard
35 35
   depends_on :x11
36 36
 
37 37
   # Patches ensure 32 bit system python is used for wxWidgets and that files
@@ -101,7 +101,7 @@ def install
101 101
     end
102 102
 
103 103
     # Deal with Cairo support
104  
-    if MacOS.leopard?
  104
+    if MacOS.version == :leopard
105 105
       cairo = Formula.factory('cairo')
106 106
       args << "--with-cairo-includes=#{cairo.include}/cairo"
107 107
       args << "--with-cairo-libs=#{cairo.lib}"
2  Library/Formula/imap-uw.rb
@@ -6,7 +6,7 @@ class ImapUw < Formula
6 6
   sha1 '7a82ebd5aae57a5dede96ac4923b63f850ff4fa7'
7 7
 
8 8
   def patches
9  
-    if MacOS.snow_leopard?
  9
+    if MacOS.version >= :snow_leopard
10 10
       { :p0 =>
11 11
         'https://trac.macports.org/export/63088/trunk/dports/mail/imap-uw/files/patch-snowleopard.diff'
12 12
       }
2  Library/Formula/iodine.rb
@@ -6,7 +6,7 @@ class Iodine < Formula
6 6
   sha1 '4fa9a248b8a84df8a727a5d749e669e58136edca'
7 7
 
8 8
   def install
9  
-    unless MacOS.leopard?
  9
+    unless MacOS.version == :leopard
10 10
       inreplace ["src/common.c", "src/dns.c", "src/iodine.c", "src/iodined.c"],
11 11
         "arpa/nameser8_compat", "arpa/nameser_compat"
12 12
     end
2  Library/Formula/jstalk.rb
@@ -2,7 +2,7 @@
2 2
 
3 3
 class NeedsSnowLeopard < Requirement
4 4
   def satisfied?
5  
-    MacOS.snow_leopard?
  5
+    MacOS.version >= :snow_leopard
6 6
   end
7 7
 
8 8
   def message
2  Library/Formula/lftp.rb
@@ -11,7 +11,7 @@ class Lftp < Formula
11 11
 
12 12
   def install
13 13
     # Bus error
14  
-    ENV.no_optimization if MacOS.leopard?
  14
+    ENV.no_optimization if MacOS.version == :leopard
15 15
 
16 16
     system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}"
17 17
     system "make install"
2  Library/Formula/libagg.rb
@@ -11,7 +11,7 @@ class Libagg < Formula
11 11
   depends_on 'pkg-config' => :build
12 12
   depends_on 'sdl'
13 13
   depends_on :freetype => :optional if build.include? "with-freetype"
14  
-  depends_on :libtool unless MacOS.mountain_lion?
  14
+  depends_on :libtool unless MacOS.version >= :mountain_lion
15 15
 
16 16
   fails_with :clang do
17 17
     build 421
2  Library/Formula/libmemcached.rb
@@ -8,7 +8,7 @@ class Libmemcached < Formula
8 8
   depends_on 'memcached'
9 9
 
10 10
   def install
11  
-    ENV.append_to_cflags "-undefined dynamic_lookup" if MacOS.leopard?
  11
+    ENV.append_to_cflags "-undefined dynamic_lookup" if MacOS.version == :leopard
12 12
 
13 13
     system "./configure", "--prefix=#{prefix}"
14 14
     system "make install"
2  Library/Formula/libmms.rb
@@ -10,7 +10,7 @@ class Libmms < Formula
10 10
 
11 11
   def patches
12 12
     # see https://trac.macports.org/ticket/27988
13  
-    if MacOS.leopard?
  13
+    if MacOS.version == :leopard
14 14
       { :p0 => "https://trac.macports.org/export/87883/trunk/dports/multimedia/libmms/files/src_mms-common.h.patch" }
15 15
     end
16 16
   end
2  Library/Formula/librasterlite.rb
@@ -5,7 +5,7 @@ class Librasterlite < Formula
5 5
   url 'http://www.gaia-gis.it/gaia-sins/librasterlite-sources/librasterlite-1.1c.tar.gz'
6 6
   sha1 'c54f38ef2974bc92410e2c2196088af14bd9c21a'
7 7
 
8  
-  depends_on "pkg-config" => :build unless MacOS.mountain_lion?
  8
+  depends_on "pkg-config" => :build unless MacOS.version >= :mountain_lion
9 9
   depends_on :libpng
10 10
   depends_on "libgeotiff"
11 11
   depends_on "libspatialite"
2  Library/Formula/librets.rb
@@ -6,7 +6,7 @@ class Librets < Formula
6 6
   sha1 '2de4d9e9cb26533eb0a9a090b3354a70ed3c41ec'
7 7
 
8 8
   depends_on 'boost'
9  
-  depends_on 'swig' if MacOS.lion?
  9
+  depends_on 'swig' if MacOS.version >= :lion
10 10
 
11 11
   def install
12 12
     system "./configure", "--disable-debug",
2  Library/Formula/libvirt.rb
@@ -16,7 +16,7 @@ class Libvirt < Formula
16 16
   depends_on "gnutls"
17 17
   depends_on "yajl"
18 18
 
19  
-  if MacOS.leopard?
  19
+  if MacOS.version == :leopard
20 20
     # Definitely needed on Leopard, but not on Snow Leopard.
21 21
     depends_on "readline"
22 22
     depends_on "libxml2"
2  Library/Formula/libxml++.rb
@@ -7,7 +7,7 @@ class Libxmlxx < Formula
7 7
 
8 8
   depends_on 'glibmm'
9 9
   # LibXML++ can't compile agains the version of LibXML shipped with Leopard
10  
-  depends_on 'libxml2' if MacOS.leopard?
  10
+  depends_on 'libxml2' if MacOS.version == :leopard
11 11
 
12 12
   def install
13 13
     system "./configure", "--disable-dependency-tracking",
2  Library/Formula/macvim.rb
@@ -25,7 +25,7 @@ def install
25 25
 
26 26
     # If building for 10.8, make sure that CC is set to "clang".
27 27
     # Reference: https://github.com/b4winckler/macvim/wiki/building
28  
-    ENV['CC'] = "clang" if MacOS.mountain_lion?
  28
+    ENV['CC'] = "clang" if MacOS.version >= :mountain_lion
29 29
 
30 30
     args = %W[
31 31
       --with-features=huge
4  Library/Formula/mapserver.rb
@@ -18,7 +18,7 @@ class Mapserver < Formula
18 18
   depends_on 'gdal'
19 19
 
20 20
   depends_on 'geos' if build.include? 'with-geos'
21  
-  depends_on 'postgresql' if build.include? 'with-postgresql' and not MacOS.lion?
  21
+  depends_on 'postgresql' if build.include? 'with-postgresql' and not MacOS.version >= :lion
22 22
   depends_on 'fcgi' if build.include? 'with-fastcgi'
23 23
 
24 24
   def patches
@@ -41,7 +41,7 @@ def install
41 41
     args << "--with-php=/usr/include/php" if build.include? 'with-php'
42 42
 
43 43
     if build.include? 'with-postgresql'
44  
-      if MacOS.lion? # Lion ships with PostgreSQL libs
  44
+      if MacOS.version >= :lion # Lion ships with PostgreSQL libs
45 45
         args << "--with-postgis"
46 46
       else
47 47
         args << "--with-postgis=#{HOMEBREW_PREFIX}/bin/pg_config"
2  Library/Formula/md.rb
@@ -6,7 +6,7 @@ class Md < Formula
6 6
   sha1 '0128de65a4da2ef9655f3b1e6a94d2f8ae292414'
7 7
 
8 8
   # OS X up to and including Lion 10.7 includes 'md'
9  
-  keg_only :provided_by_osx unless MacOS.mountain_lion?
  9
+  keg_only :provided_by_osx unless MacOS.version >= :mountain_lion
10 10
 
11 11
   def install
12 12
     cd 'md' do
2  Library/Formula/mpd.rb
@@ -36,7 +36,7 @@ def install
36 36
             "--enable-fluidsynth",
37 37
             "--enable-zip",
38 38
             "--enable-lame-encoder"]
39  
-    args << "--disable-curl" if MacOS.leopard?
  39
+    args << "--disable-curl" if MacOS.version == :leopard
40 40
     args << "--enable-lastfm" if build.include?("lastfm")
41 41
 
42 42
     system "./configure", *args
4  Library/Formula/mysql.rb
@@ -13,7 +13,7 @@ class Mysql < Formula
13 13
   end
14 14
 
15 15
   depends_on 'cmake' => :build
16  
-  depends_on 'pidof' unless MacOS.mountain_lion?
  16
+  depends_on 'pidof' unless MacOS.version >= :mountain_lion
17 17
 
18 18
   option :universal
19 19
   option 'with-tests', 'Build with unit tests'
@@ -99,7 +99,7 @@ def install
99 99
     inreplace "#{prefix}/support-files/mysql.server" do |s|
100 100
       s.gsub!(/^(PATH=".*)(")/, "\\1:#{HOMEBREW_PREFIX}/bin\\2")
101 101
       # pidof can be replaced with pgrep from proctools on Mountain Lion
102  
-      s.gsub!(/pidof/, 'pgrep') if MacOS.mountain_lion?
  102
+      s.gsub!(/pidof/, 'pgrep') if MacOS.version >= :mountain_lion
103 103
     end
104 104
     ln_s "#{prefix}/support-files/mysql.server", bin
105 105
   end
4  Library/Formula/nmap.rb
@@ -8,7 +8,7 @@ class Nmap < Formula
8 8
   head 'https://guest:@svn.nmap.org/nmap/', :using => :svn
9 9
 
10 10
   # Leopard's version of OpenSSL isn't new enough
11  
-  depends_on "openssl" if MacOS.leopard?
  11
+  depends_on "openssl" if MacOS.version == :leopard
12 12
 
13 13
   fails_with :llvm do
14 14
     build 2334
@@ -23,7 +23,7 @@ def install
23 23
               --without-zenmap
24 24
               --disable-universal]
25 25
 
26  
-    if MacOS.leopard?
  26
+    if MacOS.version == :leopard
27 27
       openssl = Formula.factory('openssl')
28 28
       args << "--with-openssl=#{openssl.prefix}"
29 29
     end
2  Library/Formula/node.rb
@@ -50,7 +50,7 @@ class Node < Formula
50 50
   head 'https://github.com/joyent/node.git'
51 51
 
52 52
   # Leopard OpenSSL is not new enough, so use our keg-only one
53  
-  depends_on 'openssl' if MacOS.leopard?
  53
+  depends_on 'openssl' if MacOS.version == :leopard
54 54
   depends_on NpmNotInstalled.new unless build.include? 'without-npm'
55 55
   depends_on PythonVersion.new
56 56
 
2  Library/Formula/nspr.rb
@@ -10,7 +10,7 @@ def install
10 10
     cd "mozilla/nsprpub" do
11 11
       # Fixes a bug with linking against CoreFoundation, needed to work with SpiderMonkey
12 12
       # See: http://openradar.appspot.com/7209349
13  
-      target_frameworks = (Hardware.is_32_bit? or MacOS.leopard?) ? "-framework Carbon" : ""
  13
+      target_frameworks = (Hardware.is_32_bit? or MacOS.version == :leopard) ? "-framework Carbon" : ""
14 14
       inreplace "pr/src/Makefile.in", "-framework CoreServices -framework CoreFoundation", target_frameworks
15 15
 
16 16
       args = ["--prefix=#{prefix}", "--disable-debug", "--enable-strip", "--enable-optimize"]
2  Library/Formula/nu.rb
@@ -2,7 +2,7 @@
2 2
 
3 3
 class NeedsLion < Requirement
4 4
   def satisfied?
5  
-    MacOS.lion?
  5
+    MacOS.version >= :lion
6 6
   end
7 7
   def message
8 8
     "Nu requires Mac OS X 10.7 or newer"
13  Library/Formula/octave.rb
... ...
@@ -1,6 +1,9 @@
1 1
 require 'formula'
2 2
 
3  
-def snow_leopard_64?
  3
+# Leading underscore because this method is defined differently
  4
+# in compat, and anything that loads this file would end up with
  5
+# this definition instead!
  6
+def _snow_leopard_64?
4 7
   # 64 bit builds on 10.6 require some special handling.
5 8
   MacOS.version == :snow_leopard and MacOS.prefer_64_bit?
6 9
 end
@@ -28,10 +31,10 @@ class Octave < Formula
28 31
   #   http://www.macresearch.org/lapackblas-fortran-106
29 32
   #
30 33
   # We can work around the issues using dotwrp.
31  
-  depends_on 'dotwrp' if snow_leopard_64?
  34
+  depends_on 'dotwrp' if _snow_leopard_64?
32 35
   # octave refuses to work with BSD readline, so it's either this or --disable-readline
33 36
   depends_on 'readline'
34  
-  depends_on 'curl' if MacOS.leopard? # Leopard's libcurl is too old
  37
+  depends_on 'curl' if MacOS.version == :leopard # Leopard's libcurl is too old
35 38
 
36 39
   # additional features
37 40
   depends_on 'suite-sparse'
@@ -63,11 +66,11 @@ def install
63 66
       "--prefix=#{prefix}",
64 67
       # Cant use `-framework Accelerate` because `mkoctfile`, the tool used to
65 68
       # compile extension packages, can't parse `-framework` flags.
66  
-      "--with-blas=#{'-ldotwrp ' if snow_leopard_64?}-Wl,-framework -Wl,Accelerate",
  69
+      "--with-blas=#{'-ldotwrp ' if _snow_leopard_64?}-Wl,-framework -Wl,Accelerate",
67 70
       # SuiteSparse-4.x.x fix, see http://savannah.gnu.org/bugs/?37031
68 71
       "--with-umfpack=-lumfpack -lsuitesparseconfig",
69 72
     ]
70  
-    args << "--without-framework-carbon" if MacOS.lion?
  73
+    args << "--without-framework-carbon" if MacOS.version >= :lion
71 74
     # avoid spurious 'invalid assignment to cs-list' erorrs on 32 bit installs:
72 75
     args << 'CXXFLAGS=-O0' unless MacOS.prefer_64_bit?
73 76
 
2  Library/Formula/open-scene-graph.rb
@@ -41,7 +41,7 @@ def install
41 41
 
42 42
     args = std_cmake_args
43 43
     args << '-DBUILD_DOCUMENTATION=' + ((build.include? 'docs') ? 'ON' : 'OFF')
44  
-    if snow_leopard_64?
  44
+    if MacOS.prefer_64_bit?
45 45
       args << "-DCMAKE_OSX_ARCHITECTURES=x86_64"
46 46
       args << "-DOSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX=imageio"
47 47
       args << "-DOSG_WINDOWING_SYSTEM=Cocoa"
2  Library/Formula/opencolorio.rb
@@ -36,7 +36,7 @@ def install
36 36
     #   /usr/include
37 37
     # So we just set the sysroot to /
38 38
 
39  
-    args << "-DCMAKE_OSX_SYSROOT=/" if ENV.compiler == :llvm and MacOS.lion?
  39
+    args << "-DCMAKE_OSX_SYSROOT=/" if ENV.compiler == :llvm and MacOS.version >= :lion
40 40
 
41 41
 
42 42
 
2  Library/Formula/phantomjs.rb
@@ -2,7 +2,7 @@
2 2
 
3 3
 class SnowLeopardOrNewer < Requirement
4 4
   def satisfied?
5  
-    MacOS.snow_leopard?
  5
+    MacOS.version >= :snow_leopard
6 6
   end
7 7
 
8 8
   def message
2  Library/Formula/portaudio.rb
@@ -18,7 +18,7 @@ def patches
18 18
     { :p0 =>
19 19
       "https://trac.macports.org/export/94150/trunk/dports/audio/portaudio/files/patch-include__pa_mac_core.h.diff"
20 20
     }
21  
-  end if MacOS.lion?
  21
+  end if MacOS.version >= :lion
22 22
 
23 23
   def install
24 24
     ENV.universal_binary if build.universal?
4  Library/Formula/postgresql.rb
@@ -6,7 +6,7 @@ class Postgresql < Formula
6 6
   sha1 '8411f39e7cff8d691d908de7823b72426433faa2'
7 7
 
8 8
   depends_on 'readline'
9  
-  depends_on 'libxml2' if MacOS.leopard? # Leopard libxml is too old
  9
+  depends_on 'libxml2' if MacOS.version == :leopard # Leopard libxml is too old
10 10
   depends_on 'ossp-uuid' unless build.include? 'without-ossp-uuid'
11 11
 
12 12
   option '32-bit'
@@ -24,7 +24,7 @@ def patches
24 24
   end
25 25
 
26 26
   def install
27  
-    ENV.libxml2 if MacOS.snow_leopard?
  27
+    ENV.libxml2 if MacOS.version >= :snow_leopard
28 28
 
29 29
     args = ["--disable-debug",
30 30
             "--prefix=#{prefix}",
2  Library/Formula/povray.rb
@@ -11,7 +11,7 @@ class Povray < Formula
11 11
   # TODO give this a build number (2326?)
12 12
   fails_with :llvm do
13 13
     cause "povray fails with 'terminate called after throwing an instance of int'"
14  
-  end if MacOS.leopard?
  14
+  end if MacOS.version == :leopard
15 15
 
16 16
   def install
17 17
     system "./configure", "--disable-debug", "--disable-dependency-tracking",
10  Library/Formula/qt.rb
@@ -22,7 +22,7 @@ class Qt < Formula
22 22
   option 'developer', 'Compile and link Qt with developer options'
23 23
 
24 24
   depends_on "d-bus" if build.include? 'with-qtdbus'
25  
-  depends_on 'sqlite' if MacOS.leopard?
  25
+  depends_on 'sqlite' if MacOS.version == :leopard
26 26
 
27 27
   fails_with :clang do
28 28
     build 421
@@ -31,11 +31,11 @@ class Qt < Formula
31 31
   def patches
32 32
     # fixes conflict on osx 10.5. See qt bug:
33 33
     # https://bugreports.qt-project.org/browse/QTBUG-23258
34  
-    if MacOS.leopard?
  34
+    if MacOS.version == :leopard
35 35
       "http://bugreports.qt-project.org/secure/attachment/26712/Patch-Qt-4.8-for-10.5"
36 36
     # add support for Mountain Lion
37 37
     # should be unneeded for 4.8.3
38  
-    elsif MacOS.mountain_lion?
  38
+    elsif MacOS.version >= :mountain_lion
39 39
       [ "https://qt.gitorious.org/qt/qt/commit/422f1b?format=patch",
40 40
         "https://qt.gitorious.org/qt/qt/commit/665355?format=patch",
41 41
         "https://raw.github.com/gist/3187034/893252db0ae3bb9bb5fa3ff7c530c7978399b101/0001-Fix-WebKit-on-OS-X-Mountain-Lion.patch" ]
@@ -46,7 +46,7 @@ def patches
46 46
   def install
47 47
     # Apply binary git patch; normal patch ignores this.
48 48
     # TODO: Autodetect binary patches and apply them correctly.
49  
-    system "git apply --exclude=*/QtWebKit.pro 002-homebrew.diff" if MacOS.mountain_lion?
  49
+    system "git apply --exclude=*/QtWebKit.pro 002-homebrew.diff" if MacOS.version >= :mountain_lion
50 50
 
51 51
     ENV.append "CXXFLAGS", "-fvisibility=hidden"
52 52
     args = ["-prefix", prefix,
@@ -55,7 +55,7 @@ def install
55 55
             "-cocoa", "-fast" ]
56 56
 
57 57
     # See: https://github.com/mxcl/homebrew/issues/issue/744
58  
-    args << "-system-sqlite" if MacOS.leopard?
  58
+    args << "-system-sqlite" if MacOS.version == :leopard
59 59
 
60 60
     args << "-plugin-sql-mysql" if (HOMEBREW_CELLAR+"mysql").directory?
61 61
 
2  Library/Formula/rabbitmq.rb
@@ -6,7 +6,7 @@ class Rabbitmq < Formula
6 6
   sha1 '50ad453ae6a293c7b314dd2dd24a29648f1acc11'
7 7
 
8 8
   depends_on 'erlang'
9  
-  depends_on 'simplejson' => :python if MacOS.leopard?
  9
+  depends_on 'simplejson' => :python if MacOS.version == :leopard
10 10
 
11 11
   def install
12 12
     # Install the base files
2  Library/Formula/recode.rb
@@ -19,7 +19,7 @@ def copy_libtool_files!
19 19
       s = Formula.factory('libtool').share
20 20
       d = "#{s}/libtool/config"
21 21
       cp ["#{d}/config.guess", "#{d}/config.sub"], "."
22  
-    elsif MacOS.leopard?
  22
+    elsif MacOS.version == :leopard
23 23
       cp Dir["#{MacOS::Xcode.prefix}/usr/share/libtool/config.*"], "."
24 24
     else
25 25
       cp Dir["#{MacOS::Xcode.prefix}/usr/share/libtool/config/config.*"], "."
2  Library/Formula/rtmpdump.rb
@@ -7,7 +7,7 @@ class Rtmpdump < Formula
7 7
 
8 8
   head 'git://git.ffmpeg.org/rtmpdump'
9 9
 
10  
-  depends_on 'openssl' if MacOS.leopard?
  10
+  depends_on 'openssl' if MacOS.version == :leopard
11 11
 
12 12
   fails_with :llvm do
13 13
     build '2336'
2  Library/Formula/rtorrent.rb
@@ -13,7 +13,7 @@ class Rtorrent < Formula
13 13
   def install
14 14
     args = ["--disable-debug", "--disable-dependency-tracking", "--prefix=#{prefix}"]
15 15
     args << "--with-xmlrpc-c" if Formula.factory("xmlrpc-c").installed?
16  
-    if MacOS.leopard?
  16
+    if MacOS.version == :leopard
17 17
       inreplace 'configure' do |s|
18 18
         s.gsub! '  pkg_cv_libcurl_LIBS=`$PKG_CONFIG --libs "libcurl >= 7.15.4" 2>/dev/null`',
19 19
           '  pkg_cv_libcurl_LIBS=`$PKG_CONFIG --libs "libcurl >= 7.15.4" | sed -e "s/-arch [^-]*/-arch $(uname -m) /" 2>/dev/null`'
2  Library/Formula/sdl.rb
@@ -25,7 +25,7 @@ def install
25 25
     system "./autogen.sh" if build.head?
26 26
 
27 27
     args = %W[--prefix=#{prefix}]
28  
-    args << "--disable-nasm" unless MacOS.mountain_lion? # might work with earlier, might only work with new clang
  28
+    args << "--disable-nasm" unless MacOS.version >= :mountain_lion # might work with earlier, might only work with new clang
29 29
     # LLVM-based compilers choke on the assembly code packaged with SDL.
30 30
     args << '--disable-assembly' if ENV.compiler == :llvm or ENV.compiler == :clang and MacOS.clang_build_version < 421
31 31
     args << '--without-x'
2  Library/Formula/spidermonkey.rb
@@ -24,7 +24,7 @@ class Spidermonkey < Formula
24 24
   def install
25 25
     # aparently this flag causes the build to fail for ivanvc on 10.5 with a
26 26
     # penryn (core 2 duo) CPU. So lets be cautious here and remove it.
27  
-    ENV['CFLAGS'] = ENV['CFLAGS'].gsub(/-msse[^\s]+/, '') if MacOS.leopard?
  27
+    ENV['CFLAGS'] = ENV['CFLAGS'].gsub(/-msse[^\s]+/, '') if MacOS.version == :leopard
28 28
 
29 29
     # For some reason SpiderMonkey requires Autoconf-2.13
30 30
     ac213_prefix = buildpath/'ac213'
2  Library/Formula/stormfs.rb
@@ -8,7 +8,7 @@ class Stormfs < Formula
8 8
   depends_on 'pkg-config' => :build
9 9
   depends_on 'glib'
10 10
   depends_on 'fuse4x'
11  
-  depends_on 'curl' if MacOS.leopard?
  11
+  depends_on 'curl' if MacOS.version == :leopard
12 12
 
13 13
   def install
14 14
     system "./configure", "--disable-debug", "--disable-dependency-tracking",
2  Library/Formula/subversion.rb
@@ -165,7 +165,7 @@ def install
165 165
       # Remove hard-coded ppc target, add appropriate ones
166 166
       if build.universal?
167 167
         arches = "-arch x86_64 -arch i386"
168  
-      elsif MacOS.leopard?
  168
+      elsif MacOS.version == :leopard
169 169
         arches = "-arch i386"
170 170
       else
171 171
         arches = "-arch x86_64"
2  Library/Formula/swi-prolog.rb
@@ -21,7 +21,7 @@ class SwiProlog < Formula
21 21
   end
22 22
 
23 23
   # 10.5 versions of these are too old
24  
-  if MacOS.leopard?
  24
+  if MacOS.version == :leopard
25 25
     depends_on 'fontconfig'
26 26
     depends_on 'expat'
27 27
   end
2  Library/Formula/tcpflow.rb
@@ -12,7 +12,7 @@ def copy_libtool_files!
12 12
       s = Formula.factory('libtool').share
13 13
       d = "#{s}/libtool/config"
14 14
       cp ["#{d}/config.guess", "#{d}/config.sub"], "."
15  
-    elsif MacOS.leopard?
  15
+    elsif MacOS.version == :leopard
16 16
       cp Dir["#{MacOS::Xcode.prefix}/usr/share/libtool/config.*"], "."
17 17
     else
18 18
       cp Dir["#{MacOS::Xcode.prefix}/usr/share/libtool/config/config.*"], "."
2  Library/Formula/texi2html.rb
@@ -5,7 +5,7 @@ class Texi2html < Formula
5 5
   url 'http://download.savannah.gnu.org/releases/texi2html/texi2html-1.70.tar.gz'
6 6
   sha1 'b3472fb5ef80824177a56a1a37983c13497b23be'
7 7
 
8  
-  keg_only :provided_by_osx unless MacOS.mountain_lion?
  8
+  keg_only :provided_by_osx unless MacOS.version >= :mountain_lion
9 9
 
10 10
   def install
11 11
     system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}",
2  Library/Formula/trafshow.rb
@@ -20,7 +20,7 @@ def copy_libtool_files!
20 20
       s = Formula.factory('libtool').share
21 21
       d = "#{s}/libtool/config"
22 22
       cp ["#{d}/config.guess", "#{d}/config.sub"], "."
23  
-    elsif MacOS.leopard?
  23
+    elsif MacOS.version == :leopard
24 24
       cp Dir["#{MacOS::Xcode.prefix}/usr/share/libtool/config.*"], "."
25 25
     else
26 26
       cp Dir["#{MacOS::Xcode.prefix}/usr/share/libtool/config/config.*"], "."
2  Library/Formula/vpnc.rb
@@ -16,7 +16,7 @@ class Vpnc < Formula
16 16
 
17 17
   # Patch from user @Imagesafari to enable compilation on Lion
18 18
   def patches
19  
-    DATA if MacOS.lion?
  19
+    DATA if MacOS.version >= :lion
20 20
   end
21 21
 
22 22
   def install
2  Library/Formula/wget.rb
@@ -14,7 +14,7 @@ class Wget < Formula
14 14
   option "enable-iri", "Enable iri support"
15 15
   option "enable-debug", "Build with debug support"
16 16
 
17  
-  depends_on "openssl" if MacOS.leopard?
  17
+  depends_on "openssl" if MacOS.version == :leopard
18 18
   depends_on "libidn" if build.include? "enable-iri"
19 19
 
20 20
   if build.head?
2  Library/Formula/wine.rb
@@ -72,7 +72,7 @@ def install
72 72
             "--with-x",
73 73
             "--with-coreaudio",
74 74
             "--with-opengl"]
75  
-    args << "--disable-win16" if MacOS.leopard? or ENV.compiler == :clang
  75
+    args << "--disable-win16" if MacOS.version == :leopard or ENV.compiler == :clang
76 76
 
77 77
     # 64-bit builds of mpg123 are incompatible with 32-bit builds of Wine
78 78
     args << "--without-mpg123" if Hardware.is_64_bit?
4  Library/Formula/xmlrpc-c.rb
@@ -9,9 +9,7 @@ def patches
9 9
     # Backport patch for deprecated curl/types.h include, which is gone on 10.8
10 10
     # On 10.6 and 10.7 it's empty, so could probably patch unconditionally
11 11
     # see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=636457#10
12  
-    if MacOS.mountain_lion?
13  
-      DATA
14  
-    end
  12
+    DATA if MacOS.version >= :mountain_lion
15 13
   end
16 14
 
17 15
   def install
2  Library/Formula/ykpers.rb
@@ -12,7 +12,7 @@ class Ykpers < Formula
12 12
   def patches
13 13
     {:p0 =>
14 14
     "https://trac.macports.org/export/96037/trunk/dports/security/ykpers/files/patch-pre-Lion-strnlen.diff"
15  
-    } unless MacOS.lion?
  15
+    } unless MacOS.version >= :lion
16 16
   end
17 17
 
18 18
   def install
1  Library/Homebrew/compat/compatibility.rb
@@ -165,6 +165,7 @@ def handle_failure
165 165
   end
166 166
 end
167 167
 
  168
+# TODO eventually some of these should print deprecation warnings
168 169
 module MacOS extend self
169 170
   def xcode_folder
170 171
     Xcode.folder
4  Library/Homebrew/macos.rb
... ...
@@ -1,5 +1,7 @@
1 1
 module MacOS extend self
2 2
 
  3
+  # This can be compared to numerics, strings, or symbols
  4
+  # using the standard Ruby Comparable methods.
3 5
   def version
4 6
     require 'version'
5 7
     MacOSVersion.new(MACOS_VERSION.to_s)
@@ -221,7 +223,7 @@ def pkgutil_info id
221 223
 
222 224
   def bottles_supported?
223 225
     # We support bottles on all versions of OS X except 32-bit Snow Leopard.
224  
-    (Hardware.is_64_bit? or not MacOS.snow_leopard?) \
  226
+    (Hardware.is_64_bit? or not MacOS.version >= :snow_leopard) \
225 227
       and HOMEBREW_PREFIX.to_s == '/usr/local' \
226 228
       and HOMEBREW_CELLAR.to_s == '/usr/local/Cellar' \
227 229
   end
6  Library/Homebrew/superenv.rb
@@ -119,7 +119,7 @@ def determine_pkg_config_path
119 119
     # we put our paths before X because we dupe some of the X libraries
120 120
     paths << "#{MacSystem.x11_prefix}/lib/pkgconfig" << "#{MacSystem.x11_prefix}/share/pkgconfig" if x11?
121 121
     # Mountain Lion no longer ships some .pcs; ensure we pick up our versions
122  
-    paths << "#{HOMEBREW_REPOSITORY}/Library/Homebrew/pkgconfig" if MacOS.mountain_lion?
  122
+    paths << "#{HOMEBREW_REPOSITORY}/Library/Homebrew/pkgconfig" if MacOS.version >= :mountain_lion
123 123
     paths.to_path_s
124 124
   end
125 125
 
@@ -173,9 +173,9 @@ def determine_cccfg
173 173
     s = ""
174 174
     s << 'b' if ARGV.build_bottle?
175 175
     # Fix issue with sed barfing on unicode characters on Mountain Lion
176  
-    s << 's' if MacOS.mountain_lion?
  176
+    s << 's' if MacOS.version >= :mountain_lion
177 177
     # Fix issue with 10.8 apr-1-config having broken paths
178  
-    s << 'a' if MacOS.cat == :mountainlion
  178
+    s << 'a' if MacOS.version == :mountain_lion
179 179
     s
180 180
   end
181 181
 

0 notes on commit 6b8d25f

Please sign in to comment.
Something went wrong with that request. Please try again.