Skip to content

Commit

Permalink
Added option to support custom shared libraries with <uses-library> tag
Browse files Browse the repository at this point in the history
Minor refactor of list defaults in build.py
  • Loading branch information
pax0r committed Feb 8, 2019
1 parent 282e43d commit e3b1901
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
21 changes: 7 additions & 14 deletions pythonforandroid/bootstraps/common/build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,14 +590,16 @@ def parse_args(args=None):
ap.add_argument('--launcher', dest='launcher', action='store_true',
help=('Provide this argument to build a multi-app '
'launcher, rather than a single app.'))
ap.add_argument('--permission', dest='permissions', action='append',
ap.add_argument('--permission', dest='permissions', action='append', default=[],
help='The permissions to give this app.', nargs='+')
ap.add_argument('--meta-data', dest='meta_data', action='append',
ap.add_argument('--meta-data', dest='meta_data', action='append', default=[],
help='Custom key=value to add in application metadata')
ap.add_argument('--uses-library', dest='android_used_libs', action='append', default=[],
help='Used shared libraries included using <uses-library> tag in AndroidManifest.xml')
ap.add_argument('--icon', dest='icon',
help=('A png file to use as the icon for '
'the application.'))
ap.add_argument('--service', dest='services', action='append',
ap.add_argument('--service', dest='services', action='append', default=[],
help='Declare a new service entrypoint: '
'NAME:PATH_TO_PY[:foreground]')
if get_bootstrap_name() != "service_only":
Expand Down Expand Up @@ -740,17 +742,8 @@ def _read_configuration():
'deprecated and does nothing.')
args.sdk_version = -1 # ensure it is not used

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 = []

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

if args.try_system_python_compile:
# Hardcoding python2.7 is okay for now, as python3 skips the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
android:allowBackup="{{ args.allow_backup }}"
android:theme="@android:style/Theme.NoTitleBar{% if not args.window %}.Fullscreen{% endif %}"
android:hardwareAccelerated="true" >
{% for l in args.android_used_libs %}
<uses-library android:name="{{ l }}" />
{% endfor %}

{% for m in args.meta_data %}
<meta-data android:name="{{ m.split('=', 1)[0] }}" android:value="{{ m.split('=', 1)[-1] }}"/>{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
android:allowBackup="true"
android:theme="@android:style/Theme.NoTitleBar{% if not args.window %}.Fullscreen{% endif %}"
android:hardwareAccelerated="true" >

{% for l in args.android_used_libs %}
<uses-library android:name="{{ l }}" />
{% endfor %}
{% for m in args.meta_data %}
<meta-data android:name="{{ m.split('=', 1)[0] }}" android:value="{{ m.split('=', 1)[-1] }}"/>{% endfor %}
<meta-data android:name="wakelock" android:value="{% if args.wakelock %}1{% else %}0{% endif %}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
android:allowBackup="true"
android:theme="@android:style/Theme.NoTitleBar{% if not args.window %}.Fullscreen{% endif %}"
android:hardwareAccelerated="true" >

{% for l in args.android_used_libs %}
<uses-library android:name="{{ l }}" />
{% endfor %}
{% for m in args.meta_data %}
<meta-data android:name="{{ m.split('=', 1)[0] }}" android:value="{{ m.split('=', 1)[-1] }}"/>{% endfor %}
<meta-data android:name="wakelock" android:value="{% if args.wakelock %}1{% else %}0{% endif %}"/>
Expand Down

0 comments on commit e3b1901

Please sign in to comment.