From 60404c1edea1fe50e07ba99088f2211f6b7ac1c9 Mon Sep 17 00:00:00 2001 From: natsukium Date: Sun, 5 Nov 2023 14:07:16 +0900 Subject: [PATCH] python311Packages.zxing-cpp: refactor - replace checkPhase with pytestCheckHook - adopt pypa build --- .../python-modules/zxing-cpp/default.nix | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/zxing-cpp/default.nix b/pkgs/development/python-modules/zxing-cpp/default.nix index 02ff95588d70..dbdc4c50effd 100644 --- a/pkgs/development/python-modules/zxing-cpp/default.nix +++ b/pkgs/development/python-modules/zxing-cpp/default.nix @@ -1,30 +1,53 @@ { 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" ]; }