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

Switch --permission to accept >=1 parameters #966

Merged
merged 1 commit into from
Jan 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pythonforandroid/bootstraps/pygame/build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ def parse_args(args=None):
'Usually one of "landscape", "portrait" or '
'"sensor"'))
ap.add_argument('--permission', dest='permissions', action='append',
help='The permissions to give this app.')
help='The permissions to give this app.', nargs='+')
ap.add_argument('--ignore-path', dest='ignore_path', action='append',
help='Ignore path when building the app')
ap.add_argument('--icon', dest='icon',
Expand Down Expand Up @@ -488,6 +488,9 @@ def parse_args(args=None):

if args.permissions is None:
args.permissions = []
elif args.permissions:
if isinstance(args.permissions[0], list):
args.permissions = [p for perm in args.permissions for p in perm]

if args.ignore_path is None:
args.ignore_path = []
Expand Down
5 changes: 4 additions & 1 deletion pythonforandroid/bootstraps/sdl2/build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def parse_args(args=None):
ap.add_argument('--icon', dest='icon',
help='A png file to use as the icon for the application.')
ap.add_argument('--permission', dest='permissions', action='append',
help='The permissions to give this app.')
help='The permissions to give this app.', nargs='+')
ap.add_argument('--meta-data', dest='meta_data', action='append',
help='Custom key=value to add in application metadata')
ap.add_argument('--presplash', dest='presplash',
Expand Down Expand Up @@ -488,6 +488,9 @@ def parse_args(args=None):

if args.permissions is None:
args.permissions = []
elif args.permissions:
if isinstance(args.permissions[0], list):
args.permissions = [p for perm in args.permissions for p in perm]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using p as the variable name twice makes me twitchy ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I don't understand. It's a list comprehension, it wants the returning variable like that, otherwise it'd be this:

_new_permissions = []
for permission in args.permissions:
    for perm in permission:
        _new_permissions.append(perm)
args.permissions = _new_permissions

and repeated three times (pygame+sdl2+webview).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh okay, I just misread it.


if args.meta_data is None:
args.meta_data = []
Expand Down
5 changes: 4 additions & 1 deletion pythonforandroid/bootstraps/webview/build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ def parse_args(args=None):
ap.add_argument('--icon', dest='icon',
help='A png file to use as the icon for the application.')
ap.add_argument('--permission', dest='permissions', action='append',
help='The permissions to give this app.')
help='The permissions to give this app.', nargs='+')
ap.add_argument('--meta-data', dest='meta_data', action='append',
help='Custom key=value to add in application metadata')
ap.add_argument('--presplash', dest='presplash',
Expand Down Expand Up @@ -465,6 +465,9 @@ def parse_args(args=None):

if args.permissions is None:
args.permissions = []
elif args.permissions:
if isinstance(args.permissions[0], list):
args.permissions = [p for perm in args.permissions for p in perm]

if args.meta_data is None:
args.meta_data = []
Expand Down