Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / python-modules / pyzbar / default.nix
blobfca8feab0c3f633f13da42a6d03eedfd4f9b7298
1 { lib
2 , stdenv
3 , buildPythonPackage
4 , fetchFromGitHub
5 , numpy
6 , pillow
7 , zbar
8 , pytestCheckHook
9 }:
11 buildPythonPackage rec {
12   pname = "pyzbar";
13   version = "0.1.9";
15   src = fetchFromGitHub {
16     owner = "NaturalHistoryMuseum";
17     repo = "pyzbar";
18     rev = "v${version}";
19     sha256 = "8IZQY6qB4r1SUPItDlTDnVQuPs0I38K3yJ6LiPJuwbU=";
20   };
22   propagatedBuildInputs = [ zbar pillow numpy ];
24   nativeCheckInputs = [ pytestCheckHook ];
26   # find_library doesn't return an absolute path
27   # https://github.com/NixOS/nixpkgs/issues/7307
28   postPatch = ''
29     substituteInPlace pyzbar/zbar_library.py \
30       --replace \
31         "find_library('zbar')" \
32         '"${lib.getLib zbar}/lib/libzbar${stdenv.hostPlatform.extensions.sharedLibrary}"'
33   '';
35   disabledTests = [
36     # find_library has been replaced by a hardcoded path
37     # the test fails due to find_library not called
38     "test_found_non_windows"
39     "test_not_found_non_windows"
40   ];
42   pythonImportsCheck = [ "pyzbar" ];
44   meta = with lib; {
45     description = "Read one-dimensional barcodes and QR codes from Python using the zbar library.";
46     homepage = "https://github.com/NaturalHistoryMuseum/pyzbar";
47     license = licenses.mit;
48     maintainers = with maintainers; [ gador ];
49   };