summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pytesseract/default.nix
blob: 824e4acb0df2ff08a967af47f60a64021f81f2fa (plain)
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
49
50
51
52
53
54
{
  buildPythonPackage,
  fetchFromGitHub,
  lib,
  packaging,
  pillow,
  tesseract,
  replaceVars,
  pytestCheckHook,
  setuptools,
}:

buildPythonPackage rec {
  pname = "pytesseract";
  version = "0.3.13";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "madmaze";
    repo = "pytesseract";
    tag = "v${version}";
    hash = "sha256-gQMeck6ojlIwyiOCBBhzHHrjQfBMelVksVGd+fyxWZk=";
  };

  patches = [
    (replaceVars ./tesseract-binary.patch {
      drv = tesseract;
    })
  ];

  nativeBuildInputs = [ setuptools ];

  buildInputs = [ tesseract ];

  propagatedBuildInputs = [
    packaging
    pillow
  ];
  disabledTests = [
    # https://github.com/madmaze/pytesseract/pull/559
    "incorrect_tessdata_dir"
    "invalid_tessdata_dir"
  ];

  nativeCheckInputs = [ pytestCheckHook ];

  meta = {
    homepage = "https://pypi.org/project/pytesseract/";
    license = lib.licenses.asl20;
    description = "Python wrapper for Google Tesseract";
    mainProgram = "pytesseract";
    maintainers = [ ];
  };
}