1{
2 buildPythonPackage,
3 fetchFromGitHub,
4 lib,
5 packaging,
6 pillow,
7 tesseract,
8 replaceVars,
9 pytestCheckHook,
10 setuptools,
11}:
12
13buildPythonPackage rec {
14 pname = "pytesseract";
15 version = "0.3.13";
16 format = "pyproject";
17
18 src = fetchFromGitHub {
19 owner = "madmaze";
20 repo = "pytesseract";
21 tag = "v${version}";
22 hash = "sha256-gQMeck6ojlIwyiOCBBhzHHrjQfBMelVksVGd+fyxWZk=";
23 };
24
25 patches = [
26 (replaceVars ./tesseract-binary.patch {
27 drv = tesseract;
28 })
29 ];
30
31 nativeBuildInputs = [ setuptools ];
32
33 buildInputs = [ tesseract ];
34
35 propagatedBuildInputs = [
36 packaging
37 pillow
38 ];
39 disabledTests = [
40 # https://github.com/madmaze/pytesseract/pull/559
41 "incorrect_tessdata_dir"
42 "invalid_tessdata_dir"
43 ];
44
45 nativeCheckInputs = [ pytestCheckHook ];
46
47 meta = with lib; {
48 homepage = "https://pypi.org/project/pytesseract/";
49 license = licenses.asl20;
50 description = "Python wrapper for Google Tesseract";
51 mainProgram = "pytesseract";
52 maintainers = [ ];
53 };
54}