Skip to content

fix ctypes-util-find-library issue for python2 #1877

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pythonforandroid/recipes/python2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class Python2Recipe(GuestPythonRecipe):
'patches/fix-filesystem-default-encoding.patch',
'patches/fix-gethostbyaddr.patch',
'patches/fix-posix-declarations.patch',
'patches/fix-pwd-gecos.patch']
'patches/fix-pwd-gecos.patch',
'patches/fix-ctypes-util-find-library.patch']

configure_args = ('--host={android_host}',
'--build={android_build}',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff -u a/Lib/ctypes/util.py b/Lib/ctypes/util.py
--- a/Lib/ctypes/util.py 2019-06-20 18:52:01.372205226 +0200
+++ b/Lib/ctypes/util.py 2019-06-20 18:51:39.612970779 +0200
@@ -70,7 +70,14 @@
def find_library(name):
return name

-if os.name == "posix" and sys.platform == "darwin":
+# This patch overrides the find_library to look in the right places on
+# Android
+if True:
+ from android._ctypes_library_finder import find_library as _find_lib
+ def find_library(name):
+ return _find_lib(name)
+
+elif os.name == "posix" and sys.platform == "darwin":
from ctypes.macholib.dyld import dyld_find as _dyld_find
def find_library(name):
possible = ['lib%s.dylib' % name,