1{ lib
2, buildPythonPackage
3, chardet
4, fetchFromGitHub
5, karton-core
6, pytestCheckHook
7, python_magic
8, pythonOlder
9}:
10
11buildPythonPackage rec {
12 pname = "karton-classifier";
13 version = "1.2.0";
14
15 disabled = pythonOlder "3.7";
16
17 src = fetchFromGitHub {
18 owner = "CERT-Polska";
19 repo = pname;
20 rev = "v${version}";
21 sha256 = "sha256-AG2CtNMgXYfbdlOqB1ZdjMT8H67fsSMXTgiFg6K41IQ=";
22 };
23
24 propagatedBuildInputs = [
25 chardet
26 karton-core
27 python_magic
28 ];
29
30 postPatch = ''
31 substituteInPlace requirements.txt \
32 --replace "chardet==3.0.4" "chardet" \
33 --replace "python-magic==0.4.18" "python-magic"
34 '';
35
36 checkInputs = [
37 pytestCheckHook
38 ];
39
40 pythonImportsCheck = [ "karton.classifier" ];
41
42 meta = with lib; {
43 description = "File type classifier for the Karton framework";
44 homepage = "https://github.com/CERT-Polska/karton-classifier";
45 license = with licenses; [ bsd3 ];
46 maintainers = with maintainers; [ fab ];
47 };
48}