Skip to content

Commit 6618b5d

Browse files
committed
Parse pep440 versions
1 parent 16c98a7 commit 6618b5d

2 files changed

Lines changed: 5 additions & 11 deletions

File tree

src/managers/builtin/pipPackageManager.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,14 +239,11 @@ export class PipPackageManager implements PackageManager, Disposable {
239239
}
240240
}
241241

242-
const versionStrings = await availableVersionsCmd.execute({
242+
const versions = await availableVersionsCmd.execute({
243243
packageName,
244244
pythonVersion: baseVersion,
245245
});
246-
return versionStrings
247-
.map((v) => parse(v))
248-
.filter((parsed): parsed is Pep440Version => parsed !== null)
249-
.sort((a, b) => compare(b.public, a.public));
246+
return versions.sort((a, b) => compare(b.public, a.public));
250247
} catch {
251248
return undefined;
252249
}

src/managers/conda/condaPackageManager.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Pep440Version } from '@renovatebot/pep440';
2-
import { compare, explain as parse } from '@renovatebot/pep440';
2+
import { compare } from '@renovatebot/pep440';
33
import * as path from 'path';
44
import {
55
CancellationError,
@@ -186,11 +186,8 @@ export class CondaPackageManager implements PackageManager, Disposable {
186186
pythonExecutable: 'conda',
187187
log: this.log,
188188
});
189-
const versionStrings = await availableVersionsCmd.execute({ packageName, pythonVersion: '' });
190-
return versionStrings
191-
.map((v) => parse(v))
192-
.filter((parsed): parsed is Pep440Version => parsed !== null)
193-
.sort((a, b) => compare(b.public, a.public));
189+
const versions = await availableVersionsCmd.execute({ packageName, pythonVersion: '' });
190+
return versions.sort((a, b) => compare(b.public, a.public));
194191
} catch {
195192
return undefined;
196193
}

0 commit comments

Comments
 (0)