Skip to content

Commit

Permalink
feat(pip-compile): Treat .txt files as pip_requirements files
Browse files Browse the repository at this point in the history
This fixes a case I missed in renovatebot#28959 where a lock file uses another lock
file as an input file.  In that case, we need to treat the input lock
file as a pip_requirements file so that we extract the
--[extra-]index-url flags from it and pass the correct credentials to
pip-compile.
  • Loading branch information
mbudnek committed Jun 6, 2024
1 parent f7de298 commit d0240c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/modules/manager/pip-compile/common.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,5 +342,10 @@ describe('modules/manager/pip-compile/common', () => {
expect(matchManager('file.in')).toBe('pip_requirements');
expect(matchManager('another_file.in')).toBe('pip_requirements');
});

it('matches pip_requirements any .txt file', () => {
expect(matchManager('file.txt')).toBe('pip_requirements');
expect(matchManager('another_file.txt')).toBe('pip_requirements');
});
});
});
2 changes: 1 addition & 1 deletion lib/modules/manager/pip-compile/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ export function matchManager(filename: string): SupportedManagers | 'unknown' {
return 'pep621';
}
// naive, could be improved, maybe use pip_requirements.fileMatch
if (filename.endsWith('.in')) {
if (filename.endsWith('.in') || filename.endsWith('.txt')) {
return 'pip_requirements';
}
return 'unknown';
Expand Down

0 comments on commit d0240c0

Please sign in to comment.