1{
2 lib,
3 buildPythonPackage,
4 setuptools,
5 python,
6 antlr4,
7}:
8
9buildPythonPackage rec {
10 pname = "antlr4-python3-runtime";
11 inherit (antlr4.runtime.cpp) version src;
12
13 format = "pyproject";
14
15 disabled = python.pythonOlder "3.6";
16
17 sourceRoot = "${src.name}/runtime/Python3";
18
19 nativeBuildInputs = [ setuptools ];
20
21 postPatch = ''
22 substituteInPlace tests/TestIntervalSet.py \
23 --replace "assertEquals" "assertEqual"
24 '';
25
26 # We use an asterisk because this expression is used also for old antlr
27 # versions, where there the tests directory is `test` and not `tests`.
28 # See e.g in package `baserow`.
29 checkPhase = ''
30 runHook preCheck
31
32 pushd tests
33 ${python.interpreter} run.py
34 popd
35
36 runHook postCheck
37 '';
38
39 meta = with lib; {
40 description = "Runtime for ANTLR";
41 mainProgram = "pygrun";
42 homepage = "https://www.antlr.org/";
43 license = licenses.bsd3;
44 };
45}