1{ 2 lib, 3 appdirs, 4 beautifulsoup4, 5 buildPythonPackage, 6 colorlog, 7 fetchFromGitHub, 8 git, 9 jsonschema, 10 lxml, 11 markdown, 12 python, 13 requests, 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 ( 21 ps: with ps; [ 22 colorlog 23 jinja2 24 markdown 25 toml 26 ] 27 ); 28in 29buildPythonPackage rec { 30 pname = "online-judge-api-client"; 31 version = "10.10.1"; 32 format = "setuptools"; 33 34 src = fetchFromGitHub { 35 owner = "online-judge-tools"; 36 repo = "api-client"; 37 tag = "v${version}"; 38 hash = "sha256-P0pIjd/YS155dSDpY/ekMp8HnJcM35waV7aoTQiEWHo="; 39 }; 40 41 patches = [ ./fix-paths.patch ]; 42 postPatch = '' 43 substituteInPlace onlinejudge/service/library_checker.py \ 44 --subst-var-by git ${git} \ 45 --subst-var-by pythonInterpreter ${pythonEnv.interpreter} 46 ''; 47 48 propagatedBuildInputs = [ 49 appdirs 50 beautifulsoup4 51 colorlog 52 jsonschema 53 lxml 54 requests 55 toml 56 ]; 57 58 # Requires internet access 59 doCheck = false; 60 61 pythonImportsCheck = [ 62 "onlinejudge" 63 "onlinejudge_api" 64 ]; 65 66 meta = with lib; { 67 description = "API client to develop tools for competitive programming"; 68 mainProgram = "oj-api"; 69 homepage = "https://github.com/online-judge-tools/api-client"; 70 license = licenses.mit; 71 maintainers = with maintainers; [ sei40kr ]; 72 }; 73}