diff --git a/Library/Homebrew/resource_auditor.rb b/Library/Homebrew/resource_auditor.rb index 796af321e5..7a208c95da 100644 --- a/Library/Homebrew/resource_auditor.rb +++ b/Library/Homebrew/resource_auditor.rb @@ -108,8 +108,13 @@ module Homebrew return unless url.match?(%r{^https?://files\.pythonhosted\.org/packages/}) return if name == owner.name # Skip the top-level package name as we only care about `resource "foo"` blocks. - url =~ %r{/(?[^/]+)-} - pypi_package_name = Regexp.last_match(:package_name).to_s.gsub(/[_.]/, "-") + if url.end_with? ".whl" + pypi_package_name, = File.basename(URI(url).path).split("-", 2) + else + url =~ %r{/(?[^/]+)-} + pypi_package_name = Regexp.last_match(:package_name).to_s.gsub(/[_.]/, "-") + end + return if name.casecmp(pypi_package_name).zero? problem "resource name should be `#{pypi_package_name}` to match the PyPI package name"