diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index dada06f1fd..79df385991 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() + depends_on :mpi => [] Where 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 77370a3b96..e11be462d0 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 28a03d566e..2baf9a9048 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 0000000000..06f1588050 --- /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