diff options
| author | Adam Hupp <adam@hupp.org> | 2013-09-27 10:12:02 -0700 |
|---|---|---|
| committer | Adam Hupp <adam@hupp.org> | 2013-09-27 10:12:02 -0700 |
| commit | 1c0e88ea75917a1abd157525968294af7f0da95a (patch) | |
| tree | 1545550a4e7e14191350cd4fd86ddb6bd8a2aec1 | |
| parent | 1f804dcead2a83f5dfbf6309f7fe56a6e38476b7 (diff) | |
| download | python-magic-1c0e88ea75917a1abd157525968294af7f0da95a.tar.gz | |
Don't hard-code version number when finding homebrew library
| -rw-r--r-- | magic.py | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -18,6 +18,7 @@ Usage: """ import sys +import glob import os.path import ctypes import ctypes.util @@ -144,12 +145,14 @@ if dll: if not libmagic or not libmagic._name: import sys platform_to_lib = {'darwin': ['/opt/local/lib/libmagic.dylib', - '/usr/local/lib/libmagic.dylib', - '/usr/local/Cellar/libmagic/5.10/lib/libmagic.dylib'], + '/usr/local/lib/libmagic.dylib'] + + # Assumes there will only be one version installed + glob.glob('/usr/local/Cellar/libmagic/*/lib/libmagic.dylib'), 'win32': ['magic1.dll']} for dll in platform_to_lib.get(sys.platform, []): try: libmagic = ctypes.CDLL(dll) + break except OSError: pass |
