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