2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
numpy,
|
|
|
|
pillow,
|
|
|
|
zbar,
|
|
|
|
pytestCheckHook,
|
2022-06-16 17:23:12 +00:00
|
|
|
}:
|
2022-03-30 09:31:56 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pyzbar";
|
|
|
|
version = "0.1.9";
|
2024-01-02 11:29:13 +00:00
|
|
|
format = "setuptools";
|
2022-03-30 09:31:56 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "NaturalHistoryMuseum";
|
|
|
|
repo = "pyzbar";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "8IZQY6qB4r1SUPItDlTDnVQuPs0I38K3yJ6LiPJuwbU=";
|
|
|
|
};
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
buildInputs = [ zbar ];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
pillow
|
|
|
|
numpy
|
|
|
|
];
|
2022-03-30 09:31:56 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2022-03-30 09:31:56 +00:00
|
|
|
|
|
|
|
# find_library doesn't return an absolute path
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/7307
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pyzbar/zbar_library.py \
|
2022-06-16 17:23:12 +00:00
|
|
|
--replace \
|
|
|
|
"find_library('zbar')" \
|
|
|
|
'"${lib.getLib zbar}/lib/libzbar${stdenv.hostPlatform.extensions.sharedLibrary}"'
|
2022-03-30 09:31:56 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
# find_library has been replaced by a hardcoded path
|
|
|
|
# the test fails due to find_library not called
|
|
|
|
"test_found_non_windows"
|
|
|
|
"test_not_found_non_windows"
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "pyzbar" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Read one-dimensional barcodes and QR codes from Python using the zbar library";
|
2022-03-30 09:31:56 +00:00
|
|
|
homepage = "https://github.com/NaturalHistoryMuseum/pyzbar";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ gador ];
|
|
|
|
};
|
|
|
|
}
|