11Python for Android
22==================
33
4- ===== THE PROJECT IS NOT USABLE YET =====
5-
6-
74Python for android is a project to create your own Python distribution
85including the modules you want, and create an apk including python, libs, and
96your application.
@@ -23,6 +20,16 @@ compared to other projects.
2320| Python on a chip | No | No | No | No |
2421+--------------------+---------------+---------------+----------------+--------------+
2522
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+
2633
2734Prerequisites
2835-------------
@@ -102,6 +109,55 @@ Available options::
102109 -l Show a list of available modules
103110 -m 'mod1 mod2' Modules to include
104111
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+
105161Available modules
106162-----------------
107163
151207----
152208
153209- jni/Android.mk must not include ttf/image/mixer if not asked by the user
154- - application should be automatically generated (Android.mk etc...)
155210- Python try always to import name.so, namemodule.so, name.py, name.pyo ?
156211- restore libpymodules.so loading to reduce the number of dlopen.
157212- if MODULES= change, the old build need to be cleaned
0 commit comments