Skip to content

Commit

Permalink
Deprecate MacOS.version? style methods
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
  • Loading branch information
jacknagel committed Aug 18, 2012
1 parent 5b31fa3 commit ce604c6
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Library/Formula/enscript.rb
Expand Up @@ -8,7 +8,7 @@ class Enscript < Formula

head 'git://git.savannah.gnu.org/enscript.git'

keg_only 'Lion and below provide enscript' unless MacOS::mountain_lion_or_newer?
keg_only :provided_by_osx unless MacOS.version >= :mountain_lion

depends_on 'gettext'

Expand Down
2 changes: 1 addition & 1 deletion Library/Formula/python3.rb
Expand Up @@ -168,7 +168,7 @@ def caveats
See: https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python
EOS

text += tk_caveats unless MacOS.lion_or_newer?
text += tk_caveats unless MacOS.version >= :lion
text += general_caveats
return text
end
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cmd/doctor.rb
Expand Up @@ -796,7 +796,7 @@ def check_git_status
end

def check_for_leopard_ssl
if MacOS.leopard? and not ENV['GIT_SSL_NO_VERIFY']
if MacOS.version == :leopard and not ENV['GIT_SSL_NO_VERIFY']
<<-EOS.undent
The version of libcurl provided with Mac OS X Leopard has outdated
SSL certificates.
Expand Down
19 changes: 19 additions & 0 deletions Library/Homebrew/compat/compatibility.rb
Expand Up @@ -197,4 +197,23 @@ def x11_installed?
def x11_prefix
X11.prefix
end

def leopard?
10.5 == MACOS_VERSION
end

def snow_leopard?
10.6 <= MACOS_VERSION # Actually Snow Leopard or newer
end
alias_method :snow_leopard_or_newer?, :snow_leopard?

def lion?
10.7 <= MACOS_VERSION # Actually Lion or newer
end
alias_method :lion_or_newer?, :lion?

def mountain_lion?
10.8 <= MACOS_VERSION # Actually Mountain Lion or newer
end
alias_method :mountain_lion_or_newer?, :mountain_lion?
end
2 changes: 1 addition & 1 deletion Library/Homebrew/dependencies.rb
Expand Up @@ -63,7 +63,7 @@ def parse_symbol_spec spec, tag
# Xcode no longer provides autotools or some other build tools
Dependency.new(spec.to_s) unless MacOS::Xcode.provides_autotools?
when :libpng, :freetype, :pixman, :fontconfig, :cairo
if MacOS.lion_or_newer?
if MacOS.version >= :lion
MacOS::XQuartz.installed? ? X11Dependency.new(tag) : Dependency.new(spec.to_s)
else
X11Dependency.new(tag)
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/download_strategy.rb
Expand Up @@ -261,7 +261,7 @@ def fetch_repo target, url, revision=nil, ignore_externals=false
svncommand = target.exist? ? 'up' : 'checkout'
args = [svn, svncommand]
# SVN shipped with XCode 3.1.4 can't force a checkout.
args << '--force' unless MacOS.leopard? and svn == '/usr/bin/svn'
args << '--force' unless MacOS.version == :leopard and svn == '/usr/bin/svn'
args << url if !target.exist?
args << target
args << '-r' << revision if revision
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/extend/ENV.rb
Expand Up @@ -9,7 +9,7 @@ def setup_build_environment
delete('CLICOLOR_FORCE') # autotools doesn't like this
remove_cc_etc

if MacOS.mountain_lion?
if MacOS.version >= :mountain_lion
# Fix issue with sed barfing on unicode characters on Mountain Lion.
delete('LC_ALL')
self['LC_CTYPE']="C"
Expand Down
36 changes: 6 additions & 30 deletions Library/Homebrew/macos.rb
Expand Up @@ -8,16 +8,11 @@ def version
end

def cat
if mountain_lion?
:mountainlion
elsif lion?
:lion
elsif snow_leopard?
:snowleopard
elsif leopard?
:leopard
else
nil
if version == :mountain_lion then :mountainlion
elsif version == :lion then :lion
elsif version == :snow_leopard then :snowleopard
elsif version == :leopard then :leopard
else nil
end
end

Expand Down Expand Up @@ -200,27 +195,8 @@ def macports_or_fink_installed?
false
end

def leopard?
10.5 == MACOS_VERSION
end

def snow_leopard?
10.6 <= MACOS_VERSION # Actually Snow Leopard or newer
end
alias :snow_leopard_or_newer? :snow_leopard?

def lion?
10.7 <= MACOS_VERSION # Actually Lion or newer
end
alias :lion_or_newer? :lion?

def mountain_lion?
10.8 <= MACOS_VERSION # Actually Mountain Lion or newer
end
alias :mountain_lion_or_newer? :mountain_lion?

def prefer_64_bit?
Hardware.is_64_bit? and not leopard?
Hardware.is_64_bit? and version != :leopard
end

StandardCompilers = {
Expand Down

0 comments on commit ce604c6

Please sign in to comment.