Skip to content

Commit 9bf0612

Browse files
committed
Made changes to apparently make ctypes work
1 parent 658a165 commit 9bf0612

File tree

4 files changed

+29
-6
lines changed

4 files changed

+29
-6
lines changed

pythonforandroid/bootstraps/sdl2/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ def run_distribute(self):
7777
for filename in glob.glob('config/libpython*.a'):
7878
shprint(sh.rm, '-f', filename)
7979
shprint(sh.rm, '-rf', 'config/python.o')
80-
shprint(sh.rm, '-rf', 'lib-dynload/_ctypes_test.so')
81-
shprint(sh.rm, '-rf', 'lib-dynload/_testcapi.so')
80+
# shprint(sh.rm, '-rf', 'lib-dynload/_ctypes_test.so')
81+
# shprint(sh.rm, '-rf', 'lib-dynload/_testcapi.so')
8282

8383

8484
info('Stripping libraries')

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void loadLibraries() {
7373
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/unicodedata.so");
7474

7575
try {
76-
System.loadLibrary("ctypes");
76+
// System.loadLibrary("ctypes");
7777
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/_ctypes.so");
7878
} catch(UnsatisfiedLinkError e) {
7979
Log.v(TAG, "Unsatisfied linker when loading ctypes");

pythonforandroid/recipes/python2/__init__.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,18 @@ def build_armeabi(self):
6666

6767
env = ArchAndroid(self.ctx).get_env()
6868

69+
# AND: Should probably move these to get_recipe_env for
70+
# neatness, but the whole recipe needs tidying along these
71+
# lines
72+
env['HOSTARCH'] = 'arm-eabi'
73+
env['BUILDARCH'] = shprint(sh.gcc, '-dumpmachine').stdout.split('\n')[0]
74+
env['CFLAGS'] = ' '.join([env['CFLAGS'], '-DNO_MALLINFO'])
75+
6976
configure = sh.Command('./configure')
7077
# AND: OFLAG isn't actually set, should it be?
71-
shprint(configure, '--host=arm-eabi',
78+
shprint(configure,
79+
'--host={}'.format(env['HOSTARCH']),
80+
'--build={}'.format(env['BUILDARCH']),
7281
# 'OPT={}'.format(env['OFLAG']),
7382
'--prefix={}'.format(join(self.ctx.build_dir, 'python-install')),
7483
'--enable-shared',
@@ -111,8 +120,8 @@ def build_armeabi(self):
111120

112121
print('Ready to copy .so for python arm')
113122
shprint(sh.cp, 'libpython2.7.so', self.ctx.libs_dir)
114-
for filen in glob.glob('build/lib.*-2.7/_ctypes*.so'):
115-
shprint(sh.cp, '-a', filen, self.ctx.libs_dir)
123+
# for filen in glob.glob('build/lib.*-2.7/_ctypes*.so'):
124+
# shprint(sh.cp, '-a', filen, self.ctx.libs_dir)
116125

117126
print('Copying hostpython binary to targetpython folder')
118127
shprint(sh.cp, self.ctx.hostpython,
@@ -131,5 +140,8 @@ def build_armeabi(self):
131140
shprint(sh.rm, '-rf', join(self.ctx.build_dir, 'python-install',
132141
'lib', 'python2.7', dir_name))
133142

143+
# print('python2 build done, exiting for debug')
144+
# exit(1)
145+
134146

135147
recipe = Python2Recipe()

pythonforandroid/recipes/python2/patches/Python-2.7.2-xcompile.patch

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,14 @@ diff -urN Python-2.7.2/setup.py ltib/rpm/BUILD/Python-2.7.2/setup.py
192192

193193
res = os.system(cmd)
194194
if res or not os.path.exists(ffi_configfile):
195+
--- Python-2.6.6.orig//Lib/plat-linux3/regen 1970-01-01 01:00:00.000000000 +0100
196+
+++ Python-2.6.6/Lib/plat-linux3/regen 2001-08-09 14:48:17.000000000 +0200
197+
@@ -0,0 +1,8 @@
198+
+#! /bin/sh
199+
+case `uname` in
200+
+Linux*) ;;
201+
+*) echo Probably not on a Linux system 1>&2
202+
+ exit 1;;
203+
+esac
204+
+set -v
205+
+h2py -i '(u_long)' /usr/include/sys/types.h /usr/include/netinet/in.h /usr/include/dlfcn.h

0 commit comments

Comments
 (0)