1{ lib
2, appdirs
3, beautifulsoup4
4, buildPythonPackage
5, colorlog
6, fetchFromGitHub
7, git
8, jsonschema
9, lxml
10, markdown
11, python
12, requests
13, substituteAll
14, toml
15}:
16
17let
18 # NOTE This is needed to download & run another Python program internally in
19 # order to generate test cases for library-checker problems.
20 pythonEnv = python.withPackages (ps: with ps; [ colorlog jinja2 markdown toml ]);
21in buildPythonPackage rec {
22 pname = "online-judge-api-client";
23 version = "10.10.1";
24
25 src = fetchFromGitHub {
26 owner = "online-judge-tools";
27 repo = "api-client";
28 rev = "refs/tags/v${version}";
29 hash = "sha256-P0pIjd/YS155dSDpY/ekMp8HnJcM35waV7aoTQiEWHo=";
30 };
31
32 patches = [ ./fix-paths.patch ];
33 postPatch = ''
34 substituteInPlace onlinejudge/service/library_checker.py \
35 --subst-var-by git ${git} \
36 --subst-var-by pythonInterpreter ${pythonEnv.interpreter}
37 '';
38
39 propagatedBuildInputs = [
40 appdirs
41 beautifulsoup4
42 colorlog
43 jsonschema
44 lxml
45 requests
46 toml
47 ];
48
49 # Requires internet access
50 doCheck = false;
51
52 pythonImportsCheck = [ "onlinejudge" "onlinejudge_api" ];
53
54 meta = with lib; {
55 description = "API client to develop tools for competitive programming";
56 homepage = "https://github.com/online-judge-tools/api-client";
57 license = licenses.mit;
58 maintainers = with maintainers; [ sei40kr ];
59 };
60}