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