aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2013-12-12 21:04:45 +0000
committerMike McQuaid2013-12-12 21:07:41 +0000
commit38d2ffb2b88b282f36b7c98420b49d396e115ef5 (patch)
treefbf88b05a44cdd27e4b30590288038e61ecd855f /Library
parent16aeb7bca41935d6fecbd89d52ce93393d5e4429 (diff)
downloadbrew-38d2ffb2b88b282f36b7c98420b49d396e115ef5.tar.bz2
audit: remove deprecated Python features.
These will be removed soon so don't check for them.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/audit.rb68
1 files changed, 0 insertions, 68 deletions
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb
index eacdc048b..31438560d 100644
--- a/Library/Homebrew/cmd/audit.rb
+++ b/Library/Homebrew/cmd/audit.rb
@@ -158,13 +158,6 @@ class FormulaAuditor
Don't use #{dep} as a dependency. We allow non-Homebrew
#{dep} installations.
EOS
- when 'python', 'python2', 'python3'
- problem <<-EOS.undent
- Don't use #{dep} as a dependency (string).
- We have special `depends_on :python` (or :python2 or :python3 )
- that works with brewed and system Python and allows us to support
- bindings for 2.x and 3.x in parallel and much more.
- EOS
when 'gfortran'
problem "Use `depends_on :fortran` instead of `depends_on 'gfortran'`"
when 'open-mpi', 'mpich2'
@@ -486,66 +479,6 @@ class FormulaAuditor
Symbol === dep ? dep.inspect : "'#{dep}'"
end
- def audit_python
- if text =~ /(def\s*)?which_python/
- problem "Replace `which_python` by `python.xy`, which returns e.g. 'python2.7'"
- end
-
- if text =~ /which\(?["']python/
- problem "Don't locate python with `which 'python'`, use `python.binary` instead"
- end
-
- if text =~ /LanguageModuleDependency.new\s?\(\s?:python/
- problem <<-EOS.undent
- Python: Replace `LanguageModuleDependency.new(:python,'PyPi-name','module')`
- by the new `depends_on :python => ['module' => 'PyPi-name']`
- EOS
- end
-
- # Checks that apply only to code in def install
- if text =~ /(\s*)def\s+install((.*\n)*?)(\1end)/
- install_body = $2
-
- if install_body =~ /system\(?\s*['"]python/
- problem "Instead of `system 'python', ...`, call `system python, ...`"
- end
-
- if text =~ /system\(?\s*python\.binary/
- problem "Instead of `system python.binary, ...`, call `system python, ...`"
- end
- end
-
- # Checks that apply only to code in def caveats
- if text =~ /(\s*)def\s+caveats((.*\n)*?)(\1end)/ || text =~ /(\s*)def\s+caveats;(.*?)end/
- caveats_body = $2
- if caveats_body =~ /[ \{=](python[23]?)\.(.*\w)/
- # So if in the body of caveats there is a `python.whatever` called,
- # check that there is a guard like `if python` or similiar:
- python = $1
- method = $2
- unless caveats_body =~ /(if python[23]?)|(if build\.with\?\s?\(?['"]python)|(unless build.without\?\s?\(?['"]python)/
- problem "Please guard `#{python}.#{method}` like so `#{python}.#{method} if #{python}`"
- end
- end
- end
-
- 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"'])?/
- problem "If the formula uses Python, it should declare so by `depends_on :python#{$1}`"
- end
- end
- end
-
- # Todo:
- # The python do ... end block is possibly executed twice. Once for
- # python 2.x and once for 3.x. So if a `system 'make'` is called, a
- # `system 'make clean'` should also be called at the end of the block.
-
- end
-
def audit_check_output warning_and_description
return unless warning_and_description
warning, description = *warning_and_description
@@ -572,7 +505,6 @@ class FormulaAuditor
audit_patches
audit_text
text.each_line { |line| audit_line(line) }
- audit_python
audit_installed
end