about summary refs log tree commit diff
path: root/pkgs/development/python-modules/contexttimer/default.nix
blob: f908783fb0b63cebf6707f785d308fa1987f1fb2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{ lib
, buildPythonPackage
, fetchFromGitHub
, mock
, fetchpatch
, python
}:

buildPythonPackage rec {
  pname = "contexttimer";
  version = "unstable-2019-03-30";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "brouberol";
    repo = "contexttimer";
    rev = "a866f420ed4c10f29abf252c58b11f9db6706100";
    hash = "sha256-Fc1vK1KSZWgBPtBf5dVydF6dLHEGAOslWMV0FLRdj8w=";
  };

  patches = [
  # https://github.com/brouberol/contexttimer/pull/16
    (fetchpatch {
      url = "https://github.com/brouberol/contexttimer/commit/dd65871f3f25a523a47a74f2f5306c57048592b0.patch";
      hash = "sha256-vNBuFXvuvb6hWPzg4W4iyKbd4N+vofhxsKydEkc25E4=";
    })
  ];

  pythonImportsCheck = [ "contexttimer" ];

  nativeCheckInputs = [ mock ];

  checkPhase = ''
    ${python.interpreter} -m unittest tests/test_timer.py
  '';

  meta = with lib; {
    homepage = "https://github.com/brouberol/contexttimer";
    description = "A timer as a context manager";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ atila ];
  };
}