From fa7f8341cd8db3f191e14b3869bc951ea654069f Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Fri, 14 Aug 2026 21:46:38 -0400 Subject: sbolint: canonicalize pypi URLs. --- sbolint | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'sbolint') diff --git a/sbolint b/sbolint index aac3d75..c85e74e 100755 --- a/sbolint +++ b/sbolint @@ -1249,6 +1249,7 @@ sub check_dl_and_md5 { } check_github_url($file, $u); + check_pypi_url($file, $u); if($url_head) { curl_head_request($file, $u) || do { @@ -1389,6 +1390,34 @@ sub check_github_url { } } +sub check_pypi_url { + my $file = shift; + my $url = shift; + my $filename; + my $initial; + my $newurl; + my $srcnam; + + return unless $url =~ m{^(https?)://files.pythonhosted.org}; + + # don't mess with URLs that don't have the 60-digit hex hash. + return unless $url =~ m{/[0-9a-f]{60}/}; + + if($1 ne 'https') { + log_error("$file: pypi URL must be https://"); + } + + ($filename = $url) =~ s,.*/,,; + $initial = substr($filename, 0, 1); + # FIXME: assumes no - in the version number. So far that's true... + ($srcnam = $filename) =~ s,-\d[^-]*\.tar\.gz$,,; + + $newurl = "https://files.pythonhosted.org/packages/source/$initial/$srcnam/$filename"; + if($url ne $newurl) { + log_warning("$file: canonical pypi URL should be $newurl"); + } +} + sub script_exists { my $file = $buildname . ".SlackBuild"; unless(-e $file) { -- cgit v1.2.3