1{ lib
2, fetchFromGitLab
3, buildPythonPackage
4, pillow
5, tesseract
6, cuneiform
7, isPy3k
8, substituteAll
9, pytestCheckHook
10}:
11
12buildPythonPackage rec {
13 pname = "pyocr";
14 version = "0.8.3";
15 disabled = !isPy3k;
16
17 # Don't fetch from PYPI because it doesn't contain tests.
18 src = fetchFromGitLab {
19 domain = "gitlab.gnome.org";
20 group = "World";
21 owner = "OpenPaperwork";
22 repo = "pyocr";
23 rev = version;
24 sha256 = "sha256-gIn50H9liQcTb7SzoWnBwm5LTvkr+R+5OPvITls1B/w=";
25 };
26
27 patches = [
28 (substituteAll {
29 src = ./paths.patch;
30 inherit cuneiform tesseract;
31 })
32 ];
33
34 # see the logic in setup.py
35 ENABLE_SETUPTOOLS_SCM = "0";
36 preConfigure = ''
37 echo 'version = "${version}"' > src/pyocr/_version.py
38 '';
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; [ symphorien ];
49 };
50}