Rename PythonInstalled to PythonDependency.
Make it more consistent with other requirements.
This commit is contained in:
parent
a16394fde8
commit
315c7a1212
@ -568,8 +568,8 @@ class FormulaAuditor
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
unless f.requirements.any?{ |r| r.kind_of?(PythonInstalled) }
|
unless f.requirements.any?{ |r| r.kind_of?(PythonDependency) }
|
||||||
# So if there is no PythonInstalled requirement, we can check if the
|
# So if there is no PythonDependency requirement, we can check if the
|
||||||
# formula still uses python and should add a `depends_on :python`
|
# formula still uses python and should add a `depends_on :python`
|
||||||
unless f.name.to_s =~ /(pypy[0-9]*)|(python[0-9]*)/
|
unless f.name.to_s =~ /(pypy[0-9]*)|(python[0-9]*)/
|
||||||
if text =~ /system.["' ]?python([0-9"'])?/
|
if text =~ /system.["' ]?python([0-9"'])?/
|
||||||
|
|||||||
@ -74,7 +74,7 @@ class DependencyCollector
|
|||||||
elsif (tag = tags.first) && LANGUAGE_MODULES.include?(tag)
|
elsif (tag = tags.first) && LANGUAGE_MODULES.include?(tag)
|
||||||
# Next line only for legacy support of `depends_on 'module' => :python`
|
# Next line only for legacy support of `depends_on 'module' => :python`
|
||||||
# It should be replaced by `depends_on :python => 'module'`
|
# 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)
|
LanguageModuleDependency.new(tag, spec)
|
||||||
else
|
else
|
||||||
Dependency.new(spec, tags)
|
Dependency.new(spec, tags)
|
||||||
@ -103,8 +103,8 @@ class DependencyCollector
|
|||||||
when :clt then CLTDependency.new(tags)
|
when :clt then CLTDependency.new(tags)
|
||||||
when :arch then ArchRequirement.new(tags)
|
when :arch then ArchRequirement.new(tags)
|
||||||
when :hg then MercurialDependency.new(tags)
|
when :hg then MercurialDependency.new(tags)
|
||||||
when :python, :python2 then PythonInstalled.new("2", tags)
|
when :python, :python2 then PythonDependency.new("2", tags)
|
||||||
when :python3 then PythonInstalled.new("3", tags)
|
when :python3 then PythonDependency.new("3", tags)
|
||||||
# Tiger's ld is too old to properly link some software
|
# Tiger's ld is too old to properly link some software
|
||||||
when :ld64 then LD64Dependency.new if MacOS.version < :leopard
|
when :ld64 then LD64Dependency.new if MacOS.version < :leopard
|
||||||
else
|
else
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
# This method has a dual nature. For one, it takes a &block and sets up
|
# 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.
|
# 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
|
# once for each Python. This makes it possible to easily support 2.x and
|
||||||
# 3.x Python bindings without code duplication in formulae.
|
# 3.x Python bindings without code duplication in formulae.
|
||||||
# If you need to special case stuff, set :allowed_major_versions.
|
# 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
|
||||||
end
|
end
|
||||||
|
|
||||||
# Look for PythonInstalled requirements for this formula:
|
# Look for PythonDependency requirements for this formula:
|
||||||
python_reqs = requirements.select{ |r| r.kind_of?(PythonInstalled) }
|
python_reqs = requirements.select{ |r| r.kind_of?(PythonDependency) }
|
||||||
if python_reqs.empty?
|
if python_reqs.empty?
|
||||||
raise "If you use python in the formula, you have to add `depends_on :python` (or :python3)!"
|
raise "If you use python in the formula, you have to add `depends_on :python` (or :python3)!"
|
||||||
end
|
end
|
||||||
|
|||||||
@ -6,14 +6,14 @@ require 'requirement'
|
|||||||
# In `dependency_collector.rb`, special `:python` and `:python3` shortcuts are
|
# In `dependency_collector.rb`, special `:python` and `:python3` shortcuts are
|
||||||
# defined. You can specify a minimum version of the Python that needs to be
|
# 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,
|
# 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:
|
# In a formula that shall provide support for 2.x and 3.x, the idiom is:
|
||||||
# depends_on :python
|
# depends_on :python
|
||||||
# depends_on :python3 => :optional # or :recommended
|
# depends_on :python3 => :optional # or :recommended
|
||||||
#
|
#
|
||||||
# Todo:
|
# Todo:
|
||||||
# - Allow further options that choose: universal, framework?, brewed?...
|
# - Allow further options that choose: universal, framework?, brewed?...
|
||||||
class PythonInstalled < Requirement
|
class PythonDependency < Requirement
|
||||||
attr_reader :min_version
|
attr_reader :min_version
|
||||||
attr_reader :if3then3
|
attr_reader :if3then3
|
||||||
attr_reader :imports
|
attr_reader :imports
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user