- 
                Notifications
    You must be signed in to change notification settings 
- Fork 8
setuptools: Fix passing empty include paths #418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the issue of passing empty or whitespace-only include paths to protoc by properly processing include paths passed via the command line or pyproject.toml.
- Update include_paths type annotation to accept both a string and an iterable of strings.
- Process include_paths using a pattern matching construct to remove extra white-spaces and empty strings.
- Update RELEASE_NOTES.md to document these changes.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description | 
|---|---|
| src/frequenz/repo/config/setuptools/grpc_tools.py | Refactored include_paths handling to support both string and iterable inputs. | 
| RELEASE_NOTES.md | Updated notes to reflect the fix in passing include paths to protoc. | 
| Sadly no tests because we still have no tests for this, as it is complicated because this is a setuptools plugin. I plan to move this to a separate repo in the future, which can make writing some integration test for it more easily. Manually tested with frequenz-floss/frequenz-api-common#374. | 
When loading protobuf include paths from the pyproject.toml file, the paths are received as an array/list. If we convert them to a comma-separated string there is the risk of a path containing commas to be split incorrectly, leading to compilation errors. Using the original array/list of paths instead of a comma-separated string is safer and more flexible. Signed-off-by: Leandro Lucarella <[email protected]>
When include paths are passed via the commnad-line, they are passed as a comma-separated string. This means the user could add extra spaces or pass a double-comma, which would result in empty strings in the include paths list, making the protobuf compiler fail. This commit cleans the include paths by stripping whitespace and ignoring empty strings. Signed-off-by: Leandro Lucarella <[email protected]>
Signed-off-by: Leandro Lucarella <[email protected]>
| Rebased and fixed release notes conflicts, needs a new approval, but probably from the @frequenz-floss/python-sdk-team to be able to be queued for merging. | 
Fix wrong passing of include paths when passed via:
protoc -I.pyproject.toml: Now an empty array/list can be passed to override the default paths, before this resulted in an empty string being passed toprotoc -I.