Skip to content
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

Implement common argument parsing with argparse #146

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Pennycook
Copy link
Contributor

Related issues

Proposed changes

  • Replace extract_defines, extract_include_paths and extract_includes with a simpler argparse-based solution.
  • Renames args to argv to help distinguish between command-line arguments and the result of parse_args().
  • Add unit tests for _parse_compiler_args. The extract_* functions were never tested directly, only ever via other tests.

Aligned with convention used elsewhere, where "argv" is a list[str]
representing the command-line arguments, and "args" is the result of parsing
the contents of argv.

Signed-off-by: John Pennycook <[email protected]>
Instead of writing multiple functions to handle the parsing of -D, -I and
-include arguments, we can construct a simple ArgumentParser. In addition to
being more robust, it should be easier to extent with support for additional
arguments in the future.

Signed-off-by: John Pennycook <[email protected]>
Test handling of -D, -I, -isystem, and -include options.

Signed-off-by: John Pennycook <[email protected]>
@Pennycook Pennycook added the refactor Improvements to code structure label Dec 19, 2024
@Pennycook Pennycook added this to the 2.0.0 milestone Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Improvements to code structure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant