diff options
| author | Adam Hupp <adam@hupp.org> | 2012-05-22 11:56:03 -0700 |
|---|---|---|
| committer | Adam Hupp <adam@hupp.org> | 2012-05-22 11:56:03 -0700 |
| commit | 6c23fa27c62c1b3dc0da842fb5e06c7d7aecbfe2 (patch) | |
| tree | 970bb9df1acbf01957db9b65a0bbc11f5f3bd256 | |
| parent | 3a0f5ed70233f11a2ef2d6cd730a513c4edcb395 (diff) | |
| parent | cfd01bf24b9c89fe26ffebafeaccfa16977717da (diff) | |
| download | python-magic-6c23fa27c62c1b3dc0da842fb5e06c7d7aecbfe2.tar.gz | |
Merge pull request #17 from fallgesetz/master
Added libmagic.dylib path for homebrew package manager
| -rw-r--r-- | magic.py | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -27,8 +27,8 @@ class MagicException(Exception): pass class Magic: """ - Magic is a wrapper around the libmagic C library. - + Magic is a wrapper around the libmagic C library. + """ def __init__(self, mime=False, magic_file=None, mime_encoding=False): @@ -38,7 +38,7 @@ class Magic: mime - if True, mimetypes are returned instead of textual descriptions mime_encoding - if True, codec is returned magic_file - use a mime database other than the system default - + """ flags = MAGIC_NONE if mime: @@ -65,7 +65,7 @@ class Magic: if not os.path.exists(filename): raise IOError("File does not exist: " + filename) - + return magic_file(self.cookie, filename) def __del__(self): @@ -115,8 +115,9 @@ 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'], + platform_to_lib = {'darwin': ['/opt/local/lib/libmagic.dylib', + '/usr/local/lib/libmagic.dylib', + '/usr/local/Cellar/libmagic/5.10/lib/libmagic.dylib'], 'win32': ['magic1.dll']} for dll in platform_to_lib.get(sys.platform, []): try: |
