parent
8963fb9ff9
commit
d653ff37b3
@ -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
|
||||
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():
|
||||
|
||||
|
||||
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@'
|
||||
+ 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
|
||||
|
||||
# necessary because find_library returns None if it doesn't find the library
|
||||
if dll:
|
||||
+ # It is better to raise an ImportError since we are importing magic module
|
||||
+ raise ImportError('failed to find libmagic. Check your installation')
|
||||
|
Loading…
Reference in new issue