Skip to content

Commit

Permalink
fix(conan): Allow include_prerelease without argument (#26588)
Browse files Browse the repository at this point in the history
  • Loading branch information
dazze1812 committed Jan 11, 2024
1 parent 3df6cd6 commit 0b3b56a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/modules/manager/conan/__fixtures__/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class Pkg(ConanFile):
requires = (("req_c/1.0@user/stable", "private"), )
requires = ("req_f/1.0@user/stable", ("req_h/3.0@other/beta", "override"))
requires = "req_g/[>1.0 <1.8]@user/stable"
requires = "req_z/[>1.0 <1.8, include_prerelease]@user/stable"
# requires = "commentedout/[>1.0 <1.8]@user/stable"
# requires = "commentedout2/[>1.0 <1.8]@user/stable"
requires = (("req_l/1.0@user/stable#bc592346b33fd19c1fbffce25d1e4236", "private"), )
Expand Down
7 changes: 7 additions & 0 deletions lib/modules/manager/conan/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,13 @@ describe('modules/manager/conan/extract', () => {
packageName: 'req_g/[>1.0 <1.8]@user/stable',
replaceString: 'req_g/[>1.0 <1.8]@user/stable',
},
{
currentValue: '[>1.0 <1.8, include_prerelease]',
depName: 'req_z',
depType: 'requires',
packageName: 'req_z/[>1.0 <1.8, include_prerelease]@user/stable',
replaceString: 'req_z/[>1.0 <1.8, include_prerelease]@user/stable',
},
{
autoReplaceStringTemplate:
'{{depName}}/{{newValue}}@user/stable{{#if newDigest}}#{{newDigest}}{{/if}}',
Expand Down
9 changes: 7 additions & 2 deletions lib/modules/versioning/conan/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ export function makeVersion(
export function cleanVersion(version: string): string {
if (version) {
return version
.replace(regEx(/,|\[|\]|"|include_prerelease=|loose=|True|False/g), '')
.replace(
regEx(
/,|\[|\]|"|include_prerelease=|include_prerelease|loose=|True|False/g,
),
'',
)
.trim();
}
return version;
Expand All @@ -44,7 +49,7 @@ export function getOptions(input: string): {
let loose = true;
if (input) {
includePrerelease =
input.includes('include_prerelease=True') &&
input.includes('include_prerelease') &&
!input.includes('include_prerelease=False');
loose = input.includes('loose=True') || !input.includes('loose=False');
}
Expand Down

0 comments on commit 0b3b56a

Please sign in to comment.