From 8aa58d71f6e80aef536660dc074615d09701e2f8 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Wed, 5 Jun 2024 23:02:58 +0200 Subject: [PATCH] python312Packages.home-assistant-bluetooth: fix habluetooth 3.0 compat --- .../home-assistant-bluetooth/default.nix | 5 ++ .../habluetooth-3.0-compat.patch | 50 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 pkgs/development/python-modules/home-assistant-bluetooth/habluetooth-3.0-compat.patch diff --git a/pkgs/development/python-modules/home-assistant-bluetooth/default.nix b/pkgs/development/python-modules/home-assistant-bluetooth/default.nix index fba93118b9de..f155a5db19c3 100644 --- a/pkgs/development/python-modules/home-assistant-bluetooth/default.nix +++ b/pkgs/development/python-modules/home-assistant-bluetooth/default.nix @@ -31,6 +31,11 @@ buildPythonPackage rec { hash = "sha256-KTaZ3xbZpBIN5zP73YdJW6QeCQThGdqejnfWwvL+0R8="; }; + patches = [ + # https://github.com/home-assistant-libs/home-assistant-bluetooth/issues/38 + ./habluetooth-3.0-compat.patch + ]; + postPatch = '' # drop pytest parametrization (coverage, etc.) sed -i '/addopts/d' pyproject.toml diff --git a/pkgs/development/python-modules/home-assistant-bluetooth/habluetooth-3.0-compat.patch b/pkgs/development/python-modules/home-assistant-bluetooth/habluetooth-3.0-compat.patch new file mode 100644 index 000000000000..c56d890fd8aa --- /dev/null +++ b/pkgs/development/python-modules/home-assistant-bluetooth/habluetooth-3.0-compat.patch @@ -0,0 +1,50 @@ +diff --git a/tests/test_models.py b/tests/test_models.py +index ecfd70c..b8001f2 100644 +--- a/tests/test_models.py ++++ b/tests/test_models.py +@@ -88,6 +88,7 @@ def test_model_from_scanner(): + "service_uuids": ["cba20d00-224d-11e6-9fb8-0002a5d5c51b"], + "source": "local", + "time": now, ++ "tx_power": -127, + } + + +@@ -109,6 +110,7 @@ def test_construct_service_info_bleak(): + advertisement=switchbot_adv, + connectable=False, + time=now, ++ tx_power=None, + ) + + assert service_info.service_uuids == ["cba20d00-224d-11e6-9fb8-0002a5d5c51b"] +@@ -132,6 +134,7 @@ def test_construct_service_info_bleak(): + "service_uuids": ["cba20d00-224d-11e6-9fb8-0002a5d5c51b"], + "source": "local", + "time": now, ++ "tx_power": None, + } + + +@@ -165,6 +168,7 @@ def test_from_device_and_advertisement_data(): + "service_uuids": ["cba20d00-224d-11e6-9fb8-0002a5d5c51b"], + "source": "local", + "time": now_monotonic, ++ "tx_power": -127, + } + + +@@ -200,6 +204,7 @@ def test_pyobjc_compat(): + advertisement=switchbot_adv, + connectable=False, + time=now, ++ tx_power=None, + ) + + assert service_info.service_uuids == ["cba20d00-224d-11e6-9fb8-0002a5d5c51b"] +@@ -223,4 +228,5 @@ def test_pyobjc_compat(): + "service_uuids": ["cba20d00-224d-11e6-9fb8-0002a5d5c51b"], + "source": "local", + "time": now, ++ "tx_power": None, + }