Skip to content

Commit

Permalink
feat(manager/pep621): set currentVersion field for exact dependency v…
Browse files Browse the repository at this point in the history
…ersions (#27061)
  • Loading branch information
Churro committed Feb 5, 2024
1 parent b2bc591 commit ca80f6c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/modules/manager/pep621/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ describe('modules/manager/pep621/extract', () => {
datasource: 'pypi',
depType: 'project.dependencies',
currentValue: '==20.0.0',
currentVersion: '20.0.0',
},
{
packageName: 'pyproject-hooks',
Expand Down Expand Up @@ -276,6 +277,7 @@ describe('modules/manager/pep621/extract', () => {
expect(result?.deps).toEqual([
{
currentValue: '==2.30.0',
currentVersion: '2.30.0',
datasource: 'pypi',
depName: 'requests',
depType: 'project.dependencies',
Expand All @@ -290,6 +292,7 @@ describe('modules/manager/pep621/extract', () => {
},
{
currentValue: '==6.5',
currentVersion: '6.5',
datasource: 'pypi',
depName: 'coverage',
depType: 'tool.hatch.envs.default',
Expand Down Expand Up @@ -347,20 +350,23 @@ describe('modules/manager/pep621/extract', () => {
expect(result?.deps).toEqual([
{
currentValue: '==2.30.0',
currentVersion: '2.30.0',
datasource: 'pypi',
depName: 'requests',
depType: 'project.dependencies',
packageName: 'requests',
},
{
currentValue: '==1.18.0',
currentVersion: '1.18.0',
datasource: 'pypi',
depName: 'hatchling',
depType: 'build-system.requires',
packageName: 'hatchling',
},
{
currentValue: '==69.0.3',
currentVersion: '69.0.3',
datasource: 'pypi',
depName: 'setuptools',
depType: 'build-system.requires',
Expand Down
4 changes: 4 additions & 0 deletions lib/modules/manager/pep621/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ export function pep508ToPackageDependency(
dep.skipReason = 'unspecified-version';
} else {
dep.currentValue = parsed.currentValue;

if (parsed.currentValue.startsWith('==')) {
dep.currentVersion = parsed.currentValue.replace(regEx(/^==\s*/), '');
}
}
return dep;
}
Expand Down

0 comments on commit ca80f6c

Please sign in to comment.