google-code-export / pyglet

Automatically exported from code.google.com/p/pyglet
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Support for local libraries #671

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
We currently have 3 library loaders:

 - LinuxLibraryLoader (Linux)
 - MachOLibraryLoader (Mac)
 - LibraryLoader (generic when Linux and Mac aren't detected)

For some reason the generic loader repeats some functionality that is better 
implemented in the specific ones, but never mind (I've fixed a bug on that).

This patch will make pyglet to load libraries found in the same directory of 
the running script or its 'lib' subdirectory, *before* trying the system 
libraries using ctypes.util.find_library (if available).

This is useful to distribute libraries with any pyglet project.

The patch adds specific support for Linux and Mac (Windows loads any DLL from 
current directory by default).

In Linux I've refactored the code to find libraries and now is used both for 
looking for local libs and in the fallback mechanism when ctypes' find_library 
doesn't work.

In Mac I just prepended the paths to the ld_library_path as if LD_LIBRARY_PATH 
were used.

I've added a new option in pyglet.options to disable this using 
"search_local_libs" to False (True by default).

Patch attached, please comment!

Original issue reported on code.google.com by useboxnet on 28 Sep 2013 at 7:37

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was closed by revision da26d7e1c3e7.

Original comment by useboxnet on 28 Sep 2013 at 9:45