summary refs log tree commit diff
path: root/pkgs/development/python-modules/python-magic/libmagic-path.patch
blob: e9530d6ddf75cd5210bd0e9e740746be7d7167aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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():
+  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')