aboutsummaryrefslogtreecommitdiff
path: root/tools/depends/target/pythonmodule-pycryptodome/02-android-dlopen.patch
blob: 2253426e7c721f2c8be5a809348d79d392b1a41a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--- lib/Crypto/Util/_raw_api_o.py	2017-01-19 07:49:10.126996702 +0100
+++ lib/Crypto/Util/_raw_api.py	2017-01-19 11:16:23.126321052 +0100
@@ -101,11 +101,14 @@
     def load_lib(name, cdecl):
         import platform
         bits, linkage = platform.architecture()
-        if "." not in name and not linkage.startswith("Win"):
-            full_name = find_library(name)
-            if full_name is None:
-                raise OSError("Cannot load library '%s'" % name)
-            name = full_name
+        try:
+            if "." not in name and not linkage.startswith("Win"):
+                full_name = find_library(name)
+                if full_name is None:
+                    raise OSError("Cannot load library '%s'" % name)
+                name = full_name
+        except IOError:
+            raise OSError("Cannot load library '%s'" % name)
         return CDLL(name)
 
     def get_c_string(c_string):
@@ -165,7 +168,7 @@
     for ext, mod, typ in imp.get_suffixes():
         if typ == imp.C_EXTENSION:
             try:
-                return load_lib(pycryptodome_filename(dir_comps, basename + ext), cdecl)
+                return load_lib("lib" + name.replace(".", "_") + ".so", cdecl)
             except OSError:
                 pass
     raise OSError("Cannot load native module '%s'" % name)