2022-12-28 21:21:41 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
|
|
|
|
2023-01-11 07:51:40 +00:00
|
|
|
# build
|
|
|
|
, antlr4
|
|
|
|
|
2022-12-28 21:21:41 +00:00
|
|
|
# propagates
|
|
|
|
, antlr4-python3-runtime
|
|
|
|
, dataclasses-json
|
|
|
|
, pyyaml
|
|
|
|
|
|
|
|
# tests
|
|
|
|
, pytestCheckHook
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
pname = "hassil";
|
2023-01-11 07:51:40 +00:00
|
|
|
version = "0.2.3";
|
2022-12-28 21:21:41 +00:00
|
|
|
in
|
|
|
|
buildPythonPackage {
|
|
|
|
inherit pname version;
|
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2023-01-11 07:51:40 +00:00
|
|
|
hash = "sha256-YT8FgvM0mlB8ri9WHLau+e4m+wyEI4mHWxXbhiI60h0=";
|
2022-12-28 21:21:41 +00:00
|
|
|
};
|
|
|
|
|
2023-01-11 07:51:40 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
antlr4
|
|
|
|
];
|
|
|
|
|
2022-12-28 21:21:41 +00:00
|
|
|
postPatch = ''
|
|
|
|
sed -i 's/antlr4-python3-runtime==.*/antlr4-python3-runtime/' requirements.txt
|
2023-01-11 07:51:40 +00:00
|
|
|
rm hassil/grammar/*.{tokens,interp}
|
|
|
|
antlr -Dlanguage=Python3 -visitor -o hassil/grammar/ *.g4
|
2022-12-28 21:21:41 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
antlr4-python3-runtime
|
|
|
|
dataclasses-json
|
|
|
|
pyyaml
|
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
changelog = "https://github.com/home-assistant/hassil/releases/tag/v${version}";
|
|
|
|
description = "Intent parsing for Home Assistant";
|
|
|
|
homepage = "https://github.com/home-assistant/hassil";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = teams.home-assistant.members;
|
|
|
|
};
|
|
|
|
}
|