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