1
1
Python for Android
2
2
==================
3
3
4
- ===== THE PROJECT IS NOT USABLE YET =====
5
-
6
-
7
4
Python for android is a project to create your own Python distribution
8
5
including the modules you want, and create an apk including python, libs, and
9
6
your application.
@@ -23,6 +20,16 @@ compared to other projects.
23
20
| Python on a chip | No | No | No | No |
24
21
+--------------------+---------------+---------------+----------------+--------------+
25
22
23
+ .. note ::
24
+
25
+ For the moment, we are shipping only one "java bootstrap" needed for
26
+ decompressing all the files of your project, create an OpenGL ES 2.0
27
+ surface, handle touch input and manage an audio thread.
28
+
29
+ If you want to use it without kivy module (an opengl es 2.0 ui toolkit),
30
+ then you might want a lighter java bootstrap, that we don't have right now.
31
+ Help is welcome :)
32
+
26
33
27
34
Prerequisites
28
35
-------------
@@ -102,6 +109,55 @@ Available options::
102
109
-l Show a list of available modules
103
110
-m 'mod1 mod2' Modules to include
104
111
112
+ How does it work ?
113
+ ------------------
114
+
115
+ To be able to run Python on android, you need to compile it for android. And
116
+ you need to compile all the libraries you want for android too.
117
+ Since Python is a language, not a toolkit, you cannot draw any user interface
118
+ with it: you need to use a toolkit for it. Kivy can be one of them.
119
+
120
+ So for a simple ui project, the first step is to compile Python + Kivy + all
121
+ others libraries. Then you'll have what we call a "distribution".
122
+ A distribution is composed of:
123
+
124
+ - Python libraries
125
+ - All selected libraries (kivy, pygame, pil...)
126
+ - A java bootstrap
127
+ - A build script
128
+
129
+ You'll use the build script for create an "apk": an android package.
130
+
131
+
132
+ Customize your distribution
133
+ ---------------------------
134
+
135
+ The basic layout of a distribution is::
136
+
137
+ AndroidManifest.xml - (*) android manifest (generated from templates)
138
+ assets/
139
+ private.mp3 - (*) fake package that will contain all the python installation
140
+ public.mp3 - (*) fake package that will contain your application
141
+ bin/ - contain all the apk generated from build.py
142
+ buildlib/ - internals libraries for build.py
143
+ build.py - build script to use for packaging your application
144
+ build.xml - (*) build settings (generated from templates)
145
+ default.properties - settings generated from your distribute.sh
146
+ libs/ - contain all the compiled libraries
147
+ local.properties - settings generated from your distribute.sh
148
+ private/ - private directory containing all the python files
149
+ lib/ this is where you can remove or add python libs.
150
+ python2.7/ by default, some modules are already removed (tests, idlelib, ...)
151
+ project.properties - settings generated from your distribute.sh
152
+ python-install/ - the whole python installation, generated from distribute.sh
153
+ not included in the final package.
154
+ res/ - (*) android resource (generated from build.py)
155
+ src/ - Java bootstrap
156
+ templates/ - Templates used by build.py
157
+
158
+ (*): Theses files are automatically generated from build.py, don't change them directly !
159
+
160
+
105
161
Available modules
106
162
-----------------
107
163
151
207
----
152
208
153
209
- jni/Android.mk must not include ttf/image/mixer if not asked by the user
154
- - application should be automatically generated (Android.mk etc...)
155
210
- Python try always to import name.so, namemodule.so, name.py, name.pyo ?
156
211
- restore libpymodules.so loading to reduce the number of dlopen.
157
212
- if MODULES= change, the old build need to be cleaned
0 commit comments