1{
2 buildPythonPackage,
3 fetchFromGitHub,
4 lib,
5 packaging,
6 pillow,
7 tesseract,
8 substituteAll,
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 = pname;
21 rev = "refs/tags/v${version}";
22 hash = "sha256-gQMeck6ojlIwyiOCBBhzHHrjQfBMelVksVGd+fyxWZk=";
23 };
24
25 patches = [
26 (substituteAll {
27 src = ./tesseract-binary.patch;
28 drv = tesseract;
29 })
30 ];
31
32 nativeBuildInputs = [ setuptools ];
33
34 buildInputs = [ tesseract ];
35
36 propagatedBuildInputs = [
37 packaging
38 pillow
39 ];
40
41 nativeCheckInputs = [ pytestCheckHook ];
42
43 meta = with lib; {
44 homepage = "https://pypi.org/project/pytesseract/";
45 license = licenses.asl20;
46 description = "A Python wrapper for Google Tesseract";
47 mainProgram = "pytesseract";
48 maintainers = with maintainers; [ ];
49 };
50}