Skip to content

Commit

Permalink
Merge ec20771 into 1386490
Browse files Browse the repository at this point in the history
  • Loading branch information
fdobrovolny committed Jul 9, 2018
2 parents 1386490 + ec20771 commit 9b034e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CONTRIBUTORS
Expand Up @@ -6,3 +6,9 @@ erhudy
``````
* added a small patch to correct import behavior on Solaris,
where ctypes.util.find_library does not function correctly.

brnopcman
`````````

* added a small patch to correct import behavior on Alpine linux
where ctypes.util.find_library does not function correctly.
6 changes: 6 additions & 0 deletions magic/api.py
Expand Up @@ -18,6 +18,12 @@
"If import fails, verify that libmagic is installed "
"to a directory registered with crle. ".format(libname),
ImportWarning)
elif platform.system() == 'Linux':
libname = 'libmagic.so.1'
warnings.warn("ctypes.util.find_library wasn't been able to locate "
"libmagic; manually setting libname to {0}. "
"If import fails, verify that libmagic is installed."
.format(libname), ImportWarning)
else:
raise ImportError('Unable to find magic library')

Expand Down

0 comments on commit 9b034e1

Please sign in to comment.