Audit LanguageModuleDependency for python
LanguageModuleDependency.new(:python,...) is deprecated now.
Replace it by
depends_on :python => ['module' => 'name-on-PyPi']
This commit is contained in:
parent
fb7f16fc94
commit
8f0a073bf6
@ -496,23 +496,30 @@ class FormulaAuditor
|
|||||||
|
|
||||||
def audit_python
|
def audit_python
|
||||||
if text =~ /(def\s*)?which_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
|
end
|
||||||
|
|
||||||
if text =~ /which\(?["']python/
|
if text =~ /which\(?["']python/
|
||||||
problem "Don't locate python with `which 'python'`, use `python.binary` instead"
|
problem "Don't locate python with `which 'python'`, use `python.binary` instead"
|
||||||
end
|
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
|
# Checks that apply only to code in def install
|
||||||
if text =~ /(\s*)def\s+install((.*\n)*?)(\1end)/
|
if text =~ /(\s*)def\s+install((.*\n)*?)(\1end)/
|
||||||
install_body = $2
|
install_body = $2
|
||||||
|
|
||||||
if install_body =~ /system\(?\s*['"]python/
|
if install_body =~ /system\(?\s*['"]python/
|
||||||
problem "Instead of `system 'python', ...`, call `system python, ...`."
|
problem "Instead of `system 'python', ...`, call `system python, ...`"
|
||||||
end
|
end
|
||||||
|
|
||||||
if text =~ /system\(?\s*python\.binary/
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -534,7 +541,7 @@ class FormulaAuditor
|
|||||||
# Don't check this for all formulae, because some are allowed to set the
|
# Don't check this for all formulae, because some are allowed to set the
|
||||||
# PYTHONPATH. E.g. python.rb itself needs to set it.
|
# PYTHONPATH. E.g. python.rb itself needs to set it.
|
||||||
if text =~ /ENV\.append.*PYTHONPATH/ || text =~ /ENV\[['"]PYTHONPATH['"]\]\s*=[^=]/
|
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
|
end
|
||||||
else
|
else
|
||||||
# So if there is no PythonInstalled requirement, we can check if the
|
# So if there is no PythonInstalled requirement, we can check if the
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user