From 8f0a073bf6329976b85950a66be696cddb03f5ea Mon Sep 17 00:00:00 2001 From: Samuel John Date: Tue, 16 Jul 2013 11:10:14 +0200 Subject: [PATCH] Audit LanguageModuleDependency for python LanguageModuleDependency.new(:python,...) is deprecated now. Replace it by depends_on :python => ['module' => 'name-on-PyPi'] --- Library/Homebrew/cmd/audit.rb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index fd0a9781e5..13fd2462ff 100644 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -496,23 +496,30 @@ class FormulaAuditor def audit_python if text =~ /(def\s*)?which_python/ - problem "Replace `which_python` by `python.xy`, which returns e.g. 'python2.7'." + 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, ...`." + problem "Instead of `system 'python', ...`, call `system python, ...`" end if text =~ /system\(?\s*python\.binary/ - problem "Instead of `system python.binary, ...`, call `system python, ...`." + problem "Instead of `system python.binary, ...`, call `system python, ...`" end end @@ -534,7 +541,7 @@ class FormulaAuditor # Don't check this for all formulae, because some are allowed to set the # PYTHONPATH. E.g. python.rb itself needs to set it. if text =~ /ENV\.append.*PYTHONPATH/ || text =~ /ENV\[['"]PYTHONPATH['"]\]\s*=[^=]/ - problem "Don't set the PYTHONPATH, instead declare `depends_on :python`." + problem "Don't set the PYTHONPATH, instead declare `depends_on :python`" end else # So if there is no PythonInstalled requirement, we can check if the