diff --git a/pkgs/development/python-modules/python-songpal/default.nix b/pkgs/development/python-modules/python-songpal/default.nix new file mode 100644 index 000000000000..180e5b3d833e --- /dev/null +++ b/pkgs/development/python-modules/python-songpal/default.nix @@ -0,0 +1,68 @@ +{ lib +, buildPythonPackage +, pythonOlder +, fetchFromGitHub +, fetchpatch +, poetry-core +, aiohttp +, async-upnp-client +, attrs +, click +, importlib-metadata +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "python-songpal"; + version = "0.13"; + + format = "pyproject"; + + disabled = pythonOlder "3.6"; + + src = fetchFromGitHub { + owner = "rytilahti"; + repo = "python-songpal"; + rev = version; + sha256 = "124w6vfn992845k09bjv352havk8pg590b135m37h1x1m7fmbpwa"; + }; + + patches = [ + # https://github.com/rytilahti/python-songpal/pull/90 + (fetchpatch { + name = "switch-to-poetry-core.patch"; + url = "https://github.com/rytilahti/python-songpal/commit/56b634790d94b2f9788d5af3d5cedff47f1e42c2.patch"; + sha256 = "0yc0mrb91ywk77nd4mxvyc0p2kjz2w1p395755a32ls30zw2bs27"; + }) + ]; + + postPatch = '' + # https://github.com/rytilahti/python-songpal/issues/91 + substituteInPlace pyproject.toml \ + --replace 'click = "^7"' 'click = "*"' + ''; + + nativeBuildInputs = [ + poetry-core + ]; + + propagatedBuildInputs = [ + aiohttp + async-upnp-client + attrs + click + importlib-metadata + ]; + + # no tests implemented + doCheck = false; + + pythonImportsCheck = [ "songpal" ]; + + meta = with lib; { + description = "Python library for interfacing with Sony's Songpal devices"; + homepage = "https://github.com/rytilahti/python-songpal"; + license = licenses.gpl3Only; + maintainers = with maintainers; [ dotlambda ]; + }; +} diff --git a/pkgs/servers/home-assistant/component-packages.nix b/pkgs/servers/home-assistant/component-packages.nix index f4f599117153..73b2b1294d87 100644 --- a/pkgs/servers/home-assistant/component-packages.nix +++ b/pkgs/servers/home-assistant/component-packages.nix @@ -787,7 +787,7 @@ "somfy" = ps: with ps; [ aiohttp-cors pymfy ]; "somfy_mylink" = ps: with ps; [ ]; # missing inputs: somfy-mylink-synergy "sonarr" = ps: with ps; [ ]; # missing inputs: sonarr - "songpal" = ps: with ps; [ ]; # missing inputs: python-songpal + "songpal" = ps: with ps; [ python-songpal ]; "sonos" = ps: with ps; [ aiohttp-cors plexapi plexauth plexwebsocket pysonos ]; "sony_projector" = ps: with ps; [ ]; # missing inputs: pysdcp "soundtouch" = ps: with ps; [ aiohttp-cors ifaddr libsoundtouch zeroconf ]; diff --git a/pkgs/servers/home-assistant/default.nix b/pkgs/servers/home-assistant/default.nix index c86258d4a85a..5542f9432953 100644 --- a/pkgs/servers/home-assistant/default.nix +++ b/pkgs/servers/home-assistant/default.nix @@ -665,6 +665,7 @@ in with py.pkgs; buildPythonApplication rec { "solaredge" "soma" "somfy" + "songpal" "sonos" "soundtouch" "spaceapi" diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 143b8dc2bd8d..6af98d34e7ef 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -5365,6 +5365,8 @@ in { python-openzwave-mqtt = callPackage ../development/python-modules/python-openzwave-mqtt { }; + python-songpal = callPackage ../development/python-modules/python-songpal { }; + python-tado = callPackage ../development/python-modules/python-tado { }; pkutils = callPackage ../development/python-modules/pkutils { };