2023-02-02 18:25:31 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
2024-05-15 15:35:15 +00:00
|
|
|
, fetchFromGitHub
|
2023-02-02 18:25:31 +00:00
|
|
|
, pythonOlder
|
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
# build-system
|
2023-10-09 19:29:22 +00:00
|
|
|
, setuptools
|
2024-05-15 15:35:15 +00:00
|
|
|
|
|
|
|
# codegen
|
|
|
|
, hassil
|
|
|
|
, python
|
|
|
|
, pyyaml
|
|
|
|
, voluptuous
|
|
|
|
, regex
|
|
|
|
, jinja2
|
|
|
|
|
|
|
|
# tests
|
|
|
|
, pytest-xdist
|
|
|
|
, pytestCheckHook
|
2023-02-02 18:25:31 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "home-assistant-intents";
|
2024-06-24 18:47:55 +00:00
|
|
|
version = "2024.6.21";
|
2024-05-15 15:35:15 +00:00
|
|
|
pyproject = true;
|
2023-02-02 18:25:31 +00:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.9";
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "home-assistant";
|
|
|
|
repo = "intents-package";
|
2024-06-20 14:57:18 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2024-06-24 18:47:55 +00:00
|
|
|
hash = "sha256-tgbZqcxv/uFoNCGq7TySffhqQXzupZodQfQHBqkSHrE=";
|
2024-05-15 15:35:15 +00:00
|
|
|
fetchSubmodules = true;
|
2023-02-02 18:25:31 +00:00
|
|
|
};
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
build-system = [
|
2023-02-02 18:25:31 +00:00
|
|
|
setuptools
|
2024-05-15 15:35:15 +00:00
|
|
|
|
|
|
|
# build-time codegen; https://github.com/home-assistant/intents/blob/main/requirements.txt#L1-L5
|
|
|
|
hassil
|
|
|
|
pyyaml
|
|
|
|
voluptuous
|
|
|
|
regex
|
|
|
|
jinja2
|
2023-02-02 18:25:31 +00:00
|
|
|
];
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
postInstall = ''
|
|
|
|
# https://github.com/home-assistant/intents-package/blob/main/script/package#L23-L24
|
|
|
|
PACKAGE_DIR=$out/${python.sitePackages}/home_assistant_intents
|
|
|
|
${python.pythonOnBuildForHost.interpreter} script/merged_output.py $PACKAGE_DIR/data
|
|
|
|
${python.pythonOnBuildForHost.interpreter} script/write_languages.py $PACKAGE_DIR/data > $PACKAGE_DIR/languages.py
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
pytest-xdist
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
2023-02-02 18:25:31 +00:00
|
|
|
|
|
|
|
pytestFlagsArray = [
|
2023-08-04 22:07:22 +00:00
|
|
|
"intents/tests"
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Intents to be used with Home Assistant";
|
|
|
|
homepage = "https://github.com/home-assistant/intents";
|
|
|
|
license = licenses.cc-by-40;
|
|
|
|
maintainers = teams.home-assistant.members;
|
|
|
|
};
|
|
|
|
}
|