2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
mock,
|
2024-07-27 06:49:29 +00:00
|
|
|
nose,
|
2024-06-05 15:53:02 +00:00
|
|
|
pexpect,
|
|
|
|
pyserial,
|
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
setuptools,
|
2021-05-20 23:08:51 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pygatt";
|
|
|
|
version = "4.0.5";
|
2024-04-21 15:54:59 +00:00
|
|
|
pyproject = true;
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
disabled = pythonOlder "3.5";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "peplin";
|
2024-04-21 15:54:59 +00:00
|
|
|
repo = "pygatt";
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-DUZGsztZViVNZwmhXoRN5FOQ7BgUeI0SsYgCHlvsrv0=";
|
2021-05-20 23:08:51 +00:00
|
|
|
};
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
postPatch = ''
|
|
|
|
# Not support for Python < 3.4
|
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace-fail "'enum-compat'" "" \
|
|
|
|
--replace-fail "'coverage >= 3.7.1'," "" \
|
|
|
|
--replace-fail "'nose >= 1.3.7'" ""
|
|
|
|
substituteInPlace tests/bgapi/test_bgapi.py \
|
|
|
|
--replace-fail "assertEquals" "assertEqual"
|
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
build-system = [ setuptools ];
|
2024-04-21 15:54:59 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
dependencies = [ pyserial ];
|
2021-05-20 23:08:51 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
optional-dependencies.GATTTOOL = [ pexpect ];
|
2022-04-15 01:41:22 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
# tests require nose
|
|
|
|
doCheck = pythonOlder "3.12";
|
2023-02-22 10:55:15 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-05-20 23:08:51 +00:00
|
|
|
mock
|
2024-07-27 06:49:29 +00:00
|
|
|
nose
|
2021-05-20 23:08:51 +00:00
|
|
|
pytestCheckHook
|
2024-07-27 06:49:29 +00:00
|
|
|
] ++ optional-dependencies.GATTTOOL;
|
2021-05-20 23:08:51 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "pygatt" ];
|
2021-05-20 23:08:51 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Python wrapper the BGAPI for accessing Bluetooth LE Devices";
|
|
|
|
homepage = "https://github.com/peplin/pygatt";
|
2024-04-21 15:54:59 +00:00
|
|
|
changelog = "https://github.com/peplin/pygatt/blob/v${version}/CHANGELOG.rst";
|
2024-06-05 15:53:02 +00:00
|
|
|
license = with licenses; [
|
|
|
|
asl20
|
|
|
|
mit
|
|
|
|
];
|
2021-05-20 23:08:51 +00:00
|
|
|
maintainers = with maintainers; [ fab ];
|
|
|
|
};
|
|
|
|
}
|