Skip to content

Commit

Permalink
PythonDependency: massive refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMcQuaid committed Jan 20, 2014
1 parent 0313168 commit b3f4929
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 456 deletions.
8 changes: 3 additions & 5 deletions Library/Homebrew/dependency_collector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ def parse_string_spec(spec, tags)
if tags.empty?
Dependency.new(spec, tags)
elsif (tag = tags.first) && LANGUAGE_MODULES.include?(tag)
# Next line only for legacy support of `depends_on 'module' => :python`
# It should be replaced by `depends_on :python => 'module'`
return PythonDependency.new("2", Array(spec)) if tag == :python
LanguageModuleDependency.new(tag, spec)
else
Dependency.new(spec, tags)
Expand Down Expand Up @@ -105,8 +102,9 @@ def parse_symbol_spec(spec, tags)
when :clt then CLTDependency.new(tags)
when :arch then ArchRequirement.new(tags)
when :hg then MercurialDependency.new(tags)
when :python, :python2 then PythonDependency.new("2", tags)
when :python3 then PythonDependency.new("3", tags)
# python2 is deprecated
when :python, :python2 then PythonDependency.new(tags)
when :python3 then Python3Dependency.new(tags)
# Tiger's ld is too old to properly link some software
when :ld64 then LD64Dependency.new if MacOS.version < :leopard
when :ant then ant_dep(spec, tags)
Expand Down
26 changes: 8 additions & 18 deletions Library/Homebrew/formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -340,24 +340,14 @@ def std_cmake_args
]
end

# Install python bindings inside of a block given to this method and/or
# call python so: `system python, "setup.py", "install", "--prefix=#{prefix}"
# Note that there are no quotation marks around python!
# <https://github.com/Homebrew/homebrew/wiki/Homebrew-and-Python>
def python(options={:allowed_major_versions => [2, 3]}, &block)
require 'python_helper'
python_helper(options, &block)
end

# Explicitly only execute the block for 2.x (if a python 2.x is available)
def python2 &block
python(:allowed_major_versions => [2], &block)
end

# Explicitly only execute the block for 3.x (if a python 3.x is available)
def python3 &block
python(:allowed_major_versions => [3], &block)
end
# Deprecated
def python(options={}, &block)
opoo 'Formula#python is deprecated and will go away shortly.'
block.call if block_given?
PythonDependency.new
end
alias_method :python2, :python
alias_method :python3, :python

# Generates a formula's ruby class name from a formula's name
def self.class_s name
Expand Down
90 changes: 0 additions & 90 deletions Library/Homebrew/python_helper.rb

This file was deleted.

Loading

0 comments on commit b3f4929

Please sign in to comment.