Skip to content

Commit 792d76a

Browse files
committed
add py3 support to PythonUtil load
1 parent 04d6dcd commit 792d76a

File tree

1 file changed

+30
-14
lines changed

1 file changed

+30
-14
lines changed

pythonforandroid/bootstraps/sdl2/build/src/org/kivy/android/PythonUtil.java

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,41 @@ protected static String[] getLibraries() {
1414
"SDL2_image",
1515
"SDL2_mixer",
1616
"SDL2_ttf",
17-
"python2.7",
1817
"main"
1918
};
2019
}
2120

2221
public static void loadLibraries(File filesDir) {
2322
for (String lib : getLibraries()) {
24-
System.loadLibrary(lib);
25-
}
26-
27-
System.load(filesDir + "/lib/python2.7/lib-dynload/_io.so");
28-
System.load(filesDir + "/lib/python2.7/lib-dynload/unicodedata.so");
29-
30-
try {
31-
System.load(filesDir + "/lib/python2.7/lib-dynload/_ctypes.so");
32-
} catch(UnsatisfiedLinkError e) {
33-
Log.v(TAG, "Unsatisfied linker when loading ctypes");
34-
}
35-
36-
Log.v(TAG, "Loaded everything!");
23+
System.loadLibrary(lib);
24+
}
25+
26+
try {
27+
System.loadLibrary("python2.7");
28+
} catch(UnsatisfiedLinkError e) {
29+
Log.v(TAG, "Failed to load libpython2.7");
30+
}
31+
32+
try {
33+
System.loadLibrary("python3.5m");
34+
} catch(UnsatisfiedLinkError e) {
35+
Log.v(TAG, "Failed to load libpython3.5m");
36+
}
37+
38+
try {
39+
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/_io.so");
40+
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/unicodedata.so");
41+
} catch(UnsatisfiedLinkError e) {
42+
Log.v(TAG, "Failed to load _io.so or unicodedata.so...but that's okay.");
43+
}
44+
45+
try {
46+
// System.loadLibrary("ctypes");
47+
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/_ctypes.so");
48+
} catch(UnsatisfiedLinkError e) {
49+
Log.v(TAG, "Unsatisfied linker when loading ctypes");
50+
}
51+
52+
Log.v(TAG, "Loaded everything!");
3753
}
3854
}

0 commit comments

Comments
 (0)