ominfra 0.0.0.dev79__py3-none-any.whl → 0.0.0.dev80__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -596,81 +596,88 @@ class PollPoller(BasePoller):
596
596
  return False
597
597
 
598
598
 
599
- class KqueuePoller(BasePoller):
600
- max_events = 1000
599
+ if sys.platform == 'darwin' or sys.platform.startswith('freebsd'):
600
+ class KqueuePoller(BasePoller):
601
+ max_events = 1000
601
602
 
602
- def __init__(self) -> None:
603
- super().__init__()
603
+ def __init__(self) -> None:
604
+ super().__init__()
604
605
 
605
- self._kqueue: ta.Optional[ta.Any] = select.kqueue()
606
- self._readables: set[int] = set()
607
- self._writables: set[int] = set()
606
+ self._kqueue: ta.Optional[ta.Any] = select.kqueue()
607
+ self._readables: set[int] = set()
608
+ self._writables: set[int] = set()
608
609
 
609
- def register_readable(self, fd: int) -> None:
610
- self._readables.add(fd)
611
- kevent = select.kevent(fd, filter=select.KQ_FILTER_READ, flags=select.KQ_EV_ADD)
612
- self._kqueue_control(fd, kevent)
610
+ def register_readable(self, fd: int) -> None:
611
+ self._readables.add(fd)
612
+ kevent = select.kevent(fd, filter=select.KQ_FILTER_READ, flags=select.KQ_EV_ADD)
613
+ self._kqueue_control(fd, kevent)
613
614
 
614
- def register_writable(self, fd: int) -> None:
615
- self._writables.add(fd)
616
- kevent = select.kevent(fd, filter=select.KQ_FILTER_WRITE, flags=select.KQ_EV_ADD)
617
- self._kqueue_control(fd, kevent)
615
+ def register_writable(self, fd: int) -> None:
616
+ self._writables.add(fd)
617
+ kevent = select.kevent(fd, filter=select.KQ_FILTER_WRITE, flags=select.KQ_EV_ADD)
618
+ self._kqueue_control(fd, kevent)
618
619
 
619
- def unregister_readable(self, fd: int) -> None:
620
- kevent = select.kevent(fd, filter=select.KQ_FILTER_READ, flags=select.KQ_EV_DELETE)
621
- self._readables.discard(fd)
622
- self._kqueue_control(fd, kevent)
620
+ def unregister_readable(self, fd: int) -> None:
621
+ kevent = select.kevent(fd, filter=select.KQ_FILTER_READ, flags=select.KQ_EV_DELETE)
622
+ self._readables.discard(fd)
623
+ self._kqueue_control(fd, kevent)
623
624
 
624
- def unregister_writable(self, fd: int) -> None:
625
- kevent = select.kevent(fd, filter=select.KQ_FILTER_WRITE, flags=select.KQ_EV_DELETE)
626
- self._writables.discard(fd)
627
- self._kqueue_control(fd, kevent)
625
+ def unregister_writable(self, fd: int) -> None:
626
+ kevent = select.kevent(fd, filter=select.KQ_FILTER_WRITE, flags=select.KQ_EV_DELETE)
627
+ self._writables.discard(fd)
628
+ self._kqueue_control(fd, kevent)
628
629
 
629
- def _kqueue_control(self, fd: int, kevent: 'select.kevent') -> None:
630
- try:
631
- self._kqueue.control([kevent], 0) # type: ignore
632
- except OSError as error:
633
- if error.errno == errno.EBADF:
634
- log.debug('EBADF encountered in kqueue. Invalid file descriptor %s', fd)
635
- else:
636
- raise
630
+ def _kqueue_control(self, fd: int, kevent: 'select.kevent') -> None:
631
+ try:
632
+ self._kqueue.control([kevent], 0) # type: ignore
633
+ except OSError as error:
634
+ if error.errno == errno.EBADF:
635
+ log.debug('EBADF encountered in kqueue. Invalid file descriptor %s', fd)
636
+ else:
637
+ raise
637
638
 
638
- def poll(self, timeout: ta.Optional[float]) -> ta.Tuple[ta.List[int], ta.List[int]]:
639
- readables, writables = [], [] # type: ignore
639
+ def poll(self, timeout: ta.Optional[float]) -> ta.Tuple[ta.List[int], ta.List[int]]:
640
+ readables, writables = [], [] # type: ignore
640
641
 
641
- try:
642
- kevents = self._kqueue.control(None, self.max_events, timeout) # type: ignore
643
- except OSError as error:
644
- if error.errno == errno.EINTR:
645
- log.debug('EINTR encountered in poll')
646
- return readables, writables
647
- raise
642
+ try:
643
+ kevents = self._kqueue.control(None, self.max_events, timeout) # type: ignore
644
+ except OSError as error:
645
+ if error.errno == errno.EINTR:
646
+ log.debug('EINTR encountered in poll')
647
+ return readables, writables
648
+ raise
648
649
 
