2022-07-13 10:05:24 +02:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
2023-06-19 17:25:01 +08:00
|
|
|
setuptools,
|
2022-07-13 10:05:24 +02:00
|
|
|
python,
|
2023-06-19 17:25:01 +08:00
|
|
|
antlr4,
|
|
|
|
}:
|
2018-03-07 19:10:17 +01:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
2018-06-23 15:27:58 +02:00
|
|
|
pname = "antlr4-python3-runtime";
|
2019-08-14 14:26:49 -07:00
|
|
|
inherit (antlr4.runtime.cpp) version src;
|
2023-06-19 17:25:01 +08:00
|
|
|
|
|
|
|
format = "pyproject";
|
|
|
|
|
2022-07-13 10:05:24 +02:00
|
|
|
disabled = python.pythonOlder "3.6";
|
2018-03-07 19:10:17 +01:00
|
|
|
|
2023-07-25 13:27:31 +00:00
|
|
|
sourceRoot = "${src.name}/runtime/Python3";
|
2019-08-14 14:26:49 -07:00
|
|
|
|
2023-06-19 17:25:01 +08:00
|
|
|
nativeBuildInputs = [ setuptools ];
|
|
|
|
|
2023-12-09 21:52:53 +01:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace tests/TestIntervalSet.py \
|
|
|
|
--replace "assertEquals" "assertEqual"
|
|
|
|
'';
|
|
|
|
|
2023-06-19 17:25:01 +08:00
|
|
|
# We use an asterisk because this expression is used also for old antlr
|
|
|
|
# versions, where there the tests directory is `test` and not `tests`.
|
|
|
|
# See e.g in package `baserow`.
|
2019-08-14 14:26:49 -07:00
|
|
|
checkPhase = ''
|
2023-12-09 21:52:53 +01:00
|
|
|
runHook preCheck
|
|
|
|
|
|
|
|
pushd tests
|
2022-12-26 18:42:11 +01:00
|
|
|
${python.interpreter} run.py
|
2023-12-09 21:52:53 +01:00
|
|
|
popd
|
|
|
|
|
|
|
|
runHook postCheck
|
2019-08-14 14:26:49 -07:00
|
|
|
'';
|
2018-03-07 19:10:17 +01:00
|
|
|
|
2019-08-14 14:26:49 -07:00
|
|
|
meta = with lib; {
|
2018-03-07 19:10:17 +01:00
|
|
|
description = "Runtime for ANTLR";
|
2024-03-19 03:14:51 +01:00
|
|
|
mainProgram = "pygrun";
|
2019-04-22 10:14:28 +02:00
|
|
|
homepage = "https://www.antlr.org/";
|
2019-08-14 14:26:49 -07:00
|
|
|
license = licenses.bsd3;
|
2018-03-07 19:10:17 +01:00
|
|
|
};
|
|
|
|
}
|