1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 async-timeout,
6 docopt,
7 pyserial,
8 pyserial-asyncio,
9 setuptools,
10 pytestCheckHook,
11 pythonOlder,
12}:
13
14buildPythonPackage rec {
15 pname = "rflink";
16 version = "0.0.66";
17 format = "setuptools";
18
19 disabled = pythonOlder "3.7";
20
21 src = fetchFromGitHub {
22 owner = "aequitas";
23 repo = "python-rflink";
24 tag = version;
25 hash = "sha256-n6VLa0xX1qewMS7Kv+kiitezWRbRvDJRNuOmA7IV6u0=";
26 };
27
28 propagatedBuildInputs = [
29 async-timeout
30 docopt
31 pyserial
32 pyserial-asyncio
33 setuptools
34 ];
35
36 nativeCheckInputs = [ pytestCheckHook ];
37
38 postPatch = ''
39 substituteInPlace setup.py \
40 --replace "version=version_from_git()" "version='${version}'"
41
42 substituteInPlace rflinkproxy/__main__.py --replace-fail \
43 "with async_timeout.timeout(CONNECTION_TIMEOUT):" \
44 "async with async_timeout.timeout(CONNECTION_TIMEOUT):"
45 '';
46
47 pythonImportsCheck = [ "rflink.protocol" ];
48
49 meta = with lib; {
50 description = "Library and CLI tools for interacting with RFlink 433MHz transceiver";
51 homepage = "https://github.com/aequitas/python-rflink";
52 changelog = "https://github.com/aequitas/python-rflink/releases/tag/${version}";
53 license = licenses.mit;
54 maintainers = with maintainers; [ dotlambda ];
55 };
56}