649
- for kevent in kevents:
650
- if kevent.filter == select.KQ_FILTER_READ:
651
- readables.append(kevent.ident)
652
- if kevent.filter == select.KQ_FILTER_WRITE:
653
- writables.append(kevent.ident)
650
+ for kevent in kevents:
651
+ if kevent.filter == select.KQ_FILTER_READ:
652
+ readables.append(kevent.ident)
653
+ if kevent.filter == select.KQ_FILTER_WRITE:
654
+ writables.append(kevent.ident)
654
655
 
655
- return readables, writables
656
+ return readables, writables
656
657
 
657
- def before_daemonize(self) -> None:
658
- self.close()
658
+ def before_daemonize(self) -> None:
659
+ self.close()
659
660
 
660
- def after_daemonize(self) -> None:
661
- self._kqueue = select.kqueue()
662
- for fd in self._readables:
663
- self.register_readable(fd)
664
- for fd in self._writables:
665
- self.register_writable(fd)
661
+ def after_daemonize(self) -> None:
662
+ self._kqueue = select.kqueue()
663
+ for fd in self._readables:
664
+ self.register_readable(fd)
665
+ for fd in self._writables:
666
+ self.register_writable(fd)
666
667
 
667
- def close(self) -> None:
668
- self._kqueue.close() # type: ignore
669
- self._kqueue = None
668
+ def close(self) -> None:
669
+ self._kqueue.close() # type: ignore
670
+ self._kqueue = None
671
+
672
+ else:
673
+ KqueuePoller = None
670
674
 
671
675
 
672
676
  Poller: ta.Type[BasePoller]
673
- if hasattr(select, 'kqueue'):
677
+ if (
678
+ sys.platform == 'darwin' or sys.platform.startswith('freebsd') and
679
+ hasattr(select, 'kqueue') and KqueuePoller is not None
680
+ ):
674
681
  Poller = KqueuePoller
675
682
  elif hasattr(select, 'poll'):
676
683
  Poller = PollPoller
@@ -3,6 +3,7 @@ import abc
3
3
  import errno
4
4
  import logging
5
5
  import select
6
+ import sys
6
7
  import typing as ta
7
8
 
8
9
 
@@ -150,81 +151,88 @@ class PollPoller(BasePoller):
150
151
  return False
151
152
 
152
153
 
153
- class KqueuePoller(BasePoller):
154
- max_events = 1000
154
+ if sys.platform == 'darwin' or sys.platform.startswith('freebsd'):
155
+ class KqueuePoller(BasePoller):
156
+ max_events = 1000
155
157
 
156
- def __init__(self) -> None:
157
- super().__init__()
158
-
159
- self._kqueue: ta.Optional[ta.Any] = select.kqueue()
160
- self._readables: set[int] = set()
161
- self._writables: set[int] = set()
158
+ def __init__(self) -> None:
159
+ super().__init__()
162
160
 
163
- def register_readable(self, fd: int) -> None:
164
- self._readables.add(fd)
165
- kevent = select.kevent(fd, filter=select.KQ_FILTER_READ, flags=select.KQ_EV_ADD)
166
- self._kqueue_control(fd, kevent)
161
+ self._kqueue: ta.Optional[ta.Any] = select.kqueue()
162
+ self._readables: set[int] = set()
163
+ self._writables: set[int] = set()
167
164
 
168
- def register_writable(self, fd: int) -> None:
169
- self._writables.add(fd)
170
- kevent = select.kevent(fd, filter=select.KQ_FILTER_WRITE, flags=select.KQ_EV_ADD)
171
- self._kqueue_control(fd, kevent)
165
+ def register_readable(self, fd: int) -> None:
166
+ self._readables.add(fd)
167
+ kevent = select.kevent(fd, filter=select.KQ_FILTER_READ, flags=select.KQ_EV_ADD)
168
+ self._kqueue_control(fd, kevent)
172
169
 
173
- def unregister_readable(self, fd: int) -> None:
174
- kevent = select.kevent(fd, filter=select.KQ_FILTER_READ, flags=select.KQ_EV_DELETE)
175
- self._readables.discard(fd)
176
- self._kqueue_control(fd, kevent)
170
+ def register_writable(self, fd: int) -> None:
171
+ self._writables.add(fd)
172
+ kevent = select.kevent(fd, filter=select.KQ_FILTER_WRITE, flags=select.KQ_EV_ADD)
173
+ self._kqueue_control(fd, kevent)
177
174
 
178
- def unregister_writable(self, fd: int) -> None:
179
- kevent = select.kevent(fd, filter=select.KQ_FILTER_WRITE, flags=select.KQ_EV_DELETE)
180
- self._writables.discard(fd)
181
- self._kqueue_control(fd, kevent)
175
+ def unregister_readable(self, fd: int) -> None:
176
+ kevent = select.kevent(fd, filter=select.KQ_FILTER_READ, flags=select.KQ_EV_DELETE)
177
+ self._readables.discard(fd)
178
+ self._kqueue_control(fd, kevent)
182
179
 
183
- def _kqueue_control(self, fd: int, kevent: 'select.kevent') -> None:
184
- try:
185
- self._kqueue.control([kevent], 0) # type: ignore
186
- except OSError as error:
187
- if error.errno == errno.EBADF:
188
- log.debug('EBADF encountered in kqueue. Invalid file descriptor %s', fd)
189
- else:
180
+ def unregister_writable(self, fd: int) -> None:
181
+ kevent = select.kevent(fd, filter=select.KQ_FILTER_WRITE, flags=select.KQ_EV_DELETE)
182
+ self._writables.discard(fd)
183
+ self._kqueue_control(fd, kevent)
184
+
185
+ def _kqueue_control(self, fd: int, kevent: 'select.kevent') -> None:
186
+ try:
187
+ self._kqueue.control([kevent], 0) # type: ignore
188
+ except OSError as error:
189
+ if error.errno == errno.EBADF:
190
+ log.debug('EBADF encountered in kqueue. Invalid file descriptor %s', fd)
191
+ else:
192
+ raise
193
+
194
+ def poll(self, timeout: ta.Optional[float]) -> ta.Tuple[ta.List[int], ta.List[int]]:
195
+ readables, writables = [], [] # type: ignore
196
+
197
+ try:
198
+ kevents = self._kqueue.control(None, self.max_events, timeout) # type: ignore
199
+ except OSError as error:
200
+ if error.errno == errno.EINTR:
201
+ log.debug('EINTR encountered in poll')
202
+ return readables, writables
190
203
  raise
191
204
 
192
- def poll(self, timeout: ta.Optional[float]) -> ta.Tuple[ta.List[int], ta.List[int]]:
193
- readables, writables = [], [] # type: ignore
205
+ for kevent in kevents:
206
+ if kevent.filter == select.KQ_FILTER_READ:
207
+ readables.append(kevent.ident)
208
+ if kevent.filter == select.KQ_FILTER_WRITE:
209
+ writables.append(kevent.ident)
194
210
 
195
- try:
196
- kevents = self._kqueue.control(None, self.max_events, timeout) # type: ignore
197
- except OSError as error:
198
- if error.errno == errno.EINTR:
199
- log.debug('EINTR encountered in poll')
200
- return readables, writables
201
- raise
211
+ return readables, writables
202
212
 
203
- for kevent in kevents:
204
- if kevent.filter == select.KQ_FILTER_READ:
205
- readables.append(kevent.ident)
206
- if kevent.filter == select.KQ_FILTER_WRITE:
207
- writables.append(kevent.ident)
213
+ def before_daemonize(self) -> None:
214
+ self.close()
208
215
 
209
- return readables, writables
216
+ def after_daemonize(self) -> None:
217
+ self._kqueue = select.kqueue()
218
+ for fd in self._readables:
219
+ self.register_readable(fd)
220
+ for fd in self._writables:
221
+ self.register_writable(fd)
210
222
 
211
- def before_daemonize(self) -> None:
212
- self.close()
223
+ def close(self) -> None:
224
+ self._kqueue.close() # type: ignore
225
+ self._kqueue = None
213
226
 
214
- def after_daemonize(self) -> None:
215
- self._kqueue = select.kqueue()
216
- for fd in self._readables:
217
- self.register_readable(fd)
218
- for fd in self._writables:
219
- self.register_writable(fd)
220
-
221
- def close(self) -> None:
222
- self._kqueue.close() # type: ignore
223
- self._kqueue = None
227
+ else:
228
+ KqueuePoller = None
224
229
 
225
230
 
226
231
  Poller: ta.Type[BasePoller]
227
- if hasattr(select, 'kqueue'):
232
+ if (
233
+ sys.platform == 'darwin' or sys.platform.startswith('freebsd') and
234
+ hasattr(select, 'kqueue') and KqueuePoller is not None
235
+ ):
228
236
  Poller = KqueuePoller
229
237
  elif hasattr(select, 'poll'):
230
238
  Poller = PollPoller
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ominfra
3
- Version: 0.0.0.dev79
3
+ Version: 0.0.0.dev80
4
4
  Summary: ominfra
5
5
  Author: wrmsr
6
6
  License: BSD-3-Clause
@@ -12,8 +12,8 @@ Classifier: Operating System :: OS Independent
12
12
  Classifier: Operating System :: POSIX
13
13
  Requires-Python: ~=3.12
14
14
  License-File: LICENSE
15
- Requires-Dist: omdev ==0.0.0.dev79
16
- Requires-Dist: omlish ==0.0.0.dev79
15
+ Requires-Dist: omdev ==0.0.0.dev80
16
+ Requires-Dist: omlish ==0.0.0.dev80
17
17
  Provides-Extra: all
18
18
  Requires-Dist: paramiko ~=3.5 ; extra == 'all'
19
19
  Requires-Dist: asyncssh ~=2.17 ; (python_version < "3.13") and extra == 'all'
@@ -47,7 +47,7 @@ ominfra/pyremote/_runcommands.py,sha256=2UVHaUJjmWP8jMZE79j2Qk1E5IOyVV1qNSUbdr-z
47
47
  ominfra/pyremote/bootstrap.py,sha256=RvMO3YGaN1E4sgUi1JEtiPak8cjvqtc_vRCq1yqbeZg,3370
48
48
  ominfra/pyremote/runcommands.py,sha256=bviS0_TDIoZVAe4h-_iavbvJtVSFu8lnk7fQ5iasCWE,1571
49
49
  ominfra/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
- ominfra/scripts/supervisor.py,sha256=eVD0NeSsnv-ckzb3c-EgzDRq7Kyr2dpvpPquW3Y690w,105707
50
+ ominfra/scripts/supervisor.py,sha256=EU989AXWM-QJF4BmvKSlxkkBvRR3n2rz6yeXhjzo100,106149
51
51
  ominfra/supervisor/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
52
52
  ominfra/supervisor/__main__.py,sha256=usW9jjq5JPe_2SL8H5PrjDdksO75MX85Ir0HFfb35eM,72
53
53
  ominfra/supervisor/compat.py,sha256=sqsvlCNF2iMFdrc0LuTfyCBxXSVACtQx2wCfeHwWvAQ,5044
@@ -57,7 +57,7 @@ ominfra/supervisor/datatypes.py,sha256=cq2p7wnLN0nvKT-jZxaBByqsnCIUz6pX9dPtm69h1
57
57
  ominfra/supervisor/dispatchers.py,sha256=4AVtJagOEalRnxwCZjNr8LpkCkykzzg2ncMZiYsC4Bc,10367
58
58
  ominfra/supervisor/events.py,sha256=wT-gPfvv2HCAyQXMq3jiek17Jq6kAZb0U2hekzjf3ks,7743
59
59
  ominfra/supervisor/exceptions.py,sha256=jq8Md--zmAHri1BB2XeDPFcTur81IRwArOcZoP7-6W0,746
60
- ominfra/supervisor/poller.py,sha256=oqNEA7i2XXtERBv552sr29a6mlogmosWjeGOZSul5Kg,7273
60
+ ominfra/supervisor/poller.py,sha256=RwVnjEl63-mNQUsJcVEEsFrwuh5aOKr9e-rrB2lWCgs,7726
61
61
  ominfra/supervisor/process.py,sha256=phucIv2a-LHXypY3kJ9fCsKEki9G9XdiJtXCVMgGcZI,31291
62
62
  ominfra/supervisor/states.py,sha256=JMxXYTZhJkMNQZ2tTV6wId7wrvnWgiZteskACprKskM,1374
63
63
  ominfra/supervisor/supervisor.py,sha256=GnG8SAhJ5UUay7cM3oBJYb4TmIUaQUdWWqnhANpalPw,13811
@@ -66,9 +66,9 @@ ominfra/tailscale/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
66
66
  ominfra/tailscale/cli.py,sha256=Ltg6RVFsMLLPjLzoGwM6sxjmwjEVEYHAdrqmCc4N1HM,3174
67
67
  ominfra/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
68
68
  ominfra/tools/listresources.py,sha256=L4t5rszm9ulcdWyr7n48_R9d5Etg4S2a4WQhlbHDtnQ,6106
69
- ominfra-0.0.0.dev79.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
70
- ominfra-0.0.0.dev79.dist-info/METADATA,sha256=qHE4z-IH2J8uJL_TOTh54TNP6YYBUHZKzbci30YOnb8,799
71
- ominfra-0.0.0.dev79.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
72
- ominfra-0.0.0.dev79.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
73
- ominfra-0.0.0.dev79.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
74
- ominfra-0.0.0.dev79.dist-info/RECORD,,
69
+ ominfra-0.0.0.dev80.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
70
+ ominfra-0.0.0.dev80.dist-info/METADATA,sha256=IXqQETkknBLUm_itqwrjNtBd6raZKEi1PE7dmfLwHes,799
71
+ ominfra-0.0.0.dev80.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
72
+ ominfra-0.0.0.dev80.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
73
+ ominfra-0.0.0.dev80.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
74
+ ominfra-0.0.0.dev80.dist-info/RECORD,,