1{
2 lib,
3 aiohttp,
4 buildPythonPackage,
5 fetchFromGitHub,
6 poetry-core,
7 pytestCheckHook,
8 pytest-asyncio,
9 pythonOlder,
10}:
11
12buildPythonPackage rec {
13 pname = "pytraccar";
14 version = "3.0.0";
15 pyproject = true;
16
17 disabled = pythonOlder "3.11";
18
19 src = fetchFromGitHub {
20 owner = "ludeeus";
21 repo = "pytraccar";
22 tag = version;
23 hash = "sha256-DtxZCvLuvQpbu/1lIXz2BVbACt5Q1N2txVMyqwd4d9A=";
24 };
25
26 nativeBuildInputs = [ poetry-core ];
27
28 propagatedBuildInputs = [ aiohttp ];
29
30 # https://github.com/ludeeus/pytraccar/issues/31
31 doCheck = lib.versionOlder aiohttp.version "3.9.0";
32
33 nativeCheckInputs = [
34 pytestCheckHook
35 pytest-asyncio
36 ];
37
38 pytestFlags = [ "--asyncio-mode=auto" ];
39
40 postPatch = ''
41 # Upstream doesn't set version in the repo
42 substituteInPlace pyproject.toml \
43 --replace 'version = "0"' 'version = "${version}"'
44 '';
45
46 pythonImportsCheck = [ "pytraccar" ];
47
48 meta = with lib; {
49 description = "Python library to handle device information from Traccar";
50 homepage = "https://github.com/ludeeus/pytraccar";
51 changelog = "https://github.com/ludeeus/pytraccar/releases/tag/${src.tag}";
52 license = licenses.mit;
53 maintainers = with maintainers; [ fab ];
54 };
55}