Skip to content

Commit 4a41b53

Browse files
committed
Added option to support custom shared libraries with <uses-library> tag
Minor refactor of list defaults in build.py
1 parent 282e43d commit 4a41b53

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

pythonforandroid/bootstraps/common/build/build.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -590,14 +590,16 @@ def parse_args(args=None):
590590
ap.add_argument('--launcher', dest='launcher', action='store_true',
591591
help=('Provide this argument to build a multi-app '
592592
'launcher, rather than a single app.'))
593-
ap.add_argument('--permission', dest='permissions', action='append',
593+
ap.add_argument('--permission', dest='permissions', action='append', default=[],
594594
help='The permissions to give this app.', nargs='+')
595-
ap.add_argument('--meta-data', dest='meta_data', action='append',
595+
ap.add_argument('--meta-data', dest='meta_data', action='append', default=[],
596596
help='Custom key=value to add in application metadata')
597+
ap.add_argument('--uses-library', dest='android_used_libs', action='append', default=[],
598+
help='Used shared libraries included using <uses-library> tag in AndroidManifest.xml')
597599
ap.add_argument('--icon', dest='icon',
598600
help=('A png file to use as the icon for '
599601
'the application.'))
600-
ap.add_argument('--service', dest='services', action='append',
602+
ap.add_argument('--service', dest='services', action='append', default=[],
601603
help='Declare a new service entrypoint: '
602604
'NAME:PATH_TO_PY[:foreground]')
603605
if get_bootstrap_name() != "service_only":
@@ -740,18 +742,9 @@ def _read_configuration():
740742
'deprecated and does nothing.')
741743
args.sdk_version = -1 # ensure it is not used
742744

743-
if args.permissions is None:
744-
args.permissions = []
745-
elif args.permissions:
746-
if isinstance(args.permissions[0], list):
745+
if args.permissions and isinstance(args.permissions[0], list):
747746
args.permissions = [p for perm in args.permissions for p in perm]
748747

749-
if args.meta_data is None:
750-
args.meta_data = []
751-
752-
if args.services is None:
753-
args.services = []
754-
755748
if args.try_system_python_compile:
756749
# Hardcoding python2.7 is okay for now, as python3 skips the
757750
# compilation anyway

pythonforandroid/bootstraps/sdl2/build/templates/AndroidManifest.tmpl.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@
5656
android:allowBackup="{{ args.allow_backup }}"
5757
android:theme="@android:style/Theme.NoTitleBar{% if not args.window %}.Fullscreen{% endif %}"
5858
android:hardwareAccelerated="true" >
59+
{% for l in args.android_used_libs %}
60+
<uses-library android:name="{{ l }}" />
61+
{% endfor %}
5962

6063
{% for m in args.meta_data %}
6164
<meta-data android:name="{{ m.split('=', 1)[0] }}" android:value="{{ m.split('=', 1)[-1] }}"/>{% endfor %}

pythonforandroid/bootstraps/service_only/build/templates/AndroidManifest.tmpl.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@
4949
android:allowBackup="true"
5050
android:theme="@android:style/Theme.NoTitleBar{% if not args.window %}.Fullscreen{% endif %}"
5151
android:hardwareAccelerated="true" >
52-
52+
{% for l in args.android_used_libs %}
53+
<uses-library android:name="{{ l }}" />
54+
{% endfor %}
5355
{% for m in args.meta_data %}
5456
<meta-data android:name="{{ m.split('=', 1)[0] }}" android:value="{{ m.split('=', 1)[-1] }}"/>{% endfor %}
5557
<meta-data android:name="wakelock" android:value="{% if args.wakelock %}1{% else %}0{% endif %}"/>

pythonforandroid/bootstraps/webview/build/templates/AndroidManifest.tmpl.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@
5050
android:allowBackup="true"
5151
android:theme="@android:style/Theme.NoTitleBar{% if not args.window %}.Fullscreen{% endif %}"
5252
android:hardwareAccelerated="true" >
53-
53+
{% for l in args.android_used_libs %}
54+
<uses-library android:name="{{ l }}" />
55+
{% endfor %}
5456
{% for m in args.meta_data %}
5557
<meta-data android:name="{{ m.split('=', 1)[0] }}" android:value="{{ m.split('=', 1)[-1] }}"/>{% endfor %}
5658
<meta-data android:name="wakelock" android:value="{% if args.wakelock %}1{% else %}0{% endif %}"/>

0 commit comments

Comments
 (0)