-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix argument parsing in Python 2.7.9
From CPython changeset 1a3143752db2: Before, if a default was set on the parent parser, any default for that variable set via set_defaults on a subparser would be ignored. Now the subparser set_defaults is honored. This is a problem for us as it means that any arguments supplied to the parent parser will be blatted by the subparser defaults, meaning that invocations such as honcho -e .env.custom run ... will not work in Python 2.7.9. This change fixes that by adding the common args such as "-e", "-f", "-d" to each subparser with a default of argparse.SUPPRESS, so that the default (and value) is inherited from the parent parser if the argument is not supplied after the subcommand. Thanks to @Changaco for the original bug report and fix implementation.
- Loading branch information
1 parent
207a537
commit 1319da7
Showing
2 changed files
with
43 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters