Skip to content

Commit

Permalink
Use new requirement syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
jacknagel committed Jan 21, 2013
1 parent 0accd80 commit 60003ee
Show file tree
Hide file tree
Showing 33 changed files with 77 additions and 118 deletions.
5 changes: 2 additions & 3 deletions Formula/appledoc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
class LionOrNewer < Requirement
fatal true

def satisfied?
MacOS.version >= :lion
end
satisfy MacOS.version >= :lion

def message
"Appledoc requires Mac OS X 10.7 (Lion) or newer."
end
Expand Down
6 changes: 2 additions & 4 deletions Formula/avian.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
class JdkInstalled < Requirement
fatal true

satisfy { which 'javac' }

def message; <<-EOS.undent
A JDK is required.
You can get the official Oracle installers from:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
EOS
end

def satisfied?
which 'javac'
end
end

class Avian < Formula
Expand Down
5 changes: 2 additions & 3 deletions Formula/boost.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ def boost_layout
end

class UniversalPython < Requirement
satisfy { archs_for_command("python").universal? }

def message; <<-EOS.undent
A universal build was requested, but Python is not a universal build
Boost compiles against the Python it finds in the path; if this Python
is not a universal build then linking will likely fail.
EOS
end
def satisfied?
archs_for_command("python").universal?
end
end

class Boost < Formula
Expand Down
5 changes: 2 additions & 3 deletions Formula/boost149.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
require 'formula'

class UniversalPython < Requirement
satisfy { archs_for_command("python").universal? }

def message; <<-EOS.undent
A universal build was requested, but Python is not a universal build
Boost compiles against the Python it finds in the path; if this Python
is not a universal build then linking will likely fail.
EOS
end
def satisfied?
archs_for_command("python").universal?
end
end

class Boost149 < Formula
Expand Down
7 changes: 4 additions & 3 deletions Formula/cmake.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
require 'formula'

class NoExpatFramework < Requirement
satisfy :build_env => false do
not File.exist? "/Library/Frameworks/expat.framework"
end

def message; <<-EOS.undent
Detected /Library/Frameworks/expat.framework
Expand All @@ -10,9 +14,6 @@ def message; <<-EOS.undent
You may need to move this file out of the way to compile CMake.
EOS
end
def satisfied?
not File.exist? "/Library/Frameworks/expat.framework"
end
end


Expand Down
5 changes: 2 additions & 3 deletions Formula/cmu-sphinxbase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
class HomebrewedPython < Requirement
fatal true

satisfy(:build_env => false) { Formula.factory('python').installed? }

def message; <<-EOS.undent
Compiling against the system-provided Python will likely fail.
The system-provided Python includes PPC support, which will cause a compiler
Expand All @@ -11,9 +13,6 @@ def message; <<-EOS.undent
Patches to correct this issue are welcome.
EOS
end
def satisfied?
Formula.factory('python').installed?
end
end

class CmuSphinxbase < Formula
Expand Down
12 changes: 6 additions & 6 deletions Formula/coq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
class TransitionalMode < Requirement
fatal true

satisfy do
# If not installed, it will install in the correct mode.
# If installed, make sure it is transitional instead of strict.
!which('camlp5') || `camlp5 -pmode 2>&1`.chomp == 'transitional'
end

def message; <<-EOS.undent
camlp5 must be compiled in transitional mode (instead of --strict mode):
brew install camlp5
EOS
end
def satisfied?
# If not installed, it will install in the correct mode.
return true if not which('camlp5')
# If installed, make sure it is transitional instead of strict.
`camlp5 -pmode 2>&1`.chomp == 'transitional'
end
end

class Coq < Formula
Expand Down
6 changes: 2 additions & 4 deletions Formula/cvs2svn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
class PythonWithGdbm < Requirement
fatal true

satisfy { quiet_system "python", "-c", "import gdbm" }

def message; <<-EOS.undent
The Python being used does not include gdbm support,
but it is required to build this formula:
Expand All @@ -12,10 +14,6 @@ def message; <<-EOS.undent
Homebrew's Python includes gdbm support.
EOS
end

def satisfied?
quiet_system "python", "-c", "import gdbm"
end
end

class Cvs2svn < Formula
Expand Down
5 changes: 2 additions & 3 deletions Formula/diffpdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
class PopplerQt4 < Requirement
fatal true

def satisfied?
poppler = Tab.for_formula 'poppler'
poppler.installed_with? '--with-qt4'
satisfy :build_env => false do
Tab.for_formula("poppler").installed_with? "--with-qt4"
end

def message; <<-EOS.undent
Expand Down
4 changes: 1 addition & 3 deletions Formula/drizzle.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
require 'formula'

class LionOrNewer < Requirement
def satisfied?
MacOS.version >= :lion
end
satisfy MacOS.version >= :lion

def message
"Drizzle requires Mac OS X 10.7 (Lion) or newer."
Expand Down
6 changes: 2 additions & 4 deletions Formula/dsniff.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
require 'formula'

class NoBdb5 < Requirement
satisfy(:build_env => false) { !Formula.factory("berkeley-db").installed? }

def message; <<-EOS.undent
This software can fail to compile when Berkeley-DB 5.x is installed.
You may need to try:
Expand All @@ -9,10 +11,6 @@ def message; <<-EOS.undent
brew link berkeley-db
EOS
end
def satisfied?
f = Formula.factory("berkeley-db")
not f.installed?
end
end

