Unverified Commit 60404c1e authored by natsukium's avatar natsukium
Browse files

python311Packages.zxing-cpp: refactor

- replace checkPhase with pytestCheckHook
- adopt pypa build
parent 31da0596
Loading
Loading
Loading
Loading
+24 −1
Original line number Diff line number Diff line
{ 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 = [
    pybind11
    numpy
  ];

  buildInputs = [
    pybind11
  ];

  nativeBuildInputs = [
    cmake
    setuptools-scm
  ];

  nativeCheckInputs = [
    pillow
    pytestCheckHook
  ];

  pytestFlagsArray = [
    "test.py"
  ];

  pythonImportsCheck = [
    "zxingcpp"
  ];
}