Skip to content

Commit 287d191

Browse files
authored
Merge pull request #1684 from pax0r/master
Added option to support custom shared libraries with <uses-library> tag
2 parents 523d026 + e3b1901 commit 287d191

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

pythonforandroid/bootstraps/common/build/build.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -597,14 +597,16 @@ def parse_args(args=None):
597597
ap.add_argument('--launcher', dest='launcher', action='store_true',
598598
help=('Provide this argument to build a multi-app '
599599
'launcher, rather than a single app.'))
600-
ap.add_argument('--permission', dest='permissions', action='append',
600+
ap.add_argument('--permission', dest='permissions', action='append', default=[],
601601
help='The permissions to give this app.', nargs='+')
602-
ap.add_argument('--meta-data', dest='meta_data', action='append',
602+
ap.add_argument('--meta-data', dest='meta_data', action='append', default=[],
603603
help='Custom key=value to add in application metadata')
604+
ap.add_argument('--uses-library', dest='android_used_libs', action='append', default=[],
605+
help='Used shared libraries included using <uses-library> tag in AndroidManifest.xml')
604606
ap.add_argument('--icon', dest='icon',
605607
help=('A png file to use as the icon for '
606608
'the application.'))
607-
ap.add_argument('--service', dest='services', action='append',
609+
ap.add_argument('--service', dest='services', action='append', default=[],
608610
help='Declare a new service entrypoint: '
609611
'NAME:PATH_TO_PY[:foreground]')
610612
if get_bootstrap_name() != "service_only":
@@ -747,17 +749,8 @@ def _read_configuration():
747749
'deprecated and does nothing.')
748750
args.sdk_version = -1 # ensure it is not used
749751

750-
if args.permissions is None:
751-
args.permissions = []
752-
elif args.permissions:
753-
if isinstance(args.permissions[0], list):
754-
args.permissions = [p for perm in args.permissions for p in perm]
755-
756-
if args.meta_data is None:
757-
args.meta_data = []
758-
759-
if args.services is None:
760-
args.services = []
752+
if args.permissions and isinstance(args.permissions[0], list):
753+
args.permissions = [p for perm in args.permissions for p in perm]
761754

762755
if args.try_system_python_compile:
763756
# Hardcoding python2.7 is okay for now, as python3 skips the

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)