1{ lib
2, fetchFromGitLab
3, buildPythonPackage
4, pillow
5, setuptools-scm
6, setuptools-scm-git-archive
7, tesseract
8, cuneiform
9, isPy3k
10, substituteAll
11, pytestCheckHook
12}:
13
14buildPythonPackage rec {
15 pname = "pyocr";
16 version = "0.7.2";
17 disabled = !isPy3k;
18
19 # Don't fetch from PYPI because it doesn't contain tests.
20 src = fetchFromGitLab {
21 domain = "gitlab.gnome.org";
22 group = "World";
23 owner = "OpenPaperwork";
24 repo = "pyocr";
25 rev = version;
26 sha256 = "09ab86bmizpv94w3mdvdqkjyyvk1vafw3jqhkiw5xx7p180xn3il";
27 };
28
29 patches = [
30 (substituteAll {
31 src = ./paths.patch;
32 inherit cuneiform tesseract;
33 })
34 ];
35
36 SETUPTOOLS_SCM_PRETEND_VERSION = version;
37
38 buildInputs = [ setuptools-scm setuptools-scm-git-archive ];
39
40 propagatedBuildInputs = [ pillow ];
41
42 checkInputs = [ pytestCheckHook ];
43
44 meta = with lib; {
45 inherit (src.meta) homepage;
46 description = "A Python wrapper for Tesseract and Cuneiform";
47 license = licenses.gpl3Plus;
48 maintainers = with maintainers; [ ];
49 };
50}