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