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