2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
fetchFromGitLab,
|
|
|
|
buildPythonPackage,
|
|
|
|
pillow,
|
|
|
|
tesseract,
|
|
|
|
cuneiform,
|
|
|
|
isPy3k,
|
|
|
|
substituteAll,
|
|
|
|
pytestCheckHook,
|
|
|
|
setuptools,
|
|
|
|
setuptools-scm,
|
|
|
|
withTesseractSupport ? true,
|
|
|
|
withCuneiformSupport ? stdenv.hostPlatform.isLinux,
|
2021-09-18 10:52:07 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pyocr";
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "0.8.5";
|
2020-04-24 23:36:52 +00:00
|
|
|
disabled = !isPy3k;
|
2023-11-16 04:20:00 +00:00
|
|
|
format = "pyproject";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# 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;
|
2023-11-16 04:20:00 +00:00
|
|
|
hash = "sha256-gE0+qbHCwpDdxXFY+4rjVU2FbUSfSVrvrVMcWUk+9FU=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
patches =
|
|
|
|
[ ]
|
|
|
|
++ (lib.optional withTesseractSupport (substituteAll {
|
2024-02-29 20:09:43 +00:00
|
|
|
src = ./paths-tesseract.patch;
|
|
|
|
inherit tesseract;
|
|
|
|
tesseractLibraryLocation = "${tesseract}/lib/libtesseract${stdenv.hostPlatform.extensions.sharedLibrary}";
|
2024-06-05 15:53:02 +00:00
|
|
|
}))
|
|
|
|
++ (lib.optional stdenv.hostPlatform.isLinux (substituteAll {
|
2024-02-29 20:09:43 +00:00
|
|
|
src = ./paths-cuneiform.patch;
|
|
|
|
inherit cuneiform;
|
|
|
|
}));
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs = [ pillow ];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
setuptools
|
|
|
|
setuptools-scm
|
|
|
|
];
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2021-09-18 10:52:07 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
inherit (src.meta) homepage;
|
2023-11-16 04:20:00 +00:00
|
|
|
changelog = "https://gitlab.gnome.org/World/OpenPaperwork/pyocr/-/blob/${version}/ChangeLog";
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Python wrapper for Tesseract and Cuneiform";
|
2021-09-18 10:52:07 +00:00
|
|
|
license = licenses.gpl3Plus;
|
2024-06-05 15:53:02 +00:00
|
|
|
maintainers = with maintainers; [
|
|
|
|
symphorien
|
|
|
|
tomodachi94
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|