From f6eefbfc8ee3c1ae22e7ff21fda5e1a31a4a0d2e Mon Sep 17 00:00:00 2001 From: clerie Date: Sat, 17 Jun 2023 20:51:05 +0200 Subject: [PATCH] Updating ywsd dependency --- fieldpoc/ywsd.py | 25 +++++++++++++++---------- flake.nix | 11 ++++++----- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/fieldpoc/ywsd.py b/fieldpoc/ywsd.py index bcca4af..ab69843 100644 --- a/fieldpoc/ywsd.py +++ b/fieldpoc/ywsd.py @@ -11,6 +11,21 @@ import yate.asyncio logger = logging.getLogger("fieldpoc.ywsd") +### BEGIN Monkeypatches + +# disable asyncio signal handlers +def add_signal_handler(*args, **kwargs): + raise NotImplementedError("Disable signal handling so we can run ywsd in a thread") +asyncio.unix_events._UnixSelectorEventLoop.add_signal_handler = add_signal_handler + +# paython-yate stuff I have no idea why anymore +async def setup_for_tcp(self, host, port): + self.reader, self.writer = await asyncio.open_connection(host, port) + self.send_connect() +yate.asyncio.YateAsync.setup_for_tcp = setup_for_tcp + +### END Monkeypatches + class Ywsd: def __init__(self, fp): self.fp = fp @@ -55,17 +70,7 @@ class Ywsd: def run(self): - # Mokey patch python-yate so I don't have to fork it yet - async def setup_for_tcp(self, host, port): - self.reader, self.writer = await asyncio.open_connection(host, port) - self.send_connect() - yate.asyncio.YateAsync.setup_for_tcp = setup_for_tcp - - # Mokey patch ywsd so I don't have to fork it yet asyncio.set_event_loop(self.event_loop) - def add_signal_handler(*args, **kwargs): - raise NotImplementedError("Disable signal handling so we can run ywsd in a thread") - asyncio.get_event_loop().add_signal_handler = add_signal_handler logger.info("starting ywsd") self.app = ywsd.engine.YateRoutingEngine(settings=self.settings(), web_only=False, **self.settings().YATE_CONNECTION) diff --git a/flake.nix b/flake.nix index da94c3a..13b63d7 100644 --- a/flake.nix +++ b/flake.nix @@ -31,13 +31,13 @@ ywsd = pkgs.python3Packages.buildPythonApplication rec { pname = "ywsd"; - version = "0.11.0"; + version = "0.12.2"; src = pkgs.fetchFromGitHub { owner = "eventphone"; repo = pname; - rev = "905a5bdee7a779eef83bc96d9c9a5b7a2212d5f0"; - sha256 = "sha256-UNpr1OCmb7U6TisgVcnZVSbhdgQ3AREX/XNXru+UsF4="; + rev = "v${version}"; + sha256 = "sha256-VkL7MhK6Z0Y1Hnnoq0Ukyclk9gfc4u8qav6yNj+LCJg="; }; propagatedBuildInputs = [ @@ -53,14 +53,15 @@ python-yate = pkgs.python3Packages.buildPythonPackage rec { pname = "python-yate"; - version = "0.3.1"; + version = "0.4.1"; src = pkgs.python3Packages.fetchPypi { inherit pname version; - sha256 = "5e806802dc47a35c855b60cd459a2c98fb0109c7fc099f3e9f83a1a38abf9f90"; + sha256 = "sha256-rx0hcmP4SmvCkKXawyiMTKCVpTKTAgZVpbdQFdxV+hs="; }; propagatedBuildInputs = [ + pkgs.python3Packages.aiohttp pkgs.python3Packages.async-timeout ];