Correct handling of arguments that take values. #2027
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Python 3.12.7 modified the handling of command line arguments in a way that broke Briefcase's handling of arguments that take values (e.g.,
-C <config=value>
,-d <device>
, etc).Briefcase's command line handling is based on pushing argparse to its limits, performing partial parsing of arguments before all options have been registered. This is needed to allow commands to register their own arguments, and for the help for commands to be responsive to the target platform and output format.
The parser also has 2 optional positional arguments for most commands (
platform
andoutput_format
). Because they're optional, there's an ambiguity between these positional arguments, and arguments with flags that take values that haven't been registered yet.This PR takes a quick-and-dirty approach, removing any argument that looks like it might be passing a value from consideration from the partial parse. It's not pretty, but it works.
Fixes #2026.
PR Checklist: