diff options
| author | Max Howell | 2010-01-13 09:00:24 +0000 |
|---|---|---|
| committer | Max Howell | 2010-01-13 11:23:15 +0000 |
| commit | bbddc7dd9f2f01a58f6ff96afa2994e34699dc8b (patch) | |
| tree | dfb27bc3a9e4b9c772c359d115c29a3e14885a7c /Library | |
| parent | 338b4f44ee86e922066cfc0e8369a1a0348ee582 (diff) | |
| download | homebrew-bbddc7dd9f2f01a58f6ff96afa2994e34699dc8b.tar.bz2 | |
Adds: depends_on 'simplejson' => :python
So far we only added python, but we can add more.
Fixes #401
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Formula/rabbitmq.rb | 1 | ||||
| -rw-r--r-- | Library/Homebrew/formula.rb | 25 | ||||
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 19 |
3 files changed, 36 insertions, 9 deletions
diff --git a/Library/Formula/rabbitmq.rb b/Library/Formula/rabbitmq.rb index b06a9cdb5..875113b0c 100644 --- a/Library/Formula/rabbitmq.rb +++ b/Library/Formula/rabbitmq.rb @@ -6,6 +6,7 @@ class Rabbitmq <Formula md5 '4505ca0fd8718439bd6f5e2af2379e56' depends_on 'erlang' + depends_on 'simplejson' => :python if MACOS_VERSION < 10.6 def install erlang_libdir = lib + "rabbitmq" + "erlang" + "lib" diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index a9d8a61df..35585b899 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -289,6 +289,10 @@ class Formula self.class.deps or [] end + def external_deps + self.class.external_deps + end + protected # Pretty titles the command and buffers stdout/stderr # Throws if there's an error @@ -460,7 +464,7 @@ private end end - attr_rw :url, :version, :homepage, :specs, :deps, :aliases, *CHECKSUM_TYPES + attr_rw :url, :version, :homepage, :specs, :deps, :external_deps, :aliases, *CHECKSUM_TYPES def head val=nil, specs=nil if specs @@ -474,26 +478,31 @@ private args.each { |item| @aliases << item.to_s } end - def depends_on name, *args + def depends_on name @deps ||= [] + @external_deps ||= {:python => [], :ruby => [], :perl => []} case name when String # noop when Hash - name = name.keys.first # indeed, we only support one mapping + key, value = name.shift + case value + when :python, :ruby, :perl + @external_deps[value] << key + return + when :optional, :recommended + name = key + end when Symbol name = name.to_s when Formula - @deps << name - return # we trust formula dev to not dupe their own instantiations + # noop else raise "Unsupported type #{name.class}" end - # we get duplicates because every new fork of this process repeats this - # step for some reason I am not sure about - @deps << name unless @deps.include? name + @deps << name end def skip_clean paths diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index a773cd64e..efa84e0ff 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -20,10 +20,27 @@ class FormulaInstaller end deps end + def pyerr dep + brew_pip = ' brew install pip &&' unless Formula.factory('pip').installed? + <<-EOS +Unsatisfied dependency, #{dep} +Homebrew does not provide formula for Python dependencies, pip does: - def install f + #{brew_pip} pip install #{dep} + + EOS + end + + def check_external_deps f + f.external_deps[:python].each do |dep| + raise pyerr(dep) unless quiet_system "/usr/bin/python", "-c", "import #{dep}" + end if f.external_deps + end + + def install f expand_deps(f).each do |dep| begin + check_external_deps f install_private dep unless dep.installed? rescue #TODO continue if this is an optional dep |
