summaryrefslogtreecommitdiff
path: root/magic.py
diff options
context:
space:
mode:
authorArtem Skoretskiy <artem.skoretskiy@gmail.com>2016-12-21 23:52:14 +0100
committerGitHub <noreply@github.com>2016-12-21 23:52:14 +0100
commitf6206535deca111375034e0277cf0e0aa9bd3fe1 (patch)
treeb8d1ca7603675c2019de433bd93b77f75a9c919d /magic.py
parent7ac0c2cc3ef7c3af32a5c51b2187edbf58898a63 (diff)
downloadpython-magic-f6206535deca111375034e0277cf0e0aa9bd3fe1.tar.gz
Added a fallback for Alpine to find library file
There are some Linuxes that have libraries search broken. This commit would add a reasonable fallback for these systems. Otherwise python-magic does not work there having "magic" library installed and python-magic from Pypi.
Diffstat (limited to 'magic.py')
-rw-r--r--magic.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/magic.py b/magic.py
index b07fd2b..adc2381 100644
--- a/magic.py
+++ b/magic.py
@@ -160,7 +160,9 @@ if not libmagic or not libmagic._name:
# Assumes there will only be one version installed
glob.glob('/usr/local/Cellar/libmagic/*/lib/libmagic.dylib'),
'win32': windows_dlls,
- 'cygwin': windows_dlls }
+ 'cygwin': windows_dlls,
+ 'linux': 'libmagic.so.1', # fallback for some Linuxes (e.g. Alpine) where library search does not work
+ }
for dll in platform_to_lib.get(sys.platform, []):
try:
libmagic = ctypes.CDLL(dll)