2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2021-05-20 23:08:51 +00:00
|
|
|
, python
|
2021-04-08 16:26:57 +00:00
|
|
|
, regex
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
2022-02-10 20:34:41 +00:00
|
|
|
pname = "lark";
|
|
|
|
version = "1.0.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "lark-parser";
|
|
|
|
repo = "lark";
|
|
|
|
rev = version;
|
2022-02-10 20:34:41 +00:00
|
|
|
sha256 = "0pfvjh4ydc49gs6m8b3ip85c8nd4da2bhz9714fwcyl3hdp33q7n";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
# Optional import, but fixes some re known bugs & allows advanced regex features
|
2021-04-08 16:26:57 +00:00
|
|
|
propagatedBuildInputs = [ regex ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"lark"
|
|
|
|
"lark.parsers"
|
|
|
|
"lark.tools"
|
|
|
|
"lark.grammars"
|
|
|
|
];
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
|
|
|
|
# Official way to run the tests. Runs unittest internally.
|
|
|
|
# pytest produces issues with some test resource paths (relies on __main__)
|
|
|
|
${python.interpreter} -m tests
|
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
2021-04-08 16:26:57 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A modern parsing library for Python, implementing Earley & LALR(1) and an easy interface";
|
2021-05-20 23:08:51 +00:00
|
|
|
homepage = "https://lark-parser.readthedocs.io/";
|
|
|
|
changelog = "https://github.com/lark-parser/lark/releases/tag/${version}";
|
2021-04-08 16:26:57 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ fridh drewrisinger ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|