Skip to content
Snippets Groups Projects
Commit 919aac0b authored by Jack Nagel's avatar Jack Nagel
Browse files

Add syntax sugar for MPIDependency

Closes Homebrew/homebrew#20797.
parent 1cd31496
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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)
......
......@@ -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
......
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment