Loading pkgs/development/python-modules/aioimaplib/default.nix +5 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,11 @@ buildPythonPackage rec { hash = "sha256-njzSpKPis033eLoRKXL538ljyMOB43chslio1wodrKU="; }; patches = [ # https://github.com/iroco-co/aioimaplib/issues/125 ./event-loop.patch ]; build-system = [ poetry-core ]; nativeCheckInputs = [ Loading pkgs/development/python-modules/aioimaplib/event-loop.patch 0 → 100644 +25 −0 Original line number Diff line number Diff line diff --git a/aioimaplib/imap_testing_server.py b/aioimaplib/imap_testing_server.py index b303aa3..419b808 100644 --- a/aioimaplib/imap_testing_server.py +++ b/aioimaplib/imap_testing_server.py @@ -198,12 +198,18 @@ class ImapProtocol(asyncio.Protocol): DEFAULT_QUOTA = 5000 def __init__(self, server_state, fetch_chunk_size=0, capabilities=CAPABILITIES, - loop=asyncio.get_event_loop()): + loop=None): self.uidvalidity = int(datetime.now().timestamp()) self.capabilities = capabilities self.state_to_send = list() self.delay_seconds = 0 - self.loop = loop + if loop is None: + try: + self.loop = asyncio.get_running_loop() + except RuntimeError: + self.loop = asyncio.new_event_loop() + else: + self.loop = loop self.fetch_chunk_size = fetch_chunk_size self.transport = None self.server_state = server_state No newline at end of file Loading
pkgs/development/python-modules/aioimaplib/default.nix +5 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,11 @@ buildPythonPackage rec { hash = "sha256-njzSpKPis033eLoRKXL538ljyMOB43chslio1wodrKU="; }; patches = [ # https://github.com/iroco-co/aioimaplib/issues/125 ./event-loop.patch ]; build-system = [ poetry-core ]; nativeCheckInputs = [ Loading
pkgs/development/python-modules/aioimaplib/event-loop.patch 0 → 100644 +25 −0 Original line number Diff line number Diff line diff --git a/aioimaplib/imap_testing_server.py b/aioimaplib/imap_testing_server.py index b303aa3..419b808 100644 --- a/aioimaplib/imap_testing_server.py +++ b/aioimaplib/imap_testing_server.py @@ -198,12 +198,18 @@ class ImapProtocol(asyncio.Protocol): DEFAULT_QUOTA = 5000 def __init__(self, server_state, fetch_chunk_size=0, capabilities=CAPABILITIES, - loop=asyncio.get_event_loop()): + loop=None): self.uidvalidity = int(datetime.now().timestamp()) self.capabilities = capabilities self.state_to_send = list() self.delay_seconds = 0 - self.loop = loop + if loop is None: + try: + self.loop = asyncio.get_running_loop() + except RuntimeError: + self.loop = asyncio.new_event_loop() + else: + self.loop = loop self.fetch_chunk_size = fetch_chunk_size self.transport = None self.server_state = server_state No newline at end of file