1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 paho-mqtt,
6 pytestCheckHook,
7 python-dateutil,
8 pythonOlder,
9 pythonRelaxDepsHook,
10 setuptools,
11 weconnect,
12}:
13
14buildPythonPackage rec {
15 pname = "weconnect-mqtt";
16 version = "0.48.4";
17 pyproject = true;
18
19 disabled = pythonOlder "3.8";
20
21 src = fetchFromGitHub {
22 owner = "tillsteinbach";
23 repo = "WeConnect-mqtt";
24 rev = "refs/tags/v${version}";
25 hash = "sha256-Yv6CAGTDi4P9pImLxVk2QkZ014iqQ8UMBUeiyZWnYiQ=";
26 };
27
28 postPatch = ''
29 substituteInPlace weconnect_mqtt/__version.py \
30 --replace-fail "0.0.0dev" "${version}"
31 substituteInPlace requirements.txt \
32 --replace-fail "weconnect[Images]~=" "weconnect>="
33 substituteInPlace pytest.ini \
34 --replace-fail "--cov=weconnect_mqtt --cov-config=.coveragerc --cov-report html" "" \
35 --replace-fail "pytest-cov" ""
36 '';
37
38 pythonRelaxDeps = [ "python-dateutil" ];
39
40 build-system = [ setuptools ];
41
42 nativeBuildInputs = [ pythonRelaxDepsHook ];
43
44 dependencies = [
45 paho-mqtt
46 python-dateutil
47 weconnect
48 ] ++ weconnect.optional-dependencies.Images;
49
50 nativeCheckInputs = [ pytestCheckHook ];
51
52 pythonImportsCheck = [ "weconnect_mqtt" ];
53
54 meta = with lib; {
55 description = "Python client that publishes data from Volkswagen WeConnect";
56 homepage = "https://github.com/tillsteinbach/WeConnect-mqtt";
57 changelog = "https://github.com/tillsteinbach/WeConnect-mqtt/releases/tag/v${version}";
58 license = with licenses; [ mit ];
59 maintainers = with maintainers; [ fab ];
60 mainProgram = "weconnect-mqtt";
61 };
62}