1{ buildPythonPackage, lib, fetchPypi, file, stdenv }:
2
3buildPythonPackage rec {
4 pname = "python-magic";
5 version = "0.4.18";
6
7 src = fetchPypi {
8 inherit pname version;
9 sha256 = "b757db2a5289ea3f1ced9e60f072965243ea43a2221430048fd8cacab17be0ce";
10 };
11
12 postPatch = ''
13 substituteInPlace magic.py --replace "ctypes.util.find_library('magic')" "'${file}/lib/libmagic${stdenv.hostPlatform.extensions.sharedLibrary}'"
14 '';
15
16 doCheck = false;
17
18 # TODO: tests are failing
19 #checkPhase = ''
20 # ${python}/bin/${python.executable} ./test.py
21 #'';
22
23 meta = {
24 description = "A python interface to the libmagic file type identification library";
25 homepage = "https://github.com/ahupp/python-magic";
26 license = lib.licenses.mit;
27 };
28}