Skip to content
Snippets Groups Projects
Unverified Commit abc61d64 authored by Rhys Arkins's avatar Rhys Arkins Committed by GitHub
Browse files

fix(pypi): filter string only and deduplicate (#28865)

parent 3afab2ab
No related branches found
No related tags found
No related merge requests found
...@@ -265,9 +265,6 @@ exports[`modules/datasource/pypi/index getReleases respects constraints 1`] = ` ...@@ -265,9 +265,6 @@ exports[`modules/datasource/pypi/index getReleases respects constraints 1`] = `
{ {
"registryUrl": "https://pypi.org/pypi", "registryUrl": "https://pypi.org/pypi",
"releases": [ "releases": [
{
"version": "0.4.0",
},
{ {
"version": "0.4.1", "version": "0.4.1",
}, },
......
import url from 'node:url'; import url from 'node:url';
import is from '@sindresorhus/is';
import changelogFilenameRegex from 'changelog-filename-regex'; import changelogFilenameRegex from 'changelog-filename-regex';
import { logger } from '../../../logger'; import { logger } from '../../../logger';
import { coerceArray } from '../../../util/array'; import { coerceArray } from '../../../util/array';
...@@ -156,9 +157,11 @@ export class PypiDatasource extends Datasource { ...@@ -156,9 +157,11 @@ export class PypiDatasource extends Datasource {
result.isDeprecated = isDeprecated; result.isDeprecated = isDeprecated;
} }
// There may be multiple releases with different requires_python, so we return all in an array // There may be multiple releases with different requires_python, so we return all in an array
const pythonConstraints = releases
.map(({ requires_python }) => requires_python)
.filter(is.string);
result.constraints = { result.constraints = {
// TODO: string[] isn't allowed here python: Array.from(new Set(pythonConstraints)),
python: releases.map(({ requires_python }) => requires_python) as any,
}; };
return result; return result;
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment