Skip to content

Commit 64314d5

Browse files
committed
Add setup.py build for kivy-launcher reboot
1 parent 5fc5241 commit 64314d5

File tree

1 file changed

+105
-0
lines changed
  • testapps/testlauncherreboot_setup

1 file changed

+105
-0
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
'''
2+
Clone Python implementation of Kivy Launcher from kivy/kivy-launcher repo,
3+
install deps specified in the OPTIONS['apk']['requirements'] and put it
4+
to a dist named OPTIONS['apk']['dist-name'].
5+
6+
Tested with P4A Dockerfile at 5fc5241e01fbbc2b23b3749f53ab48f22239f4fc,
7+
kivy-launcher at ad5c5c6e886a310bf6dd187e992df972864d1148 on Windows 8.1
8+
with Docker for Windows and running on Samsung Galaxy Note 9, Android 8.1.
9+
10+
docker run \
11+
--interactive \
12+
--tty \
13+
-v "/c/Users/.../python-for-android/testapps":/home/user/testapps \
14+
-v ".../python-for-android/pythonforandroid":/home/user/pythonforandroid \
15+
p4a sh -c '\
16+
. venv/bin/activate \
17+
&& cd testapps/testlauncherreboot_setup \
18+
&& python sdl2.py apk \
19+
--sdk-dir $ANDROID_SDK_HOME \
20+
--ndk-dir $ANDROID_NDK_HOME'
21+
'''
22+
23+
# pylint: disable=import-error,no-name-in-module
24+
from subprocess import Popen
25+
from distutils.core import setup
26+
from os import listdir
27+
from os.path import join, dirname, abspath, exists
28+
from pprint import pprint
29+
from setuptools import find_packages
30+
31+
ROOT = dirname(abspath(__file__))
32+
LAUNCHER = join(ROOT, 'launcherapp')
33+
34+
if not exists(LAUNCHER):
35+
PROC = Popen([
36+
'git', 'clone',
37+
'https://github.com/kivy/kivy-launcher',
38+
LAUNCHER
39+
])
40+
PROC.communicate()
41+
assert PROC.returncode == 0, PROC.returncode
42+
43+
pprint(listdir(LAUNCHER))
44+
pprint(listdir(ROOT))
45+
46+
47+
OPTIONS = {
48+
'apk': {
49+
'debug': None,
50+
'bootstrap': 'sdl2',
51+
'requirements': (
52+
'python3,sdl2,kivy,android,pyjnius,plyer'
53+
),
54+
# 'sqlite3,docutils,pygments,'
55+
# 'cymunk,lxml,pil,openssl,pyopenssl,'
56+
# 'twisted,audiostream,ffmpeg,numpy'
57+
58+
'android-api': 27,
59+
'ndk-api': 21,
60+
'dist-name': 'bdisttest_python3launcher_sdl2_googlendk',
61+
'name': 'TestLauncherPy3-sdl2',
62+
'package': 'org.kivy.testlauncherpy3_sdl2_googlendk',
63+
'ndk-version': '10.3.2',
64+
'arch': 'armeabi-v7a',
65+
'permissions': [
66+
'ACCESS_COARSE_LOCATION', 'ACCESS_FINE_LOCATION',
67+
'BLUETOOTH', 'BODY_SENSORS', 'CAMERA', 'INTERNET',
68+
'NFC', 'READ_EXTERNAL_STORAGE', 'RECORD_AUDIO',
69+
'USE_FINGERPRINT', 'VIBRATE', 'WAKE_LOCK',
70+
'WRITE_EXTERNAL_STORAGE'
71+
]
72+
}
73+
}
74+
75+
PACKAGE_DATA = {
76+
'launcherapp': [
77+
'*.py', '*.png', '*.ttf', '*.eot', '*.svg', '*.woff',
78+
],
79+
'launcherapp/art': [
80+
'*.py', '*.png', '*.ttf', '*.eot', '*.svg', '*.woff',
81+
],
82+
'launcherapp/art/fontello': [
83+
'*.py', '*.png', '*.ttf', '*.eot', '*.svg', '*.woff',
84+
],
85+
'launcherapp/data': [
86+
'*.py', '*.png', '*.ttf', '*.eot', '*.svg', '*.woff',
87+
],
88+
'launcherapp/launcher': [
89+
'*.py', '*.png', '*.ttf', '*.eot', '*.svg', '*.woff',
90+
]
91+
}
92+
93+
PACKAGES = find_packages()
94+
print('packages are', PACKAGES)
95+
96+
setup(
97+
name='testlauncherpy3_sdl2_googlendk',
98+
version='1.0',
99+
description='p4a sdl2.py apk',
100+
author='Peter Badida',
101+
author_email='keyweeusr@gmail.com',
102+
packages=find_packages(),
103+
options=OPTIONS,
104+
package_data=PACKAGE_DATA
105+
)

0 commit comments

Comments
 (0)