2019-09-22 16:27:36 +02:00
|
|
|
Patch dlopen() to allow direct paths to all required libs
|
2016-02-06 08:11:53 +01:00
|
|
|
|
2019-09-22 16:27:36 +02:00
|
|
|
This is an update of the patch submitted in
|
|
|
|
https://github.com/NixOS/nixpkgs/commit/b13e44e094989d3a902f8c73b22e8d3c0cc7acf4
|
|
|
|
by Alexander V. Nikolaev <avn@avnik.info>
|
2019-05-22 13:03:39 +02:00
|
|
|
|
2019-09-22 16:27:36 +02:00
|
|
|
---
|
|
|
|
cairocffi/__init__.py | 34 ++++++++++++++++------------------
|
|
|
|
1 file changed, 16 insertions(+), 18 deletions(-)
|
2016-02-06 08:11:53 +01:00
|
|
|
|
|
|
|
diff --git a/cairocffi/__init__.py b/cairocffi/__init__.py
|
2019-09-22 16:27:36 +02:00
|
|
|
index 307d58c..43c29e3 100644
|
2016-02-06 08:11:53 +01:00
|
|
|
--- a/cairocffi/__init__.py
|
|
|
|
+++ b/cairocffi/__init__.py
|
2019-09-22 16:27:36 +02:00
|
|
|
@@ -21,28 +21,26 @@ VERSION = __version__ = (Path(__file__).parent / 'VERSION').read_text().strip()
|
|
|
|
version = '1.17.2'
|
|
|
|
version_info = (1, 17, 2)
|
2019-05-22 13:03:39 +02:00
|
|
|
|
2019-09-22 16:27:36 +02:00
|
|
|
+# Use hardcoded soname, because ctypes.util use gcc/objdump which shouldn't be
|
|
|
|
+# required for runtime
|
2016-02-06 08:11:53 +01:00
|
|
|
+_LIBS = {
|
2018-06-06 09:17:52 +02:00
|
|
|
+ 'cairo': '@cairo@/lib/libcairo@ext@',
|
|
|
|
+ 'glib-2.0': '@glib@/lib/libglib-2.0@ext@',
|
|
|
|
+ 'gobject-2.0': '@glib@/lib/libgobject-2.0@ext@',
|
2019-08-03 21:57:40 +02:00
|
|
|
+ 'gdk_pixbuf-2.0': '@gdk_pixbuf@/lib/libgdk_pixbuf-2.0@ext@',
|
2016-02-06 08:11:53 +01:00
|
|
|
+}
|
2019-09-22 16:27:36 +02:00
|
|
|
+
|
2019-05-22 13:03:39 +02:00
|
|
|
|
2019-09-22 16:27:36 +02:00
|
|
|
def dlopen(ffi, library_names, filenames):
|
2016-02-06 08:11:53 +01:00
|
|
|
"""Try various names for the same library, for different platforms."""
|
2019-09-22 16:27:36 +02:00
|
|
|
- exceptions = []
|
|
|
|
-
|
|
|
|
for library_name in library_names:
|
|
|
|
- library_filename = find_library(library_name)
|
|
|
|
- if library_filename:
|
|
|
|
- filenames = (library_filename,) + filenames
|
|
|
|
- else:
|
|
|
|
- exceptions.append(
|
|
|
|
- 'no library called "{}" was found'.format(library_name))
|
|
|
|
-
|
|
|
|
- for filename in filenames:
|
|
|
|
- try:
|
|
|
|
- return ffi.dlopen(filename)
|
|
|
|
- except OSError as exception: # pragma: no cover
|
|
|
|
- exceptions.append(exception)
|
|
|
|
-
|
|
|
|
- error_message = '\n'.join( # pragma: no cover
|
|
|
|
- str(exception) for exception in exceptions)
|
|
|
|
- raise OSError(error_message) # pragma: no cover
|
|
|
|
+ path = _LIBS.get(library_name, None)
|
|
|
|
+ if path:
|
|
|
|
+ lib = ffi.dlopen(path)
|
|
|
|
+ if lib:
|
|
|
|
+ return lib
|
|
|
|
+
|
|
|
|
+ raise OSError("dlopen() failed to load a library: %s as %s" % (library_name, path))
|
2019-05-22 13:03:39 +02:00
|
|
|
|
|
|
|
|
2019-09-22 16:27:36 +02:00
|
|
|
cairo = dlopen(
|
|
|
|
--
|
|
|
|
2.19.2
|