From f6206535deca111375034e0277cf0e0aa9bd3fe1 Mon Sep 17 00:00:00 2001 From: Artem Skoretskiy Date: Wed, 21 Dec 2016 23:52:14 +0100 Subject: 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. --- magic.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) -- cgit v1.2.1