Merge pull request #307098 from r-ryantm/auto-update/cilium-cli
[NixPkgs.git] / pkgs / development / python-modules / pylibdmtx / default.nix
blobbf2c4815ec3a61b2e8a7d7776dd2640dcc017586
1 { fetchFromGitHub
2 , buildPythonPackage
3 , pillow
4 , numpy
5 , libdmtx
6 , lib
7 }:
9 buildPythonPackage rec {
10   pname = "pylibdmtx";
11   version = "0.1.10";
12   format = "setuptools";
14   src = fetchFromGitHub {
15     owner = "NaturalHistoryMuseum";
16     repo = pname;
17     rev = "v${version}";
18     hash = "sha256-vNWzhO4V0mj4eItZ0Z5UG9RBCqprIcgMGNyIe1+mXWY=";
19   };
21   # Change:
22   # def load():
23   #     """Loads the libdmtx shared library.
24   #
25   # To:
26   # def load():
27   #     return cdll.LoadLibrary("/nix/store/.../lib/libdmtx.so")
28   #     """Loads the libdmtx shared library.
29   postPatch = ''
30     sed -i '\#def load.*#a\    return cdll.LoadLibrary("${libdmtx}/lib/libdmtx.so")' \
31         pylibdmtx/dmtx_library.py
33     # Checks that the loader works in various scenarios, but we just
34     # forced it to only work one way.
35     rm pylibdmtx/tests/test_dmtx_library.py
36   '';
38   propagatedBuildInputs = [ pillow numpy ];
40   pythonImportsCheck = [ "pylibdmtx" ];
42   meta = with lib; {
43     description = "Read and write Data Matrix barcodes from Python 2 and 3 using the libdmtx library";
44     homepage = "https://github.com/NaturalHistoryMuseum/pylibdmtx/";
45     license = licenses.mit;
46     maintainers = with maintainers; [ grahamc ];
47   };