Skip to content

Commit 45f8b74

Browse files
committed
Undefine HAVE_FTIME for Android API > 19
The sys/timeb.h header was removed in Android 21, because this header and the ftime function were removed from the POSIX 2008 specification. (Info reference: https://rbcommons.com/s/OpenH264/r/683/diff/1/ )
1 parent 21acd88 commit 45f8b74

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

pythonforandroid/recipes/python2/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Python2Recipe(Recipe):
1111
url = 'http://python.org/ftp/python/{version}/Python-{version}.tar.bz2'
1212
name = 'python2'
1313

14-
depends = ['hostpython2']
14+
depends = ['hostpython2']
1515
conflicts = ['python3']
1616

1717
def prebuild_armeabi(self):
@@ -39,6 +39,9 @@ def prebuild_armeabi(self):
3939
self.apply_patch(join('patches', 'fix-configure-darwin.patch'))
4040
self.apply_patch(join('patches', 'fix-distutils-darwin.patch'))
4141

42+
if self.ctx.android_api > 19:
43+
self.apply_patch(join('patches', 'fix-ftime-removal.patch'))
44+
4245
shprint(sh.touch, join(build_dir, '.patched'))
4346

4447
def build_armeabi(self):
@@ -125,7 +128,7 @@ def do_python_build(self):
125128
_env=env)
126129
except sh.ErrorReturnCode_2:
127130
print('First python2 make failed. This is expected, trying again.')
128-
131+
129132

130133
print('Second install (expected to work)')
131134
shprint(sh.touch, 'python.exe', 'python')
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
diff -u -r Python-2.7.2.orig/Modules/timemodule.c Python-2.7.2/Modules/timemodule.c
2+
--- Python-2.7.2.orig/Modules/timemodule.c 2011-06-11 15:46:27.000000000 +0000
3+
+++ Python-2.7.2/Modules/timemodule.c 2015-09-11 10:37:36.708661691 +0000
4+
@@ -27,6 +27,7 @@
5+
#include <io.h>
6+
#endif
7+
8+
+#undef HAVE_FTIME
9+
#ifdef HAVE_FTIME
10+
#include <sys/timeb.h>
11+
#if !defined(MS_WINDOWS) && !defined(PYOS_OS2)

0 commit comments

Comments
 (0)