Created
August 22, 2011 18:50
-
-
Save anonymous/1163171 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/freetype/__init__.py b/freetype/__init__.py | |
index e175d52..e602d9c 100644 | |
--- a/freetype/__init__.py | |
+++ b/freetype/__init__.py | |
@@ -30,15 +30,24 @@ import ctypes.util | |
__dll__ = None | |
__handle__ = None | |
FT_Library_filename = ctypes.util.find_library('freetype') | |
+ | |
if not FT_Library_filename: | |
- try: | |
- __dll__ = ctypes.CDLL('libfreetype.so.6') | |
- except OSError: | |
- __dll__ = None | |
+ | |
+ paths_to_try = [ 'libfreetype.so.6', # Linux | |
+ '/usr/X11/lib/libfreetype.dylib' # MacOS X | |
+ ] | |
+ for p in paths_to_try: | |
+ try: | |
+ __dll__ = ctypes.CDLL(p) | |
+ except OSError: | |
+ pass | |
+ | |
+ if __dll__ is not None: | |
+ break | |
if not FT_Library_filename and not __dll__: | |
raise RuntimeError, 'Freetype library not found' | |
if not __dll__: | |
- __dll__ = ctypes.CDLL(FT_Library_filename) | |
+ __dll__ = ctypes.CDLL(FT_Library_filename) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment