Merge pull request #306357 from mweinelt/intents-unfuck
home-assistant.intents: return to source build
This commit is contained in:
commit
51347f6c67
1 changed files with 44 additions and 10 deletions
|
@ -1,33 +1,67 @@
|
||||||
{ lib
|
{ lib
|
||||||
, buildPythonPackage
|
, buildPythonPackage
|
||||||
, fetchPypi
|
, fetchFromGitHub
|
||||||
, pythonOlder
|
, pythonOlder
|
||||||
|
|
||||||
# build-system
|
# build-system
|
||||||
, setuptools
|
, setuptools
|
||||||
|
|
||||||
|
# codegen
|
||||||
|
, hassil
|
||||||
|
, python
|
||||||
|
, pyyaml
|
||||||
|
, voluptuous
|
||||||
|
, regex
|
||||||
|
, jinja2
|
||||||
|
|
||||||
|
# tests
|
||||||
|
, pytest-xdist
|
||||||
|
, pytestCheckHook
|
||||||
}:
|
}:
|
||||||
|
|
||||||
buildPythonPackage rec {
|
buildPythonPackage rec {
|
||||||
pname = "home-assistant-intents";
|
pname = "home-assistant-intents";
|
||||||
version = "2024.4.3";
|
version = "2024.4.3";
|
||||||
format = "wheel";
|
pyproject = true;
|
||||||
|
|
||||||
disabled = pythonOlder "3.9";
|
disabled = pythonOlder "3.9";
|
||||||
|
|
||||||
src = fetchPypi {
|
src = fetchFromGitHub {
|
||||||
inherit version format;
|
owner = "home-assistant";
|
||||||
pname = "home_assistant_intents";
|
repo = "intents-package";
|
||||||
dist = "py3";
|
rev = "refs/tags/${version}";
|
||||||
python = "py3";
|
hash = "sha256-hcstD1qkngZAl/jKLez+4qDs/ZIandkVkY2jrvZqph8=";
|
||||||
hash = "sha256-GraYVtioKIoKlPRBhhhzlbBfI6heXAaA1MQpUqAgEDQ=";
|
fetchSubmodules = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
postPatch = ''
|
||||||
|
substituteInPlace pyproject.toml \
|
||||||
|
--replace-fail "setuptools~=62.3" "setuptools" \
|
||||||
|
--replace-fail "wheel~=0.37.1" "wheel"
|
||||||
|
'';
|
||||||
|
|
||||||
build-system = [
|
build-system = [
|
||||||
setuptools
|
setuptools
|
||||||
|
|
||||||
|
# build-time codegen; https://github.com/home-assistant/intents/blob/main/requirements.txt#L1-L5
|
||||||
|
hassil
|
||||||
|
pyyaml
|
||||||
|
voluptuous
|
||||||
|
regex
|
||||||
|
jinja2
|
||||||
];
|
];
|
||||||
|
|
||||||
# sdist/wheel do not ship tests
|
postInstall = ''
|
||||||
doCheck = false;
|
# 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
|
||||||
|
];
|
||||||
|
|
||||||
pytestFlagsArray = [
|
pytestFlagsArray = [
|
||||||
"intents/tests"
|
"intents/tests"
|
||||||
|
|
Loading…
Reference in a new issue