1{
2 lib,
3 buildPythonPackage,
4 pythonAtLeast,
5 fetchFromGitHub,
6 mock,
7 fetchpatch,
8 python,
9}:
10
11buildPythonPackage {
12 pname = "contexttimer";
13 version = "unstable-2019-03-30";
14 format = "setuptools";
15
16 disabled = pythonAtLeast "3.12";
17
18 src = fetchFromGitHub {
19 owner = "brouberol";
20 repo = "contexttimer";
21 rev = "a866f420ed4c10f29abf252c58b11f9db6706100";
22 hash = "sha256-Fc1vK1KSZWgBPtBf5dVydF6dLHEGAOslWMV0FLRdj8w=";
23 };
24
25 patches = [
26 # https://github.com/brouberol/contexttimer/pull/16
27 (fetchpatch {
28 url = "https://github.com/brouberol/contexttimer/commit/dd65871f3f25a523a47a74f2f5306c57048592b0.patch";
29 hash = "sha256-vNBuFXvuvb6hWPzg4W4iyKbd4N+vofhxsKydEkc25E4=";
30 })
31 ];
32
33 pythonImportsCheck = [ "contexttimer" ];
34
35 nativeCheckInputs = [ mock ];
36
37 checkPhase = ''
38 ${python.interpreter} -m unittest tests/test_timer.py
39 '';
40
41 meta = with lib; {
42 homepage = "https://github.com/brouberol/contexttimer";
43 description = "Timer as a context manager";
44 license = licenses.gpl3Only;
45 maintainers = with maintainers; [ atila ];
46 };
47}