diff --git a/pkgs/development/python-modules/python-magic/default.nix b/pkgs/development/python-modules/python-magic/default.nix index 6737f1260733..02f1cc691522 100644 --- a/pkgs/development/python-modules/python-magic/default.nix +++ b/pkgs/development/python-modules/python-magic/default.nix @@ -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; [ ]; }; } diff --git a/pkgs/development/python-modules/python-magic/libmagic-path.patch b/pkgs/development/python-modules/python-magic/libmagic-path.patch index 5a1dbec7d51b..e9530d6ddf75 100644 --- a/pkgs/development/python-modules/python-magic/libmagic-path.patch +++ b/pkgs/development/python-modules/python-magic/libmagic-path.patch @@ -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')