Skip to content

Commit a3fae3f

Browse files
konardclaude
andcommitted
Add license change trigger for platform.* conan recipes
This commit implements the functionality requested in issue #175: - Adds a new --new-license command-line parameter - Creates change_license_in_conanfile_py module to handle license updates - Applies license changes only to recipes matching pattern ^platform\..+ (case-insensitive) - Updates license field in conanfile.py with proper quote handling - Creates separate commit for license changes with descriptive message - Includes example documentation showing usage 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 7285e38 commit a3fae3f

File tree

4 files changed

+1276
-575
lines changed

4 files changed

+1276
-575
lines changed

examples/test-license-change.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# License Change Feature Test
2+
3+
This document shows how to use the new license change functionality added to the update-conan-recipe-and-create-pull-request tool.
4+
5+
## Usage Example
6+
7+
The tool now accepts a `--new-license` parameter. When provided, it will:
8+
9+
1. Check if the recipe name matches the pattern `platform.*` (case-insensitive)
10+
2. If it matches, update the `license` field in the `conanfile.py` file
11+
3. Create a separate commit with the license change
12+
13+
### Command Example
14+
15+
```bash
16+
./update-conan-recipe-and-create-pull-request \
17+
--github-authentication-token "your-token" \
18+
--new-version "1.0.0" \
19+
--recipe-name "platform.collections" \
20+
--source-repo-owner-login "linksplatform" \
21+
--source-repo-name "Data.Collections" \
22+
--source-repo-branch-name "main" \
23+
--destination-repo-owner-login "conan-io" \
24+
--destination-repo-name "conan-center-index" \
25+
--destination-repo-branch-name "main" \
26+
--lib-zip-url "https://example.com/lib.zip" \
27+
--sha256hash "abc123..." \
28+
--dependencies "[email protected]" \
29+
--previous-version "0.9.0" \
30+
--new-license "MIT"
31+
```
32+
33+
### Pattern Matching
34+
35+
The feature only activates for recipes that match the pattern `^platform\..+` (case-insensitive):
36+
37+
-`platform.collections` → Will change license
38+
-`Platform.Memory` → Will change license (case-insensitive)
39+
-`platform.data` → Will change license
40+
-`boost` → Won't change license
41+
-`openssl` → Won't change license
42+
43+
### Implementation Details
44+
45+
The new functionality:
46+
47+
1. Adds a `--new-license` optional command-line parameter
48+
2. Uses regex pattern `^platform\..+` to match platform-specific recipes
49+
3. Updates the `license = "value"` line in conanfile.py files
50+
4. Preserves quote style (single or double quotes)
51+
5. Creates a separate commit with message "Update license to {new_license}"
52+
6. Only runs if both conditions are met:
53+
- `--new-license` parameter is provided
54+
- Recipe name matches the platform pattern

0 commit comments

Comments
 (0)