class Dsniff < Formula
Expand Down
6 changes: 2 additions & 4 deletions Formula/elixir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
class ErlangInstalled < Requirement
fatal true

satisfy { which 'erl' }

def message; <<-EOS.undent
Erlang is required to install.
Expand All @@ -13,10 +15,6 @@ def message; <<-EOS.undent
http://www.erlang.org/
EOS
end

def satisfied?
which 'erl'
end
end

class Elixir < Formula
Expand Down
4 changes: 1 addition & 3 deletions Formula/ghc.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
require 'formula'

class NeedsSnowLeopard < Requirement
def satisfied?
MacOS.version >= :snow_leopard
end
satisfy MacOS.version >= :snow_leopard

def message; <<-EOS.undent
GHC requires OS X 10.6 or newer. The binary releases no longer work on
Expand Down
5 changes: 2 additions & 3 deletions Formula/git-hg.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
require 'formula'

class HgInstalled < Requirement
satisfy { which 'hg' }

def message; <<-EOS.undent
Mercurial is required to use this software.
Expand All @@ -11,9 +13,6 @@ def message; <<-EOS.undent
http://mercurial.selenic.com/
EOS
end
def satisfied?
which 'hg'
end
end

class GitHg < Formula
Expand Down
6 changes: 2 additions & 4 deletions Formula/google-js-test.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
require 'formula'

class NeedsSnowLeopard < Requirement
satisfy MacOS.version >= :snow_leopard

def message
"Google JS Test requires Mac OS X 10.6 (Snow Leopard) or newer."
end

def satisfied?
MacOS.version >= :snow_leopard
end
end

class GoogleJsTest < Formula
Expand Down
4 changes: 1 addition & 3 deletions Formula/hyperestraier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ def initialize
@mecab_ipadic_installed = Formula.factory('mecab-ipadic').installed?
end

def satisfied?
@mecab_ipadic_installed && mecab_dic_charset == 'euc'
end
satisfy { @mecab_ipadic_installed && mecab_dic_charset == 'euc' }

def message
if @mecab_ipadic_installed
Expand Down
4 changes: 1 addition & 3 deletions Formula/jstalk.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
require 'formula'

class NeedsSnowLeopard < Requirement
def satisfied?
MacOS.version >= :snow_leopard
end
satisfy MacOS.version >= :snow_leopard

def message
"jstalk requires Mac OS X 10.6 or newer"
Expand Down
5 changes: 2 additions & 3 deletions Formula/mlton.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# would require an existing ML compiler/interpreter for bootstrapping.

class StandardHomebrewLocation < Requirement
satisfy HOMEBREW_PREFIX.to_s == "/usr/local"

def message; <<-EOS.undent
mlton won't work outside of /usr/local
Expand All @@ -13,9 +15,6 @@ def message; <<-EOS.undent
will be unable to find GMP.
EOS
end
def satisfied?
HOMEBREW_PREFIX.to_s == "/usr/local"
end
end

class Mlton < Formula
Expand Down
4 changes: 1 addition & 3 deletions Formula/mongodb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
class SixtyFourBitRequired < Requirement
fatal true

def satisfied?
MacOS.prefer_64_bit?
end
satisfy MacOS.prefer_64_bit?

def message; <<-EOS.undent
32-bit MongoDB binaries are no longer available.
Expand Down
2 changes: 1 addition & 1 deletion Formula/mu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Emacs23Installed < Requirement
fatal true
env :userpaths

def satisfied?
satisfy do
`emacs --version 2>/dev/null` =~ /^GNU Emacs (\d{2})/
$1.to_i >= 23
end
Expand Down
4 changes: 1 addition & 3 deletions Formula/mupdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
class NeedsSnowLeopard < Requirement
fatal true

def satisfied?
MacOS.version >= :snow_leopard
end
satisfy MacOS.version >= :snow_leopard

def message; <<-EOS.undent
The version of Freetype that comes with Leopard is too old to build MuPDF
Expand Down
5 changes: 2 additions & 3 deletions Formula/mysql-connector-odbc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
class MySqlInstalled < Requirement
fatal true

satisfy { which 'mysql_config' }

def message; <<-EOS.undent
MySQL is required to install.
Expand All @@ -17,9 +19,6 @@ def message; <<-EOS.undent
http://dev.mysql.com/downloads/mysql/
EOS
end
def satisfied?
which 'mysql_config'
end
end

class MysqlConnectorOdbc < Formula
Expand Down
15 changes: 7 additions & 8 deletions Formula/node.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
require 'formula'

class PythonVersion < Requirement
env :userpaths

satisfy { `python -c 'import sys;print(sys.version[:3])'`.strip.to_f >= 2.6 }

def message; <<-EOS.undent
Node's build system, gyp, requires Python 2.6 or newer.
EOS
end
def satisfied?
`python -c 'import sys;print(sys.version[:3])'`.strip.to_f >= 2.6
end
end

class NpmNotInstalled < Requirement
fatal true

def modules_folder
"#{HOMEBREW_PREFIX}/lib/node_modules"
end
Expand All @@ -28,18 +31,14 @@ def message; <<-EOS.undent
EOS
end

def satisfied?
satisfy :build_env => false do
begin
path = Pathname.new("#{modules_folder}/npm")
not path.realpath.to_s.include?(HOMEBREW_CELLAR)
rescue Exception => e
true
end
end

def fatal?
true
end
end

class Node < Formula
Expand Down
Loading

0 comments on commit 60003ee

Please sign in to comment.