diff --git a/package.json b/package.json index 766d328cf..27410e6c4 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "vite": "5.4.10" }, "dependencies": { + "@renovatebot/pep440": "3.0.20", "@sindresorhus/is": "7.0.1", "clipanion": "3.2.1", "common-tags": "1.8.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 51aa36e67..83b402dcf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -22,6 +22,9 @@ importers: .: dependencies: + '@renovatebot/pep440': + specifier: 3.0.20 + version: 3.0.20 '@sindresorhus/is': specifier: 7.0.1 version: 7.0.1 @@ -555,6 +558,10 @@ packages: '@polka/url@1.0.0-next.28': resolution: {integrity: sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==} + '@renovatebot/pep440@3.0.20': + resolution: {integrity: sha512-Jw8jzHh2r1LAPTrjQlIwh/+8J3N2MqXZgPuTt6HdNeJIBjJskV8bsEfGs9rBzXi/omeHob3BXnvlECu2rCCUYw==} + engines: {node: ^18.12.0 || >= 20.0.0, pnpm: ^8.6.11} + '@rollup/rollup-android-arm-eabi@4.24.2': resolution: {integrity: sha512-ufoveNTKDg9t/b7nqI3lwbCG/9IJMhADBNjjz/Jn6LxIZxD7T5L8l2uO/wD99945F1Oo8FvgbbZJRguyk/BdzA==} cpu: [arm] @@ -3797,6 +3804,8 @@ snapshots: '@polka/url@1.0.0-next.28': {} + '@renovatebot/pep440@3.0.20': {} + '@rollup/rollup-android-arm-eabi@4.24.2': optional: true diff --git a/src/cli/tools/python/utils.ts b/src/cli/tools/python/utils.ts index eb79ca914..239e75e3d 100644 --- a/src/cli/tools/python/utils.ts +++ b/src/cli/tools/python/utils.ts @@ -1,5 +1,6 @@ import fs from 'node:fs/promises'; import path from 'node:path'; +import { valid as validPep440 } from '@renovatebot/pep440'; import { execa } from 'execa'; import { parse as parseIni } from 'ini'; import { inject, injectable } from 'inversify'; @@ -170,7 +171,7 @@ export abstract class PipBaseInstallService extends PythonBaseInstallService { } override async validate(version: string): Promise { - if (!(await super.validate(version))) { + if (!validPep440(version)) { return false; }