Move deprecated Formula class methods to compat
These have all been moved to Formulary.
This commit is contained in:
parent
90183877ff
commit
4d9d01893e
@ -304,7 +304,7 @@ class Test
|
|||||||
test "brew", "uses", formula
|
test "brew", "uses", formula
|
||||||
dependencies = `brew deps #{formula}`.split("\n")
|
dependencies = `brew deps #{formula}`.split("\n")
|
||||||
dependencies -= `brew list`.split("\n")
|
dependencies -= `brew list`.split("\n")
|
||||||
formula_object = Formula.factory(formula)
|
formula_object = Formulary.factory(formula)
|
||||||
return unless satisfied_requirements? formula_object
|
return unless satisfied_requirements? formula_object
|
||||||
|
|
||||||
installed_gcc = false
|
installed_gcc = false
|
||||||
|
|||||||
@ -229,7 +229,7 @@ module Homebrew
|
|||||||
puts output
|
puts output
|
||||||
|
|
||||||
if ARGV.include? '--write'
|
if ARGV.include? '--write'
|
||||||
f = Formula.factory formula_name
|
f = Formulary.factory(formula_name)
|
||||||
update_or_add = nil
|
update_or_add = nil
|
||||||
|
|
||||||
Utils::Inreplace.inreplace(f.path) do |s|
|
Utils::Inreplace.inreplace(f.path) do |s|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ module Homebrew
|
|||||||
def cleanup_cellar
|
def cleanup_cellar
|
||||||
HOMEBREW_CELLAR.subdirs.each do |rack|
|
HOMEBREW_CELLAR.subdirs.each do |rack|
|
||||||
begin
|
begin
|
||||||
cleanup_formula Formula.factory(rack.basename.to_s)
|
cleanup_formula Formulary.factory(rack.basename.to_s)
|
||||||
rescue FormulaUnavailableError
|
rescue FormulaUnavailableError
|
||||||
# Don't complain about directories from DIY installs
|
# Don't complain about directories from DIY installs
|
||||||
end
|
end
|
||||||
@ -80,7 +80,7 @@ module Homebrew
|
|||||||
next unless (name = file.basename.to_s[/(.*)-(?:#{Regexp.escape(version)})/, 1])
|
next unless (name = file.basename.to_s[/(.*)-(?:#{Regexp.escape(version)})/, 1])
|
||||||
|
|
||||||
begin
|
begin
|
||||||
f = Formula.factory(name)
|
f = Formulary.factory(name)
|
||||||
rescue FormulaUnavailableError
|
rescue FormulaUnavailableError
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|||||||
@ -51,7 +51,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
if Formula.aliases.include? fc.name
|
if Formula.aliases.include? fc.name
|
||||||
realname = Formula.canonical_name fc.name
|
realname = Formulary.canonical_name(fc.name)
|
||||||
raise <<-EOS.undent
|
raise <<-EOS.undent
|
||||||
The formula #{realname} is already aliased to #{fc.name}
|
The formula #{realname} is already aliased to #{fc.name}
|
||||||
Please check that you are not creating a duplicate.
|
Please check that you are not creating a duplicate.
|
||||||
|
|||||||
@ -37,7 +37,7 @@ module Homebrew
|
|||||||
def detected_name(path, version)
|
def detected_name(path, version)
|
||||||
basename = path.basename.to_s
|
basename = path.basename.to_s
|
||||||
detected_name = basename[/(.*?)-?#{Regexp.escape(version)}/, 1] || basename
|
detected_name = basename[/(.*?)-?#{Regexp.escape(version)}/, 1] || basename
|
||||||
canonical_name = Formula.canonical_name(detected_name)
|
canonical_name = Formulary.canonical_name(detected_name)
|
||||||
|
|
||||||
odie <<-EOS.undent if detected_name != canonical_name
|
odie <<-EOS.undent if detected_name != canonical_name
|
||||||
The detected name #{detected_name.inspect} exists in Homebrew as an alias
|
The detected name #{detected_name.inspect} exists in Homebrew as an alias
|
||||||
|
|||||||
@ -570,7 +570,7 @@ def check_for_gettext
|
|||||||
return if @found.empty?
|
return if @found.empty?
|
||||||
|
|
||||||
# Our gettext formula will be caught by check_linked_keg_only_brews
|
# Our gettext formula will be caught by check_linked_keg_only_brews
|
||||||
f = Formula.factory("gettext") rescue nil
|
f = Formulary.factory("gettext") rescue nil
|
||||||
return if f and f.linked_keg.directory? and @found.all? do |path|
|
return if f and f.linked_keg.directory? and @found.all? do |path|
|
||||||
Pathname.new(path).realpath.to_s.start_with? "#{HOMEBREW_CELLAR}/gettext"
|
Pathname.new(path).realpath.to_s.start_with? "#{HOMEBREW_CELLAR}/gettext"
|
||||||
end
|
end
|
||||||
@ -585,7 +585,7 @@ end
|
|||||||
|
|
||||||
def check_for_iconv
|
def check_for_iconv
|
||||||
unless find_relative_paths("lib/libiconv.dylib", "include/iconv.h").empty?
|
unless find_relative_paths("lib/libiconv.dylib", "include/iconv.h").empty?
|
||||||
if (f = Formula.factory("libiconv") rescue nil) and f.linked_keg.directory?
|
if (f = Formulary.factory("libiconv") rescue nil) and f.linked_keg.directory?
|
||||||
if not f.keg_only? then <<-EOS.undent
|
if not f.keg_only? then <<-EOS.undent
|
||||||
A libiconv formula is installed and linked
|
A libiconv formula is installed and linked
|
||||||
This will break stuff. For serious. Unlink it.
|
This will break stuff. For serious. Unlink it.
|
||||||
@ -993,7 +993,7 @@ def check_for_bad_python_symlink
|
|||||||
end
|
end
|
||||||
|
|
||||||
def check_for_non_prefixed_coreutils
|
def check_for_non_prefixed_coreutils
|
||||||
gnubin = "#{Formula.factory('coreutils').prefix}/libexec/gnubin"
|
gnubin = "#{Formulary.factory('coreutils').prefix}/libexec/gnubin"
|
||||||
if paths.include? gnubin then <<-EOS.undent
|
if paths.include? gnubin then <<-EOS.undent
|
||||||
Putting non-prefixed coreutils in your path can cause gmp builds to fail.
|
Putting non-prefixed coreutils in your path can cause gmp builds to fail.
|
||||||
EOS
|
EOS
|
||||||
@ -1051,7 +1051,7 @@ def check_for_unlinked_but_not_keg_only
|
|||||||
true
|
true
|
||||||
elsif not (HOMEBREW_REPOSITORY/"Library/LinkedKegs"/rack.basename).directory?
|
elsif not (HOMEBREW_REPOSITORY/"Library/LinkedKegs"/rack.basename).directory?
|
||||||
begin
|
begin
|
||||||
Formula.factory(rack.basename.to_s).keg_only?
|
Formulary.factory(rack.basename.to_s).keg_only?
|
||||||
rescue FormulaUnavailableError
|
rescue FormulaUnavailableError
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|||||||
@ -26,7 +26,7 @@ module Homebrew
|
|||||||
else
|
else
|
||||||
# Don't use ARGV.formulae as that will throw if the file doesn't parse
|
# Don't use ARGV.formulae as that will throw if the file doesn't parse
|
||||||
paths = ARGV.named.map do |name|
|
paths = ARGV.named.map do |name|
|
||||||
name = Formula.canonical_name name
|
name = Formulary.canonical_name(name)
|
||||||
Formula.path(name)
|
Formula.path(name)
|
||||||
end
|
end
|
||||||
unless ARGV.force?
|
unless ARGV.force?
|
||||||
|
|||||||
@ -28,7 +28,7 @@ module Homebrew
|
|||||||
ARGV.named.each_with_index do |f,i|
|
ARGV.named.each_with_index do |f,i|
|
||||||
puts unless i == 0
|
puts unless i == 0
|
||||||
begin
|
begin
|
||||||
info_formula Formula.factory(f)
|
info_formula Formulary.factory(f)
|
||||||
rescue FormulaUnavailableError
|
rescue FormulaUnavailableError
|
||||||
# No formula with this name, try a blacklist lookup
|
# No formula with this name, try a blacklist lookup
|
||||||
if (blacklist = blacklisted?(f))
|
if (blacklist = blacklisted?(f))
|
||||||
|
|||||||
@ -4,12 +4,12 @@ require 'irb'
|
|||||||
|
|
||||||
class Symbol
|
class Symbol
|
||||||
def f
|
def f
|
||||||
Formula.factory(self.to_s)
|
Formulary.factory(to_s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
class String
|
class String
|
||||||
def f
|
def f
|
||||||
Formula.factory(self)
|
Formulary.factory(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -49,7 +49,7 @@ module Homebrew
|
|||||||
private
|
private
|
||||||
|
|
||||||
def keg_only?(name)
|
def keg_only?(name)
|
||||||
Formula.factory(name).keg_only?
|
Formulary.factory(name).keg_only?
|
||||||
rescue FormulaUnavailableError
|
rescue FormulaUnavailableError
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|||||||
@ -22,7 +22,7 @@ module Homebrew
|
|||||||
|
|
||||||
formulae.sort.each do |n|
|
formulae.sort.each do |n|
|
||||||
begin
|
begin
|
||||||
Formula.factory(n)
|
Formulary.factory(n)
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
onoe "problem in #{Formula.path(n)}"
|
onoe "problem in #{Formula.path(n)}"
|
||||||
puts e
|
puts e
|
||||||
|
|||||||
@ -17,7 +17,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
ARGV.named.each do |name|
|
ARGV.named.each do |name|
|
||||||
name = Formula.canonical_name(name)
|
name = Formulary.canonical_name(name)
|
||||||
rack = HOMEBREW_CELLAR/name
|
rack = HOMEBREW_CELLAR/name
|
||||||
|
|
||||||
if rack.directory?
|
if rack.directory?
|
||||||
@ -41,6 +41,6 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def rm_pin name
|
def rm_pin name
|
||||||
Formula.factory(name).unpin rescue nil
|
Formulary.factory(name).unpin rescue nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -31,6 +31,18 @@ class Formula
|
|||||||
opoo "Formula.all is deprecated, use Formula.map instead"
|
opoo "Formula.all is deprecated, use Formula.map instead"
|
||||||
map
|
map
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.canonical_name(name)
|
||||||
|
Formulary.canonical_name(name)
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.class_s(name)
|
||||||
|
Formulary.class_s(name)
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.factory(name)
|
||||||
|
Formulary.factory(name)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class UnidentifiedFormula < Formula
|
class UnidentifiedFormula < Formula
|
||||||
|
|||||||
@ -29,7 +29,7 @@ class Dependency
|
|||||||
end
|
end
|
||||||
|
|
||||||
def to_formula
|
def to_formula
|
||||||
f = Formula.factory(name)
|
f = Formulary.factory(name)
|
||||||
# Add this dependency's options to the formula's build args
|
# Add this dependency's options to the formula's build args
|
||||||
f.build.args = f.build.args.concat(options)
|
f.build.args = f.build.args.concat(options)
|
||||||
f
|
f
|
||||||
|
|||||||
@ -17,7 +17,7 @@ module HomebrewArgvExtension
|
|||||||
require 'keg'
|
require 'keg'
|
||||||
require 'formula'
|
require 'formula'
|
||||||
@kegs ||= downcased_unique_named.collect do |name|
|
@kegs ||= downcased_unique_named.collect do |name|
|
||||||
canonical_name = Formula.canonical_name(name)
|
canonical_name = Formulary.canonical_name(name)
|
||||||
rack = HOMEBREW_CELLAR/canonical_name
|
rack = HOMEBREW_CELLAR/canonical_name
|
||||||
dirs = rack.directory? ? rack.subdirs : []
|
dirs = rack.directory? ? rack.subdirs : []
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ module HomebrewArgvExtension
|
|||||||
Keg.new(linked_keg_ref.resolved_path)
|
Keg.new(linked_keg_ref.resolved_path)
|
||||||
elsif dirs.length == 1
|
elsif dirs.length == 1
|
||||||
Keg.new(dirs.first)
|
Keg.new(dirs.first)
|
||||||
elsif (prefix = Formula.factory(canonical_name).prefix).directory?
|
elsif (prefix = Formulary.factory(canonical_name).prefix).directory?
|
||||||
Keg.new(prefix)
|
Keg.new(prefix)
|
||||||
else
|
else
|
||||||
raise MultipleVersionsInstalledError.new(name)
|
raise MultipleVersionsInstalledError.new(name)
|
||||||
|
|||||||
@ -171,7 +171,7 @@ module SharedEnvExtension
|
|||||||
|
|
||||||
# ld64 is a newer linker provided for Xcode 2.5
|
# ld64 is a newer linker provided for Xcode 2.5
|
||||||
def ld64
|
def ld64
|
||||||
ld64 = Formula.factory('ld64')
|
ld64 = Formulary.factory('ld64')
|
||||||
self['LD'] = ld64.bin/'ld'
|
self['LD'] = ld64.bin/'ld'
|
||||||
append "LDFLAGS", "-B#{ld64.bin}/"
|
append "LDFLAGS", "-B#{ld64.bin}/"
|
||||||
end
|
end
|
||||||
|
|||||||
@ -338,10 +338,6 @@ class Formula
|
|||||||
alias_method :python2, :python
|
alias_method :python2, :python
|
||||||
alias_method :python3, :python
|
alias_method :python3, :python
|
||||||
|
|
||||||
def self.class_s name
|
|
||||||
Formulary.class_s(name)
|
|
||||||
end
|
|
||||||
|
|
||||||
# an array of all Formula names
|
# an array of all Formula names
|
||||||
def self.names
|
def self.names
|
||||||
Dir["#{HOMEBREW_LIBRARY}/Formula/*.rb"].map{ |f| File.basename f, '.rb' }.sort
|
Dir["#{HOMEBREW_LIBRARY}/Formula/*.rb"].map{ |f| File.basename f, '.rb' }.sort
|
||||||
@ -376,19 +372,10 @@ class Formula
|
|||||||
Dir["#{HOMEBREW_LIBRARY}/Aliases/*"].map{ |f| File.basename f }.sort
|
Dir["#{HOMEBREW_LIBRARY}/Aliases/*"].map{ |f| File.basename f }.sort
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.canonical_name name
|
|
||||||
Formulary.canonical_name(name)
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.[](name)
|
def self.[](name)
|
||||||
Formulary.factory(name)
|
Formulary.factory(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
# deprecated
|
|
||||||
def self.factory name
|
|
||||||
Formulary.factory name
|
|
||||||
end
|
|
||||||
|
|
||||||
def tap?
|
def tap?
|
||||||
HOMEBREW_TAP_DIR_REGEX === path
|
HOMEBREW_TAP_DIR_REGEX === path
|
||||||
end
|
end
|
||||||
|
|||||||
@ -211,7 +211,7 @@ class FormulaInstaller
|
|||||||
return if ARGV.force?
|
return if ARGV.force?
|
||||||
|
|
||||||
conflicts = f.conflicts.reject do |c|
|
conflicts = f.conflicts.reject do |c|
|
||||||
keg = Formula.factory(c.name).prefix
|
keg = Formulary.factory(c.name).prefix
|
||||||
not keg.directory? && Keg.new(keg).linked?
|
not keg.directory? && Keg.new(keg).linked?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -60,7 +60,7 @@ class FormulaVersions
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
old_const = Formulary.unload_formula(f.name)
|
old_const = Formulary.unload_formula(f.name)
|
||||||
nostdout { yield Formula.factory(path.to_s) }
|
nostdout { yield Formulary.factory(path.to_s) }
|
||||||
rescue *IGNORED_EXCEPTIONS => e
|
rescue *IGNORED_EXCEPTIONS => e
|
||||||
# We rescue these so that we can skip bad versions and
|
# We rescue these so that we can skip bad versions and
|
||||||
# continue walking the history
|
# continue walking the history
|
||||||
|
|||||||
@ -13,7 +13,7 @@ module Language
|
|||||||
["python", "python3"].each do |python|
|
["python", "python3"].each do |python|
|
||||||
next if build.without? python
|
next if build.without? python
|
||||||
version = self.major_minor_version python
|
version = self.major_minor_version python
|
||||||
ENV["PYTHONPATH"] = if Formula.factory(python).installed?
|
ENV["PYTHONPATH"] = if Formulary.factory(python).installed?
|
||||||
nil
|
nil
|
||||||
else
|
else
|
||||||
"#{HOMEBREW_PREFIX}/lib/python#{version}/site-packages"
|
"#{HOMEBREW_PREFIX}/lib/python#{version}/site-packages"
|
||||||
|
|||||||
@ -47,7 +47,7 @@ class Tab < OpenStruct
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.for_name name
|
def self.for_name name
|
||||||
for_formula(Formula.factory(name))
|
for_formula(Formulary.factory(name))
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.for_formula f
|
def self.for_formula f
|
||||||
|
|||||||
@ -195,7 +195,7 @@ class FormulaTests < Homebrew::TestCase
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
assert_kind_of Formula, Formula.factory(name)
|
assert_kind_of Formula, Formulary.factory(name)
|
||||||
ensure
|
ensure
|
||||||
path.unlink
|
path.unlink
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user