2021-01-25 08:26:54 +00:00
|
|
|
{ lib, buildPythonPackage, fetchFromGitHub, pythonOlder
|
2019-10-27 16:36:28 +00:00
|
|
|
, colorama, mypy, pyyaml, regex
|
|
|
|
, dataclasses, typing
|
|
|
|
, pytestrunner, pytest-mypy
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "TatSu";
|
2020-01-27 18:02:50 +00:00
|
|
|
version = "5.0.0";
|
2019-10-27 16:36:28 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "neogeny";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2020-01-27 18:02:50 +00:00
|
|
|
sha256 = "1c16fcxf0xjkh5py9bnj6ljb9krhrj57mkwayl1w1dvzwl5lkgj3";
|
2019-10-27 16:36:28 +00:00
|
|
|
};
|
|
|
|
|
2020-01-27 18:02:50 +00:00
|
|
|
# Since version 5.0.0 only >=3.8 is officially supported, but ics is not
|
|
|
|
# compatible with Python 3.8 due to aiohttp:
|
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace "python_requires='>=3.8'," "python_requires='>=3.7',"
|
|
|
|
'';
|
|
|
|
|
2019-10-27 16:36:28 +00:00
|
|
|
nativeBuildInputs = [ pytestrunner ];
|
|
|
|
propagatedBuildInputs = [ colorama mypy pyyaml regex ]
|
2021-01-24 00:29:22 +00:00
|
|
|
++ lib.optionals (pythonOlder "3.7") [ dataclasses ]
|
|
|
|
++ lib.optionals (pythonOlder "3.5") [ typing ];
|
2019-10-27 16:36:28 +00:00
|
|
|
checkInputs = [ pytest-mypy ];
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
pytest test/
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-10-27 16:36:28 +00:00
|
|
|
description = "Generates Python parsers from grammars in a variation of EBNF";
|
|
|
|
longDescription = ''
|
|
|
|
TatSu (the successor to Grako) is a tool that takes grammars in a
|
|
|
|
variation of EBNF as input, and outputs memoizing (Packrat) PEG parsers in
|
|
|
|
Python.
|
|
|
|
'';
|
|
|
|
homepage = "https://tatsu.readthedocs.io/";
|
|
|
|
license = licenses.bsd2;
|
|
|
|
maintainers = with maintainers; [ primeos ];
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|