Skip to content

Commit e494c25

Browse files
authored
Merge pull request kivy#1877 from surbhicis/py2-ctypes-fixes
fix ctypes-util-find-library issue for python2
2 parents 6f99407 + 5795852 commit e494c25

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

pythonforandroid/recipes/python2/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ class Python2Recipe(GuestPythonRecipe):
3131
'patches/fix-filesystem-default-encoding.patch',
3232
'patches/fix-gethostbyaddr.patch',
3333
'patches/fix-posix-declarations.patch',
34-
'patches/fix-pwd-gecos.patch']
34+
'patches/fix-pwd-gecos.patch',
35+
'patches/fix-ctypes-util-find-library.patch']
3536

3637
configure_args = ('--host={android_host}',
3738
'--build={android_build}',
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
diff -u a/Lib/ctypes/util.py b/Lib/ctypes/util.py
2+
--- a/Lib/ctypes/util.py 2019-06-20 18:52:01.372205226 +0200
3+
+++ b/Lib/ctypes/util.py 2019-06-20 18:51:39.612970779 +0200
4+
@@ -70,7 +70,14 @@
5+
def find_library(name):
6+
return name
7+
8+
-if os.name == "posix" and sys.platform == "darwin":
9+
+# This patch overrides the find_library to look in the right places on
10+
+# Android
11+
+if True:
12+
+ from android._ctypes_library_finder import find_library as _find_lib
13+
+ def find_library(name):
14+
+ return _find_lib(name)
15+
+
16+
+elif os.name == "posix" and sys.platform == "darwin":
17+
from ctypes.macholib.dyld import dyld_find as _dyld_find
18+
def find_library(name):
19+
possible = ['lib%s.dylib' % name,

0 commit comments

Comments
 (0)