Skip to content

Commit

Permalink
enable ctypes wip, hopefully fixes for kivy#301, kivy#333, kivy#319
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Marks committed Mar 18, 2015
1 parent 9797fe6 commit a9e88fe
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
1 change: 0 additions & 1 deletion distribute.sh
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,6 @@ function run_distribute() {
try find . | grep -E '*\.(py|pyc|so\.o|so\.a|so\.libs)$' | xargs rm

# we are sure that all of theses will be never used on android (well...)
try rm -rf ctypes
try rm -rf lib2to3
try rm -rf idlelib
try rm -rf config/libpython*.a
Expand Down
2 changes: 1 addition & 1 deletion recipes/python/patches/disable-modules.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# This global variable is used to hold the list of modules to be disabled.
-disabled_module_list = []
+disabled_module_list = ['spwd', '_ctypes','bz2','ossaudiodev','_curses','_curses_panel','readline','_locale','_bsddb','gdbm','dbm','nis','linuxaudiodev','crypt','_multiprocessing']
+disabled_module_list = ['spwd','bz2','ossaudiodev','_curses','_curses_panel','readline','_locale','_bsddb','gdbm','dbm','nis','linuxaudiodev','crypt','_multiprocessing']

def add_dir_to_list(dirlist, dir):
"""Add the directory 'dir' to the list 'dirlist' (at the front) if
11 changes: 9 additions & 2 deletions recipes/python/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function prebuild_python() {
fi

try patch -p1 < $RECIPE_python/patches/Python-$VERSION_python-xcompile.patch
try patch -p1 < $RECIPE_python/patches/Python-$VERSION_python-ctypes-disable-wchar.patch
try patch -p1 < $RECIPE_python/patches/disable-modules.patch
try patch -p1 < $RECIPE_python/patches/fix-locale.patch
try patch -p1 < $RECIPE_python/patches/fix-gethostbyaddr.patch
Expand Down Expand Up @@ -92,8 +93,13 @@ function build_python() {
export LDFLAGS="$LDFLAGS -L$SRC_PATH/obj/local/$ARCH/"
fi

try ./configure --host=arm-eabi OPT=$OFLAG --prefix="$BUILD_PATH/python-install" --enable-shared --disable-toolbox-glue --disable-framework
echo ./configure --host=arm-eabi OPT=$OFLAG --prefix="$BUILD_PATH/python-install" --enable-shared --disable-toolbox-glue --disable-framework
# CFLAGS for python ctypes library
export CFLAGS="$CFLAGS -DNO_MALLINFO"
export BUILDARCH=x86_64-linux-gnu
export HOSTARCH=arm-eabi

try ./configure --host=$HOSTARCH --build=$BUILDARCH OPT=$OFLAG --prefix="$BUILD_PATH/python-install" --enable-shared --disable-toolbox-glue --disable-framework
echo ./configure --host=$HOSTARCH --build=$BUILDARCH OPT=$OFLAG --prefix="$BUILD_PATH/python-install" --enable-shared --disable-toolbox-glue --disable-framework
echo $MAKE HOSTPYTHON=$BUILD_python/hostpython HOSTPGEN=$BUILD_python/hostpgen CROSS_COMPILE_TARGET=yes INSTSONAME=libpython2.7.so
cp HOSTPYTHON=$BUILD_python/hostpython python

Expand All @@ -117,6 +123,7 @@ function build_python() {
fi
try cp $BUILD_hostpython/hostpython $HOSTPYTHON
try cp libpython2.7.so $LIBS_PATH/
try cp -a build/lib.linux-x86_64-2.7/_ctypes*.so $LIBS_PATH

# reduce python
rm -rf "$BUILD_PATH/python-install/lib/python2.7/test"
Expand Down
2 changes: 2 additions & 0 deletions src/src/org/renpy/android/PythonService.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,11 @@ public void run(){
System.loadLibrary("python2.7");
System.loadLibrary("application");
System.loadLibrary("sdl_main");
System.loadLibrary("ctypes");

System.load(getFilesDir() + "/lib/python2.7/lib-dynload/_io.so");
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/unicodedata.so");
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/_ctypes.so");

try {
System.loadLibrary("sqlite3");
Expand Down

0 comments on commit a9e88fe

Please sign in to comment.