Skip to content
Snippets Groups Projects
Unverified Commit df70d371 authored by wwuck's avatar wwuck Committed by GitHub
Browse files

fix(pypi): package name with periods (#15867)

parent 4ee68db4
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,6 @@ ...@@ -7,6 +7,6 @@
<h1>Links for package.with.periods</h1> <h1>Links for package.with.periods</h1>
<a href="">package.with.periods-2.0.0.tar.gz</a><br> <a href="">package.with.periods-2.0.0.tar.gz</a><br>
<a href="">package.with.periods-2.0.1-py3-none-any.whl</a><br> <a href="">package.with.periods-2.0.1-py3-none-any.whl</a><br>
<a href="">package.with.periods-2.0.2-py3-none-any.whl</a><br> <a href="">package_with_periods-2.0.2-py3-none-any.whl</a><br>
<a href="">package.with.periods-2.0.2.tar.gz</a><br> <a href="">package.with.periods-2.0.2.tar.gz</a><br>
</body></html> </body></html>
...@@ -181,11 +181,18 @@ export class PypiDatasource extends Datasource { ...@@ -181,11 +181,18 @@ export class PypiDatasource extends Datasource {
// pep-0427 wheel packages // pep-0427 wheel packages
// {distribution}-{version}(-{build tag})?-{python tag}-{abi tag}-{platform tag}.whl. // {distribution}-{version}(-{build tag})?-{python tag}-{abi tag}-{platform tag}.whl.
// Also match the current wheel spec
// https://packaging.python.org/en/latest/specifications/binary-distribution-format/#escaping-and-unicode
// where any of -_. characters in {distribution} are replaced with _
const wheelText = text.toLowerCase(); const wheelText = text.toLowerCase();
const wheelPrefix = packageName.replace(regEx(/[^\w\d.]+/g), '_') + '-'; const wheelPrefixWithPeriod =
packageName.replace(regEx(/[^\w\d.]+/g), '_') + '-';
const wheelPrefixWithoutPeriod =
packageName.replace(regEx(/[^\w\d]+/g), '_') + '-';
const wheelSuffix = '.whl'; const wheelSuffix = '.whl';
if ( if (
wheelText.startsWith(wheelPrefix) && (wheelText.startsWith(wheelPrefixWithPeriod) ||
wheelText.startsWith(wheelPrefixWithoutPeriod)) &&
wheelText.endsWith(wheelSuffix) && wheelText.endsWith(wheelSuffix) &&
wheelText.split('-').length > 2 wheelText.split('-').length > 2
) { ) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment