1{ lib
2, stdenv
3, buildPythonPackage
4, fetchFromGitHub
5, substituteAll
6, file
7, pytestCheckHook
8}:
9
10buildPythonPackage rec {
11 pname = "python-magic";
12 version = "0.4.27";
13
14 src = fetchFromGitHub {
15 owner = "ahupp";
16 repo = "python-magic";
17 rev = version;
18 sha256 = "sha256-fZ+5xJ3P0EYK+6rQ8VzXv2zckKfEH5VUdISIR6ybIfQ=";
19 };
20
21 patches = [
22 (substituteAll {
23 src = ./libmagic-path.patch;
24 libmagic = "${file}/lib/libmagic${stdenv.hostPlatform.extensions.sharedLibrary}";
25 })
26 ];
27
28 preCheck = ''
29 export LC_ALL=en_US.UTF-8
30 '';
31
32 checkInputs = [
33 pytestCheckHook
34 ];
35
36 meta = with lib; {
37 description = "A python interface to the libmagic file type identification library";
38 homepage = "https://github.com/ahupp/python-magic";
39 license = licenses.mit;
40 maintainers = with maintainers; [ SuperSandro2000 ];
41 };
42}