From 315c7a12127999cc9b757cdf93aa7fa5f8eb772b Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 14 Sep 2013 11:49:54 +0100 Subject: [PATCH] Rename PythonInstalled to PythonDependency. Make it more consistent with other requirements. --- Library/Homebrew/cmd/audit.rb | 4 ++-- Library/Homebrew/dependency_collector.rb | 6 +++--- Library/Homebrew/python_helper.rb | 6 +++--- Library/Homebrew/requirements/python_dependency.rb | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index af111a5648..b970ccf8a8 100644 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -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"'])?/ diff --git a/Library/Homebrew/dependency_collector.rb b/Library/Homebrew/dependency_collector.rb index 8d0aac452c..773987544c 100644 --- a/Library/Homebrew/dependency_collector.rb +++ b/Library/Homebrew/dependency_collector.rb @@ -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 diff --git a/Library/Homebrew/python_helper.rb b/Library/Homebrew/python_helper.rb index bace441fc0..d91bd7d2ff 100644 --- a/Library/Homebrew/python_helper.rb +++ b/Library/Homebrew/python_helper.rb @@ -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 diff --git a/Library/Homebrew/requirements/python_dependency.rb b/Library/Homebrew/requirements/python_dependency.rb index 1ba7aebeee..f07d3b2124 100644 --- a/Library/Homebrew/requirements/python_dependency.rb +++ b/Library/Homebrew/requirements/python_dependency.rb @@ -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