Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 46
Receive use_docker flag from the cli#121
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| def setup_subparser(subparsers, parents, python_version): | ||
| parser = subparsers.add_parser( | ||
| python_version, | ||
| description="""This sub command generates IDE and build files for Python {} | ||
| """.format( | ||
| "3.6" if python_version == "python36" else "3.7" | ||
| ), | ||
| parents=parents, | ||
| ) | ||
| parser.set_defaults(language=python_version) | ||
| parser.add_argument( | ||
| "-d", | ||
| "--use-docker", | ||
| action="store_true", | ||
| help="""Use docker for python platform-independent packaging. | ||
| This is highly recommended unless you are experienced | ||
| with cross-platform Python packaging.""", | ||
| ) | ||
| return parser | ||
| def setup_subparser_python36(subparsers, parents): | ||
| return setup_subparser(subparsers, parents, "python36") | ||
| def setup_subparser_python37(subparsers, parents): | ||
| return setup_subparser(subparsers, parents, "python37") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import argparse | ||
| from rpdk.python.parser import setup_subparser_python36, setup_subparser_python37 | ||
| def test_setup_subparser_python36(): | ||
| parser = argparse.ArgumentParser() | ||
| subparsers = parser.add_subparsers(dest="subparser_name") | ||
| sub_parser = setup_subparser_python36(subparsers, []) | ||
| args = sub_parser.parse_args(["-d"]) | ||
| assert args.language == "python36" | ||
| assert args.use_docker is True | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: | ||
| def test_setup_subparser_python37(): | ||
| parser = argparse.ArgumentParser() | ||
| subparsers = parser.add_subparsers(dest="subparser_name") | ||
| sub_parser = setup_subparser_python37(subparsers, []) | ||
| args = sub_parser.parse_args([]) | ||
| assert args.language == "python37" | ||
| assert args.use_docker is False | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here can simplify | ||
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.
We should make this
useDockerfor consistency withprotocolVersionand JSON convention, right?