Skip to content

Commit

Permalink
fix(manager/pdm): install python first (#22441)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins authored May 26, 2023
1 parent 470d3b5 commit 2f23c14
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
6 changes: 6 additions & 0 deletions lib/modules/manager/pep621/artifacts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ describe('modules/manager/pep621/artifacts', () => {
fs.getSiblingFileName.mockReturnValueOnce('pdm.lock');
fs.readLocalFile.mockResolvedValueOnce('old test content');
fs.readLocalFile.mockResolvedValueOnce('new test content');
// python
getPkgReleases.mockResolvedValueOnce({
releases: [{ version: '3.11.1' }, { version: '3.11.2' }],
});
// pdm
getPkgReleases.mockResolvedValueOnce({
releases: [{ version: 'v2.6.1' }, { version: 'v2.5.0' }],
Expand Down Expand Up @@ -86,6 +90,8 @@ describe('modules/manager/pep621/artifacts', () => {
'-w "/tmp/github/some/repo" ' +
'containerbase/sidecar ' +
'bash -l -c "' +
'install-tool python 3.11.2 ' +
'&& ' +
'install-tool pdm v2.5.0 ' +
'&& ' +
'pdm update dep1' +
Expand Down
14 changes: 14 additions & 0 deletions lib/modules/manager/pep621/processors/pdm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ describe('modules/manager/pep621/processors/pdm', () => {
fs.getSiblingFileName.mockReturnValueOnce('pdm.lock');
fs.readLocalFile.mockResolvedValueOnce('test content');
fs.readLocalFile.mockResolvedValueOnce('test content');
// python
getPkgReleases.mockResolvedValueOnce({
releases: [{ version: '3.11.1' }, { version: '3.11.2' }],
});
// pdm
getPkgReleases.mockResolvedValueOnce({
releases: [{ version: 'v2.6.1' }, { version: 'v2.5.0' }],
Expand Down Expand Up @@ -71,6 +75,8 @@ describe('modules/manager/pep621/processors/pdm', () => {
'-w "/tmp/github/some/repo" ' +
'containerbase/sidecar ' +
'bash -l -c "' +
'install-tool python 3.11.2 ' +
'&& ' +
'install-tool pdm v2.5.0 ' +
'&& ' +
'pdm update dep1' +
Expand Down Expand Up @@ -106,6 +112,10 @@ describe('modules/manager/pep621/processors/pdm', () => {
fs.getSiblingFileName.mockReturnValueOnce('pdm.lock');
fs.readLocalFile.mockResolvedValueOnce('test content');
fs.readLocalFile.mockResolvedValueOnce('changed test content');
// python
getPkgReleases.mockResolvedValueOnce({
releases: [{ version: '3.11.1' }, { version: '3.11.2' }],
});
// pdm
getPkgReleases.mockResolvedValueOnce({
releases: [{ version: 'v2.6.1' }, { version: 'v2.5.0' }],
Expand Down Expand Up @@ -140,6 +150,10 @@ describe('modules/manager/pep621/processors/pdm', () => {
fs.getSiblingFileName.mockReturnValueOnce('pdm.lock');
fs.readLocalFile.mockResolvedValueOnce('test content');
fs.readLocalFile.mockResolvedValueOnce('changed test content');
// python
getPkgReleases.mockResolvedValueOnce({
releases: [{ version: '3.11.1' }, { version: '3.11.2' }],
});
// pdm
getPkgReleases.mockResolvedValueOnce({
releases: [{ version: 'v2.6.1' }, { version: 'v2.5.0' }],
Expand Down
9 changes: 6 additions & 3 deletions lib/modules/manager/pep621/processors/pdm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,18 @@ export class PdmProcessor implements PyProjectProcessor {
logger.debug('No pdm.lock found');
return null;
}

const toolConstraint: ToolConstraint = {
const pythonConstraint: ToolConstraint = {
toolName: 'python',
constraint: config.constraints?.python,
};
const pdmConstraint: ToolConstraint = {
toolName: 'pdm',
constraint: config.constraints?.pdm,
};

const execOptions: ExecOptions = {
docker: {},
toolConstraints: [toolConstraint],
toolConstraints: [pythonConstraint, pdmConstraint],
};

// on lockFileMaintenance do not specify any packages and update the complete lock file
Expand Down

0 comments on commit 2f23c14

Please sign in to comment.