at master 1.2 kB view raw
1{ 2 buildPythonPackage, 3 cmake, 4 setuptools-scm, 5 numpy, 6 pillow, 7 pybind11, 8 libzxing-cpp, 9 pytestCheckHook, 10 libzint, 11}: 12 13buildPythonPackage rec { 14 pname = "zxing-cpp"; 15 inherit (libzxing-cpp) src version meta; 16 pyproject = true; 17 18 sourceRoot = "${src.name}/wrappers/python"; 19 20 # we don't need pybind11 in the root environment 21 # https://pybind11.readthedocs.io/en/stable/installing.html#include-with-pypi 22 postPatch = '' 23 substituteInPlace pyproject.toml \ 24 --replace-fail "pybind11[global]" "pybind11" 25 26 substituteInPlace setup.py \ 27 --replace-fail "cfg = 'Debug' if self.debug else 'Release'" "cfg = 'Release'" \ 28 --replace-fail " '-DVERSION_INFO=' + self.distribution.get_version()]" " '-DVERSION_INFO=' + self.distribution.get_version(), '-DZXING_DEPENDENCIES=LOCAL', '-DZXING_USE_BUNDLED_ZINT=OFF']" 29 ''; 30 31 dontUseCmakeConfigure = true; 32 33 build-system = [ 34 setuptools-scm 35 pybind11 36 ]; 37 38 dependencies = [ numpy ]; 39 40 nativeBuildInputs = [ 41 cmake 42 ]; 43 44 buildInputs = [ libzint ]; 45 46 nativeCheckInputs = [ 47 pillow 48 pytestCheckHook 49 ]; 50 51 enabledTestPaths = [ "test.py" ]; 52 53 pythonImportsCheck = [ "zxingcpp" ]; 54}