Skip to content
Snippets Groups Projects
Unverified Commit 69fbfaa1 authored by Mike McQuaid's avatar Mike McQuaid Committed by GitHub
Browse files

Merge pull request #7261 from Bo98/python-linkage

formula_cellar_checks: check Python site packages
parents 6b35af09 a298d7d8
No related branches found
No related tags found
No related merge requests found
......@@ -165,6 +165,40 @@ module FormulaCellarChecks
EOS
end
def check_python_packages(lib, deps)
return unless lib.directory?
lib_subdirs = lib.children
.select(&:directory?)
.map(&:basename)
pythons = lib_subdirs.map do |p|
match = p.to_s.match(/^python(\d+\.\d+)$/)
next if match.blank?
next if match.captures.blank?
match.captures.first
end.compact
python_deps = deps.map(&:name)
.grep(/^python(@.*)?$/)
.map { |d| Formula[d].version.to_s[/^\d+\.\d+/] }
.compact
return if python_deps.blank?
return if pythons.any? { |v| python_deps.include? v }
pythons = pythons.map { |v| "Python #{v}" }
python_deps = python_deps.map { |v| "Python #{v}" }
<<~EOS
Packages have been installed for:
#{pythons * "\n "}
but this formula depends on:
#{python_deps * "\n "}
EOS
end
def audit_installed
@new_formula ||= false
......@@ -179,6 +213,7 @@ module FormulaCellarChecks
problem_if_output(check_easy_install_pth(formula.lib))
problem_if_output(check_elisp_dirname(formula.share, formula.name))
problem_if_output(check_elisp_root(formula.share, formula.name))
problem_if_output(check_python_packages(formula.lib, formula.deps))
end
alias generic_audit_installed audit_installed
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment