summary refs log tree commit diff
path: root/pkgs/development/python-modules/pyocr/default.nix
blob: 8cfce9ba43f1f88271a33c0c5539f612178af6ee (plain) (blame)
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
{ lib, fetchFromGitLab, buildPythonPackage, pillow, setuptools_scm,
setuptools-scm-git-archive , tesseract, cuneiform, isPy3k, substituteAll,
pytest, tox }:

buildPythonPackage rec {
  pname = "pyocr";
  version = "0.7.2";
  disabled = !isPy3k;

  # 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;
    sha256 = "09ab86bmizpv94w3mdvdqkjyyvk1vafw3jqhkiw5xx7p180xn3il";
  };

  patches = [ (substituteAll {
    src = ./paths.patch;
    inherit cuneiform tesseract;
  })
  ];

  buildInputs = [ setuptools_scm setuptools-scm-git-archive ];
  propagatedBuildInputs = [ pillow ];
  checkInputs = [ pytest tox ];
  checkPhase = "pytest";

  meta = {
    inherit (src.meta) homepage;
    description = "A Python wrapper for Tesseract and Cuneiform";
    license = lib.licenses.gpl3Plus;
  };
}