1{ buildPythonPackage, lib, fetchPypi, file, stdenv }:
2
3buildPythonPackage rec {
4 pname = "python-magic";
5 version = "0.4.15";
6
7 src = fetchPypi {
8 inherit pname version;
9 sha256 = "f3765c0f582d2dfc72c15f3b5a82aecfae9498bd29ca840d72f37d7bd38bfcd5";
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}