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