python3Packages.python_magic: 0.4.22 -> 0.4.24
This commit is contained in:
parent
8963fb9ff9
commit
d653ff37b3
|
@ -10,13 +10,13 @@
|
||||||
|
|
||||||
buildPythonPackage rec {
|
buildPythonPackage rec {
|
||||||
pname = "python-magic";
|
pname = "python-magic";
|
||||||
version = "0.4.22";
|
version = "0.4.24";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "ahupp";
|
owner = "ahupp";
|
||||||
repo = "python-magic";
|
repo = "python-magic";
|
||||||
rev = version;
|
rev = version;
|
||||||
sha256 = "0zbdjr5shijs0jayz7gycpx0kn6v2bh83dpanyajk2vmy47jvbd6";
|
sha256 = "17jalhjbfd600lzfz296m0nvgp6c7vx1mgz82jbzn8hgdzknf4w0";
|
||||||
};
|
};
|
||||||
|
|
||||||
patches = [
|
patches = [
|
||||||
|
@ -32,9 +32,10 @@ buildPythonPackage rec {
|
||||||
LC_ALL="en_US.UTF-8" ${python.interpreter} test/test.py
|
LC_ALL="en_US.UTF-8" ${python.interpreter} test/test.py
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = with lib; {
|
||||||
description = "A python interface to the libmagic file type identification library";
|
description = "A python interface to the libmagic file type identification library";
|
||||||
homepage = "https://github.com/ahupp/python-magic";
|
homepage = "https://github.com/ahupp/python-magic";
|
||||||
license = lib.licenses.mit;
|
license = licenses.mit;
|
||||||
|
maintainers = with maintainers; [ ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,28 @@
|
||||||
diff --git a/magic/loader.py b/magic/loader.py
|
diff --git i/magic/loader.py w/magic/loader.py
|
||||||
index 6b2bfcb..69778af 100644
|
index 931f161..b8096d1 100644
|
||||||
--- a/magic/loader.py
|
--- i/magic/loader.py
|
||||||
+++ b/magic/loader.py
|
+++ w/magic/loader.py
|
||||||
@@ -5,11 +5,7 @@ import glob
|
@@ -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@'
|
|
||||||
|
|
||||||
# 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')
|
||||||
|
|
Loading…
Reference in a new issue