about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/online-judge-api-client/default.nix
blob: 0a1268e5264f8d92b696b426b4f14fb6a90ab9b7 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{ lib
, appdirs
, beautifulsoup4
, buildPythonPackage
, colorlog
, fetchFromGitHub
, git
, jsonschema
, lxml
, markdown
, python
, requests
, substituteAll
, toml
}:

let
  # NOTE This is needed to download & run another Python program internally in
  #      order to generate test cases for library-checker problems.
  pythonEnv = python.withPackages (ps: with ps; [ colorlog jinja2 markdown toml ]);
in buildPythonPackage rec {
  pname = "online-judge-api-client";
  version = "10.10.1";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "online-judge-tools";
    repo = "api-client";
    rev = "refs/tags/v${version}";
    hash = "sha256-P0pIjd/YS155dSDpY/ekMp8HnJcM35waV7aoTQiEWHo=";
  };

  patches = [ ./fix-paths.patch ];
  postPatch = ''
    substituteInPlace onlinejudge/service/library_checker.py \
      --subst-var-by git               ${git} \
      --subst-var-by pythonInterpreter ${pythonEnv.interpreter}
  '';

  propagatedBuildInputs = [
    appdirs
    beautifulsoup4
    colorlog
    jsonschema
    lxml
    requests
    toml
  ];

  # Requires internet access
  doCheck = false;

  pythonImportsCheck = [ "onlinejudge" "onlinejudge_api" ];

  meta = with lib; {
    description = "API client to develop tools for competitive programming";
    homepage = "https://github.com/online-judge-tools/api-client";
    license = licenses.mit;
    maintainers = with maintainers; [ sei40kr ];
  };
}