8000 improve doc to explain how its working. · abgoyal/python-for-android@f7b6b64 · GitHub
[go: up one dir, main page]

Skip to content

Commit f7b6b64

Browse files
committed
improve doc to explain how its working.
1 parent 3947edd commit f7b6b64

File tree

2 files changed

+60
-10
lines changed

2 files changed

+60
-10
lines changed

README.rst

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
Python for Android
22
==================
33

4-
===== THE PROJECT IS NOT USABLE YET =====
5-
6-
74
Python for android is a project to create your own Python distribution
85
including the modules you want, and create an apk including python, libs, and
96
your 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

2734
Prerequisites
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+
105161
Available modules
106162
-----------------
107163

@@ -151,7 +207,6 @@ TODO
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

distribute.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ function run_distribute() {
424424
cd "$DIST_PATH"
425425

426426
debug "Create initial layout"
427-
try mkdir assets bin gen obj private res templates
427+
try mkdir assets bin private res templates
428428

429429
debug "Copy default files"
430430
try cp -a $SRC_PATH/default.properties .
@@ -523,9 +523,4 @@ while getopts ":hvlm:d:" opt; do
523523
esac
524524
done
525525

526-
package=${*:$OPTIND:1}
527-
if [ "X$package" == "X" ]; then
528-
usage
529-
fi
530-
531526
run

0 commit comments

Comments
 (0)
0