about summary refs log tree commit diff
path: root/pkgs/development/python-modules/zxing-cpp/default.nix
blob: 511a939cf6fb822a8a676b3ac0643fe23f37b3e6 (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
37
38
39
40
41
42
43
44
45
46
{
  lib,
  buildPythonPackage,
  cmake,
  setuptools-scm,
  numpy,
  pillow,
  pybind11,
  libzxing-cpp,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "zxing-cpp";
  inherit (libzxing-cpp) src version meta;
  pyproject = true;

  sourceRoot = "${src.name}/wrappers/python";

  # we don't need pybind11 in the root environment
  # https://pybind11.readthedocs.io/en/stable/installing.html#include-with-pypi
  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace "pybind11[global]" "pybind11"
  '';

  dontUseCmakeConfigure = true;

  propagatedBuildInputs = [ numpy ];

  buildInputs = [ pybind11 ];

  nativeBuildInputs = [
    cmake
    setuptools-scm
  ];

  nativeCheckInputs = [
    pillow
    pytestCheckHook
  ];

  pytestFlagsArray = [ "test.py" ];

  pythonImportsCheck = [ "zxingcpp" ];
}