summary refs log tree commit diff
path: root/pkgs/development/python-modules/zxing-cpp/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/zxing-cpp/default.nix')
-rw-r--r--pkgs/development/python-modules/zxing-cpp/default.nix53
1 files changed, 53 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/zxing-cpp/default.nix b/pkgs/development/python-modules/zxing-cpp/default.nix
new file mode 100644
index 00000000000..dbdc4c50eff
--- /dev/null
+++ b/pkgs/development/python-modules/zxing-cpp/default.nix
@@ -0,0 +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 = [
+    numpy
+  ];
+
+  buildInputs = [
+    pybind11
+  ];
+
+  nativeBuildInputs = [
+    cmake
+    setuptools-scm
+  ];
+
+  nativeCheckInputs = [
+    pillow
+    pytestCheckHook
+  ];
+
+  pytestFlagsArray = [
+    "test.py"
+  ];
+
+  pythonImportsCheck = [
+    "zxingcpp"
+  ];
+}