From 2ad7463144b4917db34aac7ec7bfaf78e06c4391 Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Thu, 2 Jul 2015 23:04:52 +0300 Subject: [PATCH] pythonPackages.magic: Fix loading libmagic.so Even with the previous `python.patch` file around, libmagic.so isn't found. Instead patch it to use an absolute path, using a similar approach that is used by the `python_magic` package (which is another libmagic python wrapper library as well). --- pkgs/tools/misc/file/python.patch | 11 ----------- pkgs/top-level/python-packages.nix | 5 ++++- 2 files changed, 4 insertions(+), 12 deletions(-) delete mode 100644 pkgs/tools/misc/file/python.patch diff --git a/pkgs/tools/misc/file/python.patch b/pkgs/tools/misc/file/python.patch deleted file mode 100644 index 8ecbc9a81fd..00000000000 --- a/pkgs/tools/misc/file/python.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- file-5.11/python/magic.py 2011-09-22 18:57:41.000000000 +0200 -+++ file-5.11/python/magic.py.1 2012-04-30 15:00:31.750213810 +0200 -@@ -13,7 +13,7 @@ - Loads the shared library through ctypes and returns a library - L{ctypes.CDLL} instance - """ -- return ctypes.cdll.LoadLibrary(find_library('magic')) -+ return ctypes.CDLL('libmagic.so') - - _libraries = {} - _libraries['magic'] = _init() diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 377afc06624..c847a586b9b 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7042,7 +7042,10 @@ let src = pkgs.file.src; - patches = [ ../tools/misc/file/python.patch ]; + patchPhase = '' + substituteInPlace python/magic.py --replace "find_library('magic')" "'${pkgs.file}/lib/libmagic.so'" + ''; + buildInputs = with self; [ python pkgs.file ]; preConfigure = "cd python";