Skip to content

Commit 60481dc

Browse files
committed
Merge branch 'master' of github.com:kivy/python-for-android
2 parents a923a32 + e617c5c commit 60481dc

File tree

4 files changed

+54
-5
lines changed

4 files changed

+54
-5
lines changed

docs/source/usage.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ Then, the android package (APK) will be generated at:
4141

4242
bin/touchtracer-1.0-debug.apk
4343

44+
.. warning::
45+
46+
Some files and modules for python are blacklisted by default to
47+
save a few megabytes on the final apk file, in case your
48+
applications doesn't find a standard python module, check the
49+
src/blacklist.txt file remove the module you need from the list,
50+
and try again.
51+
4452
Available options to `build.py`::
4553

4654
-h, --help show this help message and exit
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
--- Python-2.7.2.orig/Modules/termios.c 2012-06-12 02:49:39.780162534 +0200
2+
+++ Python-2.7.2/Modules/termios.c 2012-06-12 02:51:52.092157828 +0200
3+
@@ -227,6 +227,7 @@
4+
return Py_None;
5+
}
6+
7+
+#if 0 // No tcdrain defined for Android.
8+
PyDoc_STRVAR(termios_tcdrain__doc__,
9+
"tcdrain(fd) -> None\n\
10+
\n\
11+
@@ -246,6 +247,7 @@
12+
Py_INCREF(Py_None);
13+
return Py_None;
14+
}
15+
+#endif
16+
17+
PyDoc_STRVAR(termios_tcflush__doc__,
18+
"tcflush(fd, queue) -> None\n\
19+
@@ -301,8 +303,10 @@
20+
METH_VARARGS, termios_tcsetattr__doc__},
21+
{"tcsendbreak", termios_tcsendbreak,
22+
METH_VARARGS, termios_tcsendbreak__doc__},
23+
+#if 0 // No tcdrain defined for Android.
24+
{"tcdrain", termios_tcdrain,
25+
METH_VARARGS, termios_tcdrain__doc__},
26+
+#endif
27+
{"tcflush", termios_tcflush,
28+
METH_VARARGS, termios_tcflush__doc__},
29+
{"tcflow", termios_tcflow,

recipes/python/recipe.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ function prebuild_python() {
2424
try patch -p1 < $RECIPE_python/patches/fix-gethostbyaddr.patch
2525
try patch -p1 < $RECIPE_python/patches/fix-setup-flags.patch
2626
try patch -p1 < $RECIPE_python/patches/fix-filesystemdefaultencoding.patch
27+
try patch -p1 < $RECIPE_python/patches/fix-termios.patch
2728
try patch -p1 < $RECIPE_python/patches/custom-loader.patch
2829
try patch -p1 < $RECIPE_python/patches/verbose-compilation.patch
2930

src/src/org/renpy/android/SDLSurfaceView.java

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,8 @@ public void waitForResume() {
405405
public static void setOpenFile(){
406406
final android.content.Intent intent = mActivity.getIntent();
407407
if (intent != null) {
408-
final android.net.Uri data = intent.getData ();
409-
if (data != null){
408+
final android.net.Uri data = intent.getData();
409+
if (data != null && data.getEncodedPath() != null){
410410
nativeSetEnv("PYTHON_OPENFILE", data.getEncodedPath());
411411
}
412412
}
@@ -610,9 +610,8 @@ public void run() {
610610
return;
611611
}
612612

613-
Log.w(TAG, "Done");
614-
waitForStart();
615-
setOpenFile();
613+
Log.w(TAG, "Done");
614+
waitForStart();
616615

617616
nativeResize(mWidth, mHeight);
618617
nativeInitJavaCallbacks();
@@ -621,6 +620,18 @@ public void run() {
621620
nativeSetEnv("PYTHONOPTIMIZE", "2");
622621
nativeSetEnv("PYTHONHOME", mFilesDirectory);
623622
nativeSetEnv("PYTHONPATH", mArgument + ":" + mFilesDirectory + "/lib");
623+
624+
// XXX Using SetOpenFile make a crash in nativeSetEnv. I don't
625+
// understand why, maybe because the method is static or something.
626+
// Anyway, if you remove that part of the code, ensure the Laucher
627+
// (ProjectChooser) is still working.
628+
final android.content.Intent intent = mActivity.getIntent();
629+
if (intent != null) {
630+
final android.net.Uri data = intent.getData();
631+
if (data != null && data.getEncodedPath() != null)
632+
nativeSetEnv("PYTHON_OPENFILE", data.getEncodedPath());
633+
}
634+
624635
nativeSetMultitouchUsed();
625636
nativeInit();
626637

0 commit comments

Comments
 (0)