Rename PythonInstalled to PythonDependency.

Make it more consistent with other requirements.
This commit is contained in:
Mike McQuaid 2013-09-14 11:49:54 +01:00
parent a16394fde8
commit 315c7a1212
4 changed files with 10 additions and 10 deletions

View File

@ -568,8 +568,8 @@ class FormulaAuditor
end
end
unless f.requirements.any?{ |r| r.kind_of?(PythonInstalled) }
# So if there is no PythonInstalled requirement, we can check if the
unless f.requirements.any?{ |r| r.kind_of?(PythonDependency) }
# So if there is no PythonDependency requirement, we can check if the
# formula still uses python and should add a `depends_on :python`
unless f.name.to_s =~ /(pypy[0-9]*)|(python[0-9]*)/
if text =~ /system.["' ]?python([0-9"'])?/

View File

@ -74,7 +74,7 @@ class DependencyCollector
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 PythonInstalled.new("2", spec) if tag == :python
return PythonDependency.new("2", spec) if tag == :python
LanguageModuleDependency.new(tag, spec)
else
Dependency.new(spec, tags)
@ -103,8 +103,8 @@ class DependencyCollector
when :clt then CLTDependency.new(tags)
when :arch then ArchRequirement.new(tags)
when :hg then MercurialDependency.new(tags)
when :python, :python2 then PythonInstalled.new("2", tags)
when :python3 then PythonInstalled.new("3", tags)
when :python, :python2 then PythonDependency.new("2", tags)
when :python3 then PythonDependency.new("3", tags)
# Tiger's ld is too old to properly link some software
when :ld64 then LD64Dependency.new if MacOS.version < :leopard
else

View File

@ -3,7 +3,7 @@
# This method has a dual nature. For one, it takes a &block and sets up
# the ENV such that a Python, as defined in the requirements, is the default.
# If there are multiple `PythonInstalled` requirements, the block is evaluated
# If there are multiple `PythonDependency` requirements, the block is evaluated
# once for each Python. This makes it possible to easily support 2.x and
# 3.x Python bindings without code duplication in formulae.
# If you need to special case stuff, set :allowed_major_versions.
@ -24,8 +24,8 @@ def python_helper(options={:allowed_major_versions => [2, 3]}, &block)
end
end
# Look for PythonInstalled requirements for this formula:
python_reqs = requirements.select{ |r| r.kind_of?(PythonInstalled) }
# Look for PythonDependency requirements for this formula:
python_reqs = requirements.select{ |r| r.kind_of?(PythonDependency) }
if python_reqs.empty?
raise "If you use python in the formula, you have to add `depends_on :python` (or :python3)!"
end

View File

@ -6,14 +6,14 @@ require 'requirement'
# In `dependency_collector.rb`, special `:python` and `:python3` shortcuts are
# defined. You can specify a minimum version of the Python that needs to be
# present, but since not every package is ported to 3.x yet,
# `PythonInstalled("2")` is not satisfied by 3.x.
# `PythonDependency("2")` is not satisfied by 3.x.
# In a formula that shall provide support for 2.x and 3.x, the idiom is:
# depends_on :python
# depends_on :python3 => :optional # or :recommended
#
# Todo:
# - Allow further options that choose: universal, framework?, brewed?...
class PythonInstalled < Requirement
class PythonDependency < Requirement
attr_reader :min_version
attr_reader :if3then3
attr_reader :imports