diff options
| author | Mike McQuaid | 2018-01-19 08:11:07 +0000 |
|---|---|---|
| committer | GitHub | 2018-01-19 08:11:07 +0000 |
| commit | 985202cf8e3f9e221753dd99adf1e8874fece03a (patch) | |
| tree | 108c43249bdbf86fd0448d2bcee257e11edc57a3 /Library/Homebrew/compat/dependency_collector.rb | |
| parent | 02e4cae3d0f3fb7065ea3e9c0c4877f70c92689d (diff) | |
| parent | 78c829790d990b324320c3089c74eaec95c5ec31 (diff) | |
| download | brew-1.5.0.tar.bz2 | |
Merge pull request #3696 from alyssais/prepend1.5.0
`prepend` instead of alias hacks for deprecations
Diffstat (limited to 'Library/Homebrew/compat/dependency_collector.rb')
| -rw-r--r-- | Library/Homebrew/compat/dependency_collector.rb | 134 |
1 files changed, 68 insertions, 66 deletions
diff --git a/Library/Homebrew/compat/dependency_collector.rb b/Library/Homebrew/compat/dependency_collector.rb index 1c91f2283..84d5431f3 100644 --- a/Library/Homebrew/compat/dependency_collector.rb +++ b/Library/Homebrew/compat/dependency_collector.rb @@ -1,80 +1,82 @@ require "dependency_collector" class DependencyCollector - alias _parse_string_spec parse_string_spec + module Compat + # Define the languages that we can handle as external dependencies. + LANGUAGE_MODULES = Set[ + :lua, :lua51, :perl, :python, :python3, :ruby + ].freeze - # Define the languages that we can handle as external dependencies. - LANGUAGE_MODULES = Set[ - :lua, :lua51, :perl, :python, :python3, :ruby - ].freeze + def parse_string_spec(spec, tags) + if (tag = tags.first) && LANGUAGE_MODULES.include?(tag) + odeprecated "'depends_on ... => #{tag.inspect}'" + LanguageModuleRequirement.new(tag, spec, tags[1]) + else + super + end + end - def parse_string_spec(spec, tags) - if (tag = tags.first) && LANGUAGE_MODULES.include?(tag) - odeprecated "'depends_on :#{tag}'" - LanguageModuleRequirement.new(tag, spec, tags[1]) - else - _parse_string_spec(spec, tags) + def parse_symbol_spec(spec, tags) + case spec + when :clt + odeprecated "'depends_on :clt'" + when :tex + odeprecated "'depends_on :tex'" + TeXRequirement.new(tags) + when :autoconf, :automake, :bsdmake, :libtool + output_deprecation(spec) + autotools_dep(spec, tags) + when :cairo, :fontconfig, :freetype, :libpng, :pixman + output_deprecation(spec) + Dependency.new(spec.to_s, tags) + when :ant, :expat + output_deprecation(spec) + Dependency.new(spec.to_s, tags) + when :libltdl + tags << :run + output_deprecation("libtool") + Dependency.new("libtool", tags) + when :apr + output_deprecation(spec, "apr-util") + Dependency.new("apr-util", tags) + when :fortran + output_deprecation(spec, "gcc") + Dependency.new("gcc", tags) + when :gpg + output_deprecation(spec, "gnupg") + Dependency.new("gnupg", tags) + when :hg + output_deprecation(spec, "mercurial") + Dependency.new("mercurial", tags) + when :mpi + output_deprecation(spec, "open-mpi") + Dependency.new("open-mpi", tags) + when :python, :python2 + output_deprecation(spec, "python") + Dependency.new("python", tags) + when :python3 + output_deprecation(spec, "python3") + Dependency.new("python3", tags) + when :emacs, :mysql, :perl, :postgresql, :rbenv, :ruby + output_deprecation(spec) + Dependency.new(spec, tags) + else + super + end end - end - alias _parse_symbol_spec parse_symbol_spec + private - def parse_symbol_spec(spec, tags) - case spec - when :clt - odeprecated "'depends_on :clt'" - when :tex - odeprecated "'depends_on :tex'" - TeXRequirement.new(tags) - when :autoconf, :automake, :bsdmake, :libtool - output_deprecation(spec) - autotools_dep(spec, tags) - when :cairo, :fontconfig, :freetype, :libpng, :pixman - output_deprecation(spec) - Dependency.new(spec.to_s, tags) - when :ant, :expat - output_deprecation(spec) + def autotools_dep(spec, tags) + tags << :build unless tags.include? :run Dependency.new(spec.to_s, tags) - when :libltdl - tags << :run - output_deprecation("libtool") - Dependency.new("libtool", tags) - when :apr - output_deprecation(spec, "apr-util") - Dependency.new("apr-util", tags) - when :fortran - output_deprecation(spec, "gcc") - Dependency.new("gcc", tags) - when :gpg - output_deprecation(spec, "gnupg") - Dependency.new("gnupg", tags) - when :hg - output_deprecation(spec, "mercurial") - Dependency.new("mercurial", tags) - when :mpi - output_deprecation(spec, "open-mpi") - Dependency.new("open-mpi", tags) - when :python, :python2 - output_deprecation(spec, "python") - Dependency.new("python", tags) - when :python3 - output_deprecation(spec, "python3") - Dependency.new("python3", tags) - when :emacs, :mysql, :perl, :postgresql, :rbenv, :ruby - output_deprecation(spec) - Dependency.new(spec, tags) - else - _parse_symbol_spec(spec, tags) end - end - def autotools_dep(spec, tags) - tags << :build unless tags.include? :run - Dependency.new(spec.to_s, tags) + def output_deprecation(dependency, new_dependency = dependency) + odeprecated "'depends_on :#{dependency}'", + "'depends_on \"#{new_dependency}\"'" + end end - def output_deprecation(dependency, new_dependency = dependency) - odeprecated "'depends_on :#{dependency}'", - "'depends_on \"#{new_dependency}\"'" - end + prepend Compat end |
