Updating ywsd dependency

This commit is contained in:
clerie 2023-06-17 20:51:05 +02:00
parent 0b30cb2bc7
commit f6eefbfc8e
2 changed files with 21 additions and 15 deletions

View File

@ -11,6 +11,21 @@ import yate.asyncio
logger = logging.getLogger("fieldpoc.ywsd") 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: class Ywsd:
def __init__(self, fp): def __init__(self, fp):
self.fp = fp self.fp = fp
@ -55,17 +70,7 @@ class Ywsd:
def run(self): 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) 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") logger.info("starting ywsd")
self.app = ywsd.engine.YateRoutingEngine(settings=self.settings(), web_only=False, **self.settings().YATE_CONNECTION) self.app = ywsd.engine.YateRoutingEngine(settings=self.settings(), web_only=False, **self.settings().YATE_CONNECTION)

View File

@ -31,13 +31,13 @@
ywsd = pkgs.python3Packages.buildPythonApplication rec { ywsd = pkgs.python3Packages.buildPythonApplication rec {
pname = "ywsd"; pname = "ywsd";
version = "0.11.0"; version = "0.12.2";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "eventphone"; owner = "eventphone";
repo = pname; repo = pname;
rev = "905a5bdee7a779eef83bc96d9c9a5b7a2212d5f0"; rev = "v${version}";
sha256 = "sha256-UNpr1OCmb7U6TisgVcnZVSbhdgQ3AREX/XNXru+UsF4="; sha256 = "sha256-VkL7MhK6Z0Y1Hnnoq0Ukyclk9gfc4u8qav6yNj+LCJg=";
}; };
propagatedBuildInputs = [ propagatedBuildInputs = [
@ -53,14 +53,15 @@
python-yate = pkgs.python3Packages.buildPythonPackage rec { python-yate = pkgs.python3Packages.buildPythonPackage rec {
pname = "python-yate"; pname = "python-yate";
version = "0.3.1"; version = "0.4.1";
src = pkgs.python3Packages.fetchPypi { src = pkgs.python3Packages.fetchPypi {
inherit pname version; inherit pname version;
sha256 = "5e806802dc47a35c855b60cd459a2c98fb0109c7fc099f3e9f83a1a38abf9f90"; sha256 = "sha256-rx0hcmP4SmvCkKXawyiMTKCVpTKTAgZVpbdQFdxV+hs=";
}; };
propagatedBuildInputs = [ propagatedBuildInputs = [
pkgs.python3Packages.aiohttp
pkgs.python3Packages.async-timeout pkgs.python3Packages.async-timeout
]; ];