python3Packages.python_magic: 0.4.22 -> 0.4.24

This commit is contained in:
Fabian Affolter
2021-07-29 22:58:03 +02:00
committed by Sandro Jäckel
parent 8963fb9ff9
commit d653ff37b3
2 changed files with 32 additions and 20 deletions

View File

@@ -1,17 +1,28 @@
diff --git a/magic/loader.py b/magic/loader.py
index 6b2bfcb..69778af 100644
--- a/magic/loader.py
+++ b/magic/loader.py
@@ -5,11 +5,7 @@ import glob
def load_lib():
libmagic = None
# Let's try to find magic or magic1
- dll = ctypes.util.find_library('magic') \
- or ctypes.util.find_library('magic1') \
- or ctypes.util.find_library('cygmagic-1') \
- or ctypes.util.find_library('libmagic-1') \
- or ctypes.util.find_library('msys-magic-1') # for MSYS2
+ dll = '@libmagic@'
diff --git i/magic/loader.py w/magic/loader.py
index 931f161..b8096d1 100644
--- i/magic/loader.py
+++ w/magic/loader.py
@@ -35,16 +35,12 @@ def _lib_candidates():
# necessary because find_library returns None if it doesn't find the library
if dll:
def load_lib():
+ lib = '@libmagic@'
- for lib in _lib_candidates():
- # find_library returns None when lib not found
- if lib is None:
- continue
- try:
- return ctypes.CDLL(lib)
- except OSError:
- pass
- else:
- # It is better to raise an ImportError since we are importing magic module
- raise ImportError('failed to find libmagic. Check your installation')
+ try:
+ return ctypes.CDLL(lib)
+ except OSError:
+ pass
+ # It is better to raise an ImportError since we are importing magic module
+ raise ImportError('failed to find libmagic. Check your installation')