2023-01-20 10:41:00 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pythonOlder
|
|
|
|
|
|
|
|
# build
|
|
|
|
, setuptools
|
|
|
|
|
|
|
|
# propagates
|
|
|
|
, aiohttp
|
|
|
|
, aiorun
|
2024-01-02 11:29:13 +00:00
|
|
|
, async-timeout
|
2023-01-20 10:41:00 +00:00
|
|
|
, coloredlogs
|
|
|
|
, dacite
|
|
|
|
, orjson
|
|
|
|
, home-assistant-chip-clusters
|
|
|
|
|
|
|
|
# optionals
|
2023-04-12 12:48:02 +00:00
|
|
|
, cryptography
|
2023-01-20 10:41:00 +00:00
|
|
|
, home-assistant-chip-core
|
|
|
|
|
|
|
|
# tests
|
|
|
|
, python
|
|
|
|
, pytest
|
|
|
|
, pytest-aiohttp
|
|
|
|
, pytestCheckHook
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "python-matter-server";
|
2024-01-13 08:15:51 +00:00
|
|
|
version = "5.1.1";
|
2023-01-20 10:41:00 +00:00
|
|
|
format = "pyproject";
|
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
disabled = pythonOlder "3.10";
|
2023-01-20 10:41:00 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "home-assistant-libs";
|
|
|
|
repo = "python-matter-server";
|
|
|
|
rev = "refs/tags/${version}";
|
2024-01-13 08:15:51 +00:00
|
|
|
hash = "sha256-y4gapml7rIwOu1TVDEHPch7JS5Rl/cIfMLeVMIFzXOY=";
|
2023-01-20 10:41:00 +00:00
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pyproject.toml \
|
|
|
|
--replace 'version = "0.0.0"' 'version = "${version}"'
|
|
|
|
'';
|
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
setuptools
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
aiohttp
|
|
|
|
aiorun
|
2024-01-02 11:29:13 +00:00
|
|
|
async-timeout
|
2023-01-20 10:41:00 +00:00
|
|
|
coloredlogs
|
|
|
|
dacite
|
|
|
|
orjson
|
|
|
|
home-assistant-chip-clusters
|
|
|
|
];
|
|
|
|
|
|
|
|
passthru.optional-dependencies = {
|
|
|
|
server = [
|
2023-04-12 12:48:02 +00:00
|
|
|
cryptography
|
2023-01-20 10:41:00 +00:00
|
|
|
home-assistant-chip-core
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2023-01-20 10:41:00 +00:00
|
|
|
pytest-aiohttp
|
|
|
|
pytestCheckHook
|
|
|
|
]
|
|
|
|
++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
|
|
|
|
|
|
|
|
preCheck = let
|
2023-02-02 18:25:31 +00:00
|
|
|
pythonEnv = python.withPackages (_: propagatedBuildInputs ++ nativeCheckInputs ++ [ pytest ]);
|
2023-01-20 10:41:00 +00:00
|
|
|
in
|
|
|
|
''
|
|
|
|
export PYTHONPATH=${pythonEnv}/${python.sitePackages}
|
|
|
|
'';
|
|
|
|
|
|
|
|
pytestFlagsArray = [
|
|
|
|
# Upstream theymselves limit the test scope
|
|
|
|
# https://github.com/home-assistant-libs/python-matter-server/blob/main/.github/workflows/test.yml#L65
|
|
|
|
"tests/server"
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
changelog = "https://github.com/home-assistant-libs/python-matter-server/releases/tag/${version}";
|
|
|
|
description = "Python server to interact with Matter";
|
|
|
|
homepage = "https://github.com/home-assistant-libs/python-matter-server";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = teams.home-assistant.members;
|
|
|
|
};
|
|
|
|
}
|