Skip to content
Snippets Groups Projects
Commit bc7f3658 authored by dcharbonnier's avatar dcharbonnier Committed by Rhys Arkins
Browse files

fix(pypi): pep0427 wheel packages (#4974)

parent df9101c2
Branches
Tags 19.82.2
No related merge requests found
...@@ -87,10 +87,23 @@ function extractVersionFromLinkText( ...@@ -87,10 +87,23 @@ function extractVersionFromLinkText(
): string | null { ): string | null {
const prefix = `${depName}-`; const prefix = `${depName}-`;
const suffix = '.tar.gz'; const suffix = '.tar.gz';
if (!(text.startsWith(prefix) && text.endsWith(suffix))) { if (text.startsWith(prefix) && text.endsWith(suffix)) {
return null; return text.replace(prefix, '').replace(/\.tar\.gz$/, '');
}
// pep-0427 wheel packages
// {distribution}-{version}(-{build tag})?-{python tag}-{abi tag}-{platform tag}.whl.
const wheelPrefix = depName.replace(/[^\w\d.]+/g, '_') + '-';
const wheelSuffix = '.whl';
if (
text.startsWith(wheelPrefix) &&
text.endsWith(wheelSuffix) &&
text.split('-').length > 2
) {
return text.split('-')[1];
} }
return text.replace(prefix, '').replace(/\.tar\.gz$/, '');
return null;
} }
async function getSimpleDependency( async function getSimpleDependency(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment