fix(pypi): skip compatibility check if not a version

Closes #6142
This commit is contained in:
Rhys Arkins 2020-05-06 07:29:48 +02:00
parent e531a934bf
commit 3f14af3ec2
2 changed files with 3 additions and 2 deletions

View file

@ -4,6 +4,7 @@ import { parse } from 'node-html-parser';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { Http } from '../../util/http'; import { Http } from '../../util/http';
import { matches } from '../../versioning/pep440'; import { matches } from '../../versioning/pep440';
import * as pep440 from '../../versioning/pep440';
import { GetReleasesConfig, ReleaseResult } from '../common'; import { GetReleasesConfig, ReleaseResult } from '../common';
export const id = 'pypi'; export const id = 'pypi';
@ -19,7 +20,7 @@ function compatibleVersions(
compatibility: Record<string, string> compatibility: Record<string, string>
): string[] { ): string[] {
const versions = Object.keys(releases); const versions = Object.keys(releases);
if (!(compatibility && compatibility.python)) { if (!(compatibility?.python && pep440.isVersion(compatibility.python))) {
return versions; return versions;
} }
return versions.filter((version) => return versions.filter((version) =>

View file

@ -47,7 +47,7 @@ export const isSingleVersion = (constraint: string): string =>
isVersion(constraint) || isVersion(constraint) ||
(constraint.startsWith('==') && isVersion(constraint.substring(2).trim())); (constraint.startsWith('==') && isVersion(constraint.substring(2).trim()));
export { matches }; export { isVersion, matches };
export const api: VersioningApi = { export const api: VersioningApi = {
equals, equals,