On Tue, 03 Feb 2026 19:03:37 +0100,
Stuart Henderson <[email protected]> wrote:
>
> [1 <text/plain; us-ascii (8bit)>]
> and "." is also affected
>
It can be done for PyPi only with not that ellegant solution.
Tested with two distnames:
- requests-cache-0.5.2
- repoze.who-3.0.0
with my diff it catch that
- requests-cache-0.5.2 -> 1.3.0
- repoze.who-3.0.0 -> 3.1.0
The diff. If it's ok I'll update my PR.
diff --git a/Portroach/SiteHandler/PyPI.pm b/Portroach/SiteHandler/PyPI.pm
index 81898f1..9f26078 100644
--- a/Portroach/SiteHandler/PyPI.pm
+++ b/Portroach/SiteHandler/PyPI.pm
@@ -116,6 +116,45 @@ sub GetFiles
foreach my $url (@$urls) {
push(@$files, $url->{filename});
}
+
+ if ($port->{ver} && $json->{releases} &&
$json->{releases}->{$port->{ver}}) {
+ my @distfiles = split ' ', ($port->{distfiles} || '');
+ my %seen = map { $_ => 1 } @distfiles;
+
+ foreach my $rel (@{$json->{releases}->{$port->{ver}}}) {
+ next unless ($rel->{packagetype} && $rel->{packagetype} eq
'sdist');
+ next unless ($rel->{filename});
+ next if ($seen{$rel->{filename}});
+ push @distfiles, $rel->{filename};
+ $seen{$rel->{filename}} = 1;
+ }
+
+ foreach my $distfile (@distfiles) {
+ next unless ($distfile =~ /^(.*?)\Q$port->{ver}\E(.*)$/);
+ my ($prefix, $suffix) = ($1, $2);
+ my ($name_prefix, $sep) = ($prefix, '');
+ if ($prefix =~ /^(.*?)([-_\.])$/) {
+ ($name_prefix, $sep) = ($1, $2);
+ }
+
+ my %alts;
+ foreach my $ch ('-', '_', '.') {
+ my $alt_prefix = $name_prefix;
+ $alt_prefix =~ s/[-_.]+/$ch/g;
+ $alts{$alt_prefix} = 1;
+ }
+
+ foreach my $alt_prefix (keys %alts) {
+ my $alt = $alt_prefix . $sep . $port->{ver} . $suffix;
+ next if ($alt eq $distfile);
+ next if ($seen{$alt});
+ push @distfiles, $alt;
+ $seen{$alt} = 1;
+ }
+ }
+
+ $port->{distfiles} = join ' ', @distfiles if (@distfiles);
+ }
} else {
_debug("GET failed: " . $resp->code);
return 0;
--
wbr, Kirill