1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 poetry-core,
7 jsonschema,
8 peewee,
9 platformdirs,
10 iso8601,
11 rfc3339-validator,
12 strict-rfc3339,
13 tomlkit,
14 deprecation,
15 timeslot,
16 pytestCheckHook,
17 gitUpdater,
18}:
19
20buildPythonPackage rec {
21 pname = "aw-core";
22 version = "0.5.16";
23
24 format = "pyproject";
25
26 # pypi distribution doesn't include tests, so build from source instead
27 src = fetchFromGitHub {
28 owner = "ActivityWatch";
29 repo = "aw-core";
30 rev = "v${version}";
31 sha256 = "sha256-7xT7bOGzH5G4WpgNo8pDyiQqX0dWNLNHpgssozUa9kQ=";
32 };
33
34 disabled = pythonOlder "3.8";
35
36 nativeBuildInputs = [
37 poetry-core
38 ];
39
40 propagatedBuildInputs = [
41 jsonschema
42 peewee
43 platformdirs
44 iso8601
45 rfc3339-validator
46 strict-rfc3339
47 tomlkit
48 deprecation
49 timeslot
50 ];
51
52 pythonRelaxDeps = [
53 "platformdirs"
54 "iso8601"
55 ];
56
57 nativeCheckInputs = [ pytestCheckHook ];
58
59 preCheck = ''
60 # Fake home folder for tests that write to $HOME
61 export HOME="$TMPDIR"
62 '';
63
64 pythonImportsCheck = [ "aw_core" ];
65
66 passthru.updateScript = gitUpdater { rev-prefix = "v"; };
67
68 meta = with lib; {
69 description = "Core library for ActivityWatch";
70 mainProgram = "aw-cli";
71 homepage = "https://github.com/ActivityWatch/aw-core";
72 maintainers = with maintainers; [ huantian ];
73 license = licenses.mpl20;
74 };
75}