Use a regex instead of splitting the URL on / etc
This commit is contained in:
parent
08f58ab5f7
commit
bf163013d9
@ -104,7 +104,8 @@ 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.
|
||||
|
||||
pypi_package_name = url.split("/").last.split(/[-.]\d+?./).first.gsub(/[_.]/, "-")
|
||||
url =~ %r{/(?<package_name>[^/]+)-}
|
||||
pypi_package_name = Regexp.last_match(:package_name).gsub(/[_.]/, "-")
|
||||
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