resource_auditor: fix wheel URL audit
Signed-off-by: William Woodruff <william@yossarian.net>
This commit is contained in:
parent
e8ce1841d5
commit
bc7261c667
@ -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{/(?<package_name>[^/]+)-}
|
||||
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{/(?<package_name>[^/]+)-}
|
||||
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"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user