aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-06-26 22:08:54 -0500
committerJack Nagel2013-06-26 22:18:13 -0500
commitce0b989c636c65c6cdf643fb06062a3edc3506c0 (patch)
tree4c7d85a1d4234b94bde97b1882b9730cd8336ef2 /Library
parent81da4db0a9ce733755f4543384e3553081dc732d (diff)
downloadhomebrew-ce0b989c636c65c6cdf643fb06062a3edc3506c0.tar.bz2
Add syntax sugar for MPIDependency
Closes #20797.
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/boost.rb3
-rw-r--r--Library/Formula/boost149.rb3
-rw-r--r--Library/Formula/bsponmpi.rb2
-rw-r--r--Library/Formula/hdf5.rb2
-rw-r--r--Library/Formula/konoha.rb2
-rw-r--r--Library/Homebrew/cmd/audit.rb4
-rw-r--r--Library/Homebrew/dependency_collector.rb1
-rw-r--r--Library/Homebrew/requirements/mpi_dependency.rb9
-rw-r--r--Library/Homebrew/test/test_mpi_dependency.rb12
9 files changed, 26 insertions, 12 deletions
diff --git a/Library/Formula/boost.rb b/Library/Formula/boost.rb
index 34e7d2c59..a518fd4d9 100644
--- a/Library/Formula/boost.rb
+++ b/Library/Formula/boost.rb
@@ -28,7 +28,6 @@ class Boost < Formula
env :userpaths
option :universal
- option 'with-mpi', 'Enable MPI support'
option 'with-icu', 'Build regexp engine with icu support'
option 'with-c++11', 'Compile using Clang, std=c++11 and stdlib=libc++' if MacOS.version >= :lion
option 'use-system-layout', 'Use system layout instead of tagged'
@@ -36,7 +35,7 @@ class Boost < Formula
depends_on :python => :recommended
depends_on UniversalPython if build.universal? and build.with? "python"
depends_on "icu4c" if build.with? 'icu'
- depends_on MPIDependency.new(:cc, :cxx) if build.with? "mpi"
+ depends_on :mpi => [:cc, :cxx, :optional]
fails_with :llvm do
build 2335
diff --git a/Library/Formula/boost149.rb b/Library/Formula/boost149.rb
index bf9c4659e..9e6207b06 100644
--- a/Library/Formula/boost149.rb
+++ b/Library/Formula/boost149.rb
@@ -22,13 +22,12 @@ class Boost149 < Formula
env :userpaths
option :universal
- option 'with-mpi', 'Enable MPI support'
option 'with-icu', 'Build regexp engine with icu support'
depends_on :python => :recommended
depends_on UniversalPython if build.universal? and build.with? "python"
depends_on "icu4c" if build.with? 'icu'
- depends_on MPIDependency.new(:cc, :cxx) if build.with? "mpi"
+ depends_on :mpi => [:cc, :cxx, :optional]
fails_with :llvm do
build 2335
diff --git a/Library/Formula/bsponmpi.rb b/Library/Formula/bsponmpi.rb
index 0fd9df5fc..5ee528062 100644
--- a/Library/Formula/bsponmpi.rb
+++ b/Library/Formula/bsponmpi.rb
@@ -6,7 +6,7 @@ class Bsponmpi < Formula
sha1 '07380f8c4e72a69dddf5deae786ecbb37811b489'
depends_on 'scons' => :build
- depends_on MPIDependency.new(:cc, :cxx)
+ depends_on :mpi => [:cc, :cxx]
def install
# Don't install 'CVS' folders from tarball
diff --git a/Library/Formula/hdf5.rb b/Library/Formula/hdf5.rb
index 64f55bbfa..037acce83 100644
--- a/Library/Formula/hdf5.rb
+++ b/Library/Formula/hdf5.rb
@@ -15,7 +15,7 @@ class Hdf5 < Formula
depends_on :fortran if build.include? 'enable-fortran' or build.include? 'enable-fortran2003'
depends_on 'szip'
- depends_on MPIDependency.new(:cc, :cxx, :f90) if build.include? "enable-parallel"
+ depends_on :mpi => [:cc, :cxx, :f90] if build.include? "enable-parallel"
def install
ENV.universal_binary if build.universal?
diff --git a/Library/Formula/konoha.rb b/Library/Formula/konoha.rb
index e0d9324ba..e600f47b1 100644
--- a/Library/Formula/konoha.rb
+++ b/Library/Formula/konoha.rb
@@ -8,7 +8,7 @@ class Konoha < Formula
option 'tests', 'Verify the build with make test (1 min)'
depends_on 'cmake' => :build
- depends_on MPIDependency.new(:cc, :cxx)
+ depends_on :mpi => [:cc, :cxx]
depends_on 'pcre'
depends_on 'json-c'
depends_on 'sqlite'
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb
index dada06f1f..79df38599 100644
--- a/Library/Homebrew/cmd/audit.rb
+++ b/Library/Homebrew/cmd/audit.rb
@@ -166,9 +166,9 @@ class FormulaAuditor
when 'open-mpi', 'mpich2'
problem <<-EOS.undent
There are multiple conflicting ways to install MPI. Use an MPIDependency:
- depends_on MPIDependency.new(<lang list>)
+ depends_on :mpi => [<lang list>]
Where <lang list> is a comma delimited list that can include:
- :cc, :cxx, :f90, :f77
+ :cc, :cxx, :f77, :f90
EOS
end
end
diff --git a/Library/Homebrew/dependency_collector.rb b/Library/Homebrew/dependency_collector.rb
index 77370a3b9..e11be462d 100644
--- a/Library/Homebrew/dependency_collector.rb
+++ b/Library/Homebrew/dependency_collector.rb
@@ -94,6 +94,7 @@ class DependencyCollector
when :mysql then MysqlDependency.new(tags)
when :postgresql then PostgresqlDependency.new(tags)
when :fortran then FortranDependency.new(tags)
+ when :mpi then MPIDependency.new(*tags)
when :tex then TeXDependency.new(tags)
when :clt then CLTDependency.new(tags)
when :arch then ArchRequirement.new(tags)
diff --git a/Library/Homebrew/requirements/mpi_dependency.rb b/Library/Homebrew/requirements/mpi_dependency.rb
index 28a03d566..2baf9a904 100644
--- a/Library/Homebrew/requirements/mpi_dependency.rb
+++ b/Library/Homebrew/requirements/mpi_dependency.rb
@@ -13,11 +13,14 @@ class MPIDependency < Requirement
env :userpaths
- def initialize *lang_list
- @lang_list = lang_list
+ # This method must accept varargs rather than an array for
+ # backwards compatibility with formulae that call it directly.
+ def initialize(*tags)
@non_functional = []
@unknown_langs = []
- super()
+ @lang_list = [:cc, :cxx, :f77, :f90] & tags
+ tags -= @lang_list
+ super(tags)
end
def mpi_wrapper_works? compiler
diff --git a/Library/Homebrew/test/test_mpi_dependency.rb b/Library/Homebrew/test/test_mpi_dependency.rb
new file mode 100644
index 000000000..06f158805
--- /dev/null
+++ b/Library/Homebrew/test/test_mpi_dependency.rb
@@ -0,0 +1,12 @@
+require 'testing_env'
+require 'requirements/mpi_dependency'
+
+class MPIDependencyTests < Test::Unit::TestCase
+ def test_initialize_untangles_tags_and_wrapper_symbols
+ wrappers = [:cc, :cxx, :f77]
+ tags = [:optional, 'some-other-tag']
+ dep = MPIDependency.new(*wrappers + tags)
+ assert_equal wrappers, dep.lang_list
+ assert_equal tags, dep.tags
+ end
+end