2023-01-12 06:06:41 +01:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
2024-04-23 21:08:55 +02:00
|
|
|
, fetchFromGitHub
|
2023-01-12 06:06:41 +01:00
|
|
|
, pythonOlder
|
|
|
|
|
2024-02-09 16:38:52 +01:00
|
|
|
# build-system
|
2023-08-20 10:50:04 +02:00
|
|
|
, setuptools
|
2024-04-23 21:08:55 +02:00
|
|
|
|
|
|
|
# codegen
|
|
|
|
, hassil
|
|
|
|
, python
|
|
|
|
, pyyaml
|
|
|
|
, voluptuous
|
|
|
|
, regex
|
|
|
|
, jinja2
|
|
|
|
|
|
|
|
# tests
|
|
|
|
, pytest-xdist
|
|
|
|
, pytestCheckHook
|
2023-01-12 06:06:41 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "home-assistant-intents";
|
2024-05-04 15:45:32 +02:00
|
|
|
version = "2024.4.24";
|
2024-04-23 21:08:55 +02:00
|
|
|
pyproject = true;
|
2023-01-12 06:06:41 +01:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.9";
|
|
|
|
|
2024-04-23 21:08:55 +02:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "home-assistant";
|
|
|
|
repo = "intents-package";
|
2024-05-04 15:45:32 +02:00
|
|
|
# https://github.com/home-assistant/intents-package/issues/3
|
|
|
|
rev = "a68176a189c3def87cb11ad39baacea2440ce668";
|
|
|
|
hash = "sha256-SUIJWoA0ltg+bjYn4J5kvAk4Eh23uxEcdxonkTSV0m0=";
|
2024-04-23 21:08:55 +02:00
|
|
|
fetchSubmodules = true;
|
2023-01-12 06:06:41 +01:00
|
|
|
};
|
|
|
|
|
2024-04-23 21:08:55 +02:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pyproject.toml \
|
|
|
|
--replace-fail "setuptools~=62.3" "setuptools" \
|
|
|
|
--replace-fail "wheel~=0.37.1" "wheel"
|
|
|
|
'';
|
|
|
|
|
2024-04-06 17:01:56 +02:00
|
|
|
build-system = [
|
2023-01-12 06:06:41 +01:00
|
|
|
setuptools
|
2024-04-23 21:08:55 +02:00
|
|
|
|
|
|
|
# build-time codegen; https://github.com/home-assistant/intents/blob/main/requirements.txt#L1-L5
|
|
|
|
hassil
|
|
|
|
pyyaml
|
|
|
|
voluptuous
|
|
|
|
regex
|
|
|
|
jinja2
|
2023-01-12 06:06:41 +01:00
|
|
|
];
|
|
|
|
|
2024-04-23 21:08:55 +02: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-01-12 06:06:41 +01:00
|
|
|
|
|
|
|
pytestFlagsArray = [
|
2023-08-02 20:10:01 +02:00
|
|
|
"intents/tests"
|
|
|
|
];
|
|
|
|
|
2023-01-12 06:06:41 +01: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;
|
|
|
|
};
|
|
|
|
}
|