1212
1313def _lib_candidates_linux ():
1414 """Yield possible libmagic library names on Linux."""
15- fnames = (' libmagic.so.1' , ' libmagic.so' )
15+ fnames = (" libmagic.so.1" , " libmagic.so" )
1616
1717 for fname in fnames :
1818 # libmagic bundled in the wheel
1919 yield os .path .join (here , fname )
2020 # libmagic in the current working directory
21- yield os .path .join (os .path .abspath ('.' ), fname )
21+ yield os .path .join (os .path .abspath ("." ), fname )
2222 # libmagic install from source default destination path
23- yield os .path .join (' /usr/local/lib' , fname )
23+ yield os .path .join (" /usr/local/lib" , fname )
2424 # on some linux systems (musl/alpine), find_library('magic') returns None
2525 # first try finding libmagic using ldconfig
2626 # otherwise fall back to /usr/lib/
2727 yield subprocess .check_output (
28- "( ldconfig -p | grep '{0}' | grep -o '/.*' ) || echo '/usr/lib/{0}'" .format (fname ),
28+ "( ldconfig -p | grep '{0}' | grep -o '/.*' ) || echo '/usr/lib/{0}'" .format (
29+ fname
30+ ),
2931 shell = True ,
3032 universal_newlines = True ,
3133 ).strip ()
@@ -37,15 +39,15 @@ def _lib_candidates_macos():
3739 # libmagic bundled in the wheel
3840 here ,
3941 # libmagic in the current working directory
40- os .path .abspath ('.' ),
42+ os .path .abspath ("." ),
4143 # libmagic in other common sources like homebrew
42- ' /opt/local/lib' ,
43- ' /usr/local/lib' ,
44- ' /opt/homebrew/lib' ,
45- ] + glob .glob (' /usr/local/Cellar/libmagic/*/lib' )
44+ " /opt/local/lib" ,
45+ " /usr/local/lib" ,
46+ " /opt/homebrew/lib" ,
47+ ] + glob .glob (" /usr/local/Cellar/libmagic/*/lib" )
4648
4749 for path in paths :
48- yield os .path .join (path , ' libmagic.dylib' )
50+ yield os .path .join (path , " libmagic.dylib" )
4951
5052
5153def _lib_candidates_windows ():
@@ -61,9 +63,9 @@ def _lib_candidates_windows():
6163
6264 for fname in fnames :
6365 # libmagic bundled in the wheel
64- yield os .path .join (here , ' %s.dll' % fname )
66+ yield os .path .join (here , " %s.dll" % fname )
6567 # libmagic in the current working directory
66- yield os .path .join (os .path .abspath ('.' ), ' %s.dll' % fname )
68+ yield os .path .join (os .path .abspath ("." ), " %s.dll" % fname )
6769 # find_library searches in %PATH% but not the current directory
6870 yield find_library (fname )
6971
@@ -83,7 +85,7 @@ def _lib_candidates():
8385 yield path
8486
8587 # fallback
86- yield find_library (' magic' )
88+ yield find_library (" magic" )
8789
8890
8991def load_lib ():
0 commit comments