Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 19.09 66 lines 1.9 kB view raw
1{ lib, fetchFromGitLab, buildPythonPackage, pillow, six 2, tesseract, cuneiform, isPy3k, substituteAll, pytest, tox 3}: 4 5buildPythonPackage rec { 6 pname = "pyocr"; 7 version = "0.5.3"; 8 disabled = !isPy3k; 9 10 # Don't fetch from PYPI because it doesn't contain tests. 11 src = fetchFromGitLab { 12 domain = "gitlab.gnome.org"; 13 group = "World"; 14 owner = "OpenPaperwork"; 15 repo = "pyocr"; 16 rev = version; 17 sha256 = "1nihf0qmbpg3yj3yp11jp6hp5z5dqf39nz6j9lqbvgi1nqbs7x15"; 18 }; 19 20 patches = [ (substituteAll { 21 src = ./paths.patch; 22 inherit cuneiform tesseract; 23 }) 24 ]; 25 26 postPatch = '' 27 echo 'version = "${version}"' > src/pyocr/_version.py 28 29 # Disable specific tests that are probably failing because of this issue: 30 # https://github.com/jflesch/pyocr/issues/52 31 for test in $disabledTests; do 32 file="''${test%%:*}" 33 fun="''${test#*:}" 34 echo "import pytest" >> "tests/tests_$file.py" 35 echo "$fun = pytest.mark.skip($fun)" >> "tests/tests_$file.py" 36 done 37 ''; 38 39 disabledTests = [ 40 "cuneiform:TestTxt.test_basic" 41 "cuneiform:TestTxt.test_european" 42 "cuneiform:TestTxt.test_french" 43 "cuneiform:TestWordBox.test_basic" 44 "cuneiform:TestWordBox.test_european" 45 "cuneiform:TestWordBox.test_french" 46 "libtesseract:TestBasicDoc.test_basic" 47 "libtesseract:TestDigitLineBox.test_digits" 48 "libtesseract:TestLineBox.test_japanese" 49 "libtesseract:TestTxt.test_japanese" 50 "libtesseract:TestWordBox.test_japanese" 51 "libtesseract:TestTxt.test_multi" 52 "tesseract:TestTxt.test_multi" 53 "tesseract:TestDigitLineBox.test_digits" 54 "tesseract:TestTxt.test_japanese" 55 ]; 56 57 propagatedBuildInputs = [ pillow six ]; 58 checkInputs = [ pytest tox ]; 59 checkPhase = "pytest"; 60 61 meta = { 62 inherit (src.meta) homepage; 63 description = "A Python wrapper for Tesseract and Cuneiform"; 64 license = lib.licenses.gpl3Plus; 65 }; 66}