move more deprecated methods to compat folder
This commit is contained in:
		
							parent
							
								
									baf3ca09b2
								
							
						
					
					
						commit
						d108bf0a55
					
				@ -7,3 +7,6 @@ require "compat/md5"
 | 
			
		||||
require "compat/requirements"
 | 
			
		||||
require "compat/version"
 | 
			
		||||
require "compat/download_strategy"
 | 
			
		||||
require "compat/keg"
 | 
			
		||||
require "compat/pathname"
 | 
			
		||||
require "compat/dependency_collector"
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										25
									
								
								Library/Homebrew/compat/dependency_collector.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								Library/Homebrew/compat/dependency_collector.rb
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,25 @@
 | 
			
		||||
module DependencyCollectorCompat
 | 
			
		||||
  def parse_symbol_spec(spec, tags)
 | 
			
		||||
    case spec
 | 
			
		||||
    when :clt
 | 
			
		||||
    when :autoconf, :automake, :bsdmake, :libtool
 | 
			
		||||
      autotools_dep(spec, tags)
 | 
			
		||||
    when :cairo, :fontconfig, :freetype, :libpng, :pixman
 | 
			
		||||
      Dependency.new(spec.to_s, tags)
 | 
			
		||||
    when :libltdl
 | 
			
		||||
      tags << :run
 | 
			
		||||
      Dependency.new("libtool", tags)
 | 
			
		||||
    else
 | 
			
		||||
      super(spec, tags)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
class DependencyCollector
 | 
			
		||||
  prepend DependencyCollectorCompat
 | 
			
		||||
 | 
			
		||||
  def autotools_dep(spec, tags)
 | 
			
		||||
    tags << :build unless tags.include? :run
 | 
			
		||||
    Dependency.new(spec.to_s, tags)
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										6
									
								
								Library/Homebrew/compat/keg.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								Library/Homebrew/compat/keg.rb
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,6 @@
 | 
			
		||||
class Keg
 | 
			
		||||
  def fname
 | 
			
		||||
    opoo "Keg#fname is a deprecated alias for Keg#name and will be removed soon"
 | 
			
		||||
    name
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										17
									
								
								Library/Homebrew/compat/pathname.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								Library/Homebrew/compat/pathname.rb
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,17 @@
 | 
			
		||||
class Pathname
 | 
			
		||||
  def cp(dst)
 | 
			
		||||
    opoo "Pathname#cp is deprecated, use FileUtils.cp"
 | 
			
		||||
    if file?
 | 
			
		||||
      FileUtils.cp to_s, dst
 | 
			
		||||
    else
 | 
			
		||||
      FileUtils.cp_r to_s, dst
 | 
			
		||||
    end
 | 
			
		||||
    dst
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def chmod_R(perms)
 | 
			
		||||
    opoo "Pathname#chmod_R is deprecated, use FileUtils.chmod_R"
 | 
			
		||||
    require "fileutils"
 | 
			
		||||
    FileUtils.chmod_R perms, to_s
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
@ -116,14 +116,6 @@ class DependencyCollector
 | 
			
		||||
    when :emacs      then EmacsRequirement.new(tags)
 | 
			
		||||
    # Tiger's ld is too old to properly link some software
 | 
			
		||||
    when :ld64       then LD64Dependency.new if MacOS.version < :leopard
 | 
			
		||||
    when :clt # deprecated
 | 
			
		||||
    when :autoconf, :automake, :bsdmake, :libtool # deprecated
 | 
			
		||||
      autotools_dep(spec, tags)
 | 
			
		||||
    when :cairo, :fontconfig, :freetype, :libpng, :pixman # deprecated
 | 
			
		||||
      Dependency.new(spec.to_s, tags)
 | 
			
		||||
    when :libltdl # deprecated
 | 
			
		||||
      tags << :run
 | 
			
		||||
      Dependency.new("libtool", tags)
 | 
			
		||||
    when :python2
 | 
			
		||||
      PythonRequirement.new(tags)
 | 
			
		||||
    else
 | 
			
		||||
@ -139,11 +131,6 @@ class DependencyCollector
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def autotools_dep(spec, tags)
 | 
			
		||||
    tags << :build unless tags.include? :run
 | 
			
		||||
    Dependency.new(spec.to_s, tags)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def ant_dep(spec, tags)
 | 
			
		||||
    if MacOS.version >= :mavericks
 | 
			
		||||
      Dependency.new(spec.to_s, tags)
 | 
			
		||||
 | 
			
		||||
@ -135,16 +135,6 @@ class Pathname
 | 
			
		||||
  end
 | 
			
		||||
  private :default_stat
 | 
			
		||||
 | 
			
		||||
  # @private
 | 
			
		||||
  def cp(dst)
 | 
			
		||||
    opoo "Pathname#cp is deprecated, use FileUtils.cp"
 | 
			
		||||
    if file?
 | 
			
		||||
      FileUtils.cp to_s, dst
 | 
			
		||||
    else
 | 
			
		||||
      FileUtils.cp_r to_s, dst
 | 
			
		||||
    end
 | 
			
		||||
    dst
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  # @private
 | 
			
		||||
  def cp_path_sub(pattern, replacement)
 | 
			
		||||
@ -198,12 +188,6 @@ class Pathname
 | 
			
		||||
    false
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  # @private
 | 
			
		||||
  def chmod_R(perms)
 | 
			
		||||
    opoo "Pathname#chmod_R is deprecated, use FileUtils.chmod_R"
 | 
			
		||||
    require "fileutils"
 | 
			
		||||
    FileUtils.chmod_R perms, to_s
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  # @private
 | 
			
		||||
  def version
 | 
			
		||||
 | 
			
		||||
@ -103,11 +103,6 @@ class Keg
 | 
			
		||||
    @opt_record = HOMEBREW_PREFIX.join("opt", name)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def fname
 | 
			
		||||
    opoo "Keg#fname is a deprecated alias for Keg#name and will be removed soon"
 | 
			
		||||
    name
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def to_s
 | 
			
		||||
    path.to_s
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user