summary refs log tree commit diff
path: root/pkgs/development/python-modules/karton-classifier/default.nix
blob: ca2703389b306b3844434bf5ee79a990fb58e155 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{ lib
, buildPythonPackage
, chardet
, fetchFromGitHub
, karton-core
, pytestCheckHook
, python_magic
, pythonOlder
}:

buildPythonPackage rec {
  pname = "karton-classifier";
  version = "1.2.0";

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "CERT-Polska";
    repo = pname;
    rev = "v${version}";
    sha256 = "sha256-AG2CtNMgXYfbdlOqB1ZdjMT8H67fsSMXTgiFg6K41IQ=";
  };

  propagatedBuildInputs = [
    chardet
    karton-core
    python_magic
  ];

  postPatch = ''
    substituteInPlace requirements.txt \
      --replace "chardet==3.0.4" "chardet" \
      --replace "python-magic==0.4.18" "python-magic"
  '';

  checkInputs = [
    pytestCheckHook
  ];

  pythonImportsCheck = [ "karton.classifier" ];

  meta = with lib; {
    description = "File type classifier for the Karton framework";
    homepage = "https://github.com/CERT-Polska/karton-classifier";
    license = with licenses; [ bsd3 ];
    maintainers = with maintainers; [ fab ];
  };
}