mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-18 07:46:09 +01:00
Merge pull request #132000 from fabaff/bump-python-magic
python3Packages.python_magic: 0.4.22 -> 0.4.24
This commit is contained in:
commit
03bb9193dd
2 changed files with 32 additions and 20 deletions
|
@ -10,13 +10,13 @@
|
|||
|
||||
buildPythonPackage rec {
|
||||
pname = "python-magic";
|
||||
version = "0.4.22";
|
||||
version = "0.4.24";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ahupp";
|
||||
repo = "python-magic";
|
||||
rev = version;
|
||||
sha256 = "0zbdjr5shijs0jayz7gycpx0kn6v2bh83dpanyajk2vmy47jvbd6";
|
||||
sha256 = "17jalhjbfd600lzfz296m0nvgp6c7vx1mgz82jbzn8hgdzknf4w0";
|
||||
};
|
||||
|
||||
patches = [
|
||||
|
@ -32,9 +32,10 @@ buildPythonPackage rec {
|
|||
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";
|
||||
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
|
||||
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')
|
||||
|
|
Loading…
Reference in a new issue