wepoll 0.1.5__tar.gz → 0.3.0__tar.gz
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.
- {wepoll-0.1.5 → wepoll-0.3.0}/PKG-INFO +2 -2
- {wepoll-0.1.5 → wepoll-0.3.0}/pyproject.toml +8 -2
- {wepoll-0.1.5 → wepoll-0.3.0}/setup.py +1 -3
- wepoll-0.3.0/tests/test_wepoll_cyares.py +47 -0
- {wepoll-0.1.5 → wepoll-0.3.0}/tests/test_wepoll_eventloop.py +9 -8
- wepoll-0.3.0/tests/test_wepoll_selectors.py +47 -0
- {wepoll-0.1.5 → wepoll-0.3.0}/wepoll/__init__.py +1 -2
- {wepoll-0.1.5 → wepoll-0.3.0}/wepoll/_wepoll.c +2432 -2202
- {wepoll-0.1.5 → wepoll-0.3.0}/wepoll/_wepoll.pxd +3 -3
- {wepoll-0.1.5 → wepoll-0.3.0}/wepoll/_wepoll.pyi +2 -3
- {wepoll-0.1.5 → wepoll-0.3.0}/wepoll/_wepoll.pyx +49 -71
- {wepoll-0.1.5 → wepoll-0.3.0}/wepoll/flags.py +13 -0
- {wepoll-0.1.5 → wepoll-0.3.0}/wepoll/loop.py +1 -0
- {wepoll-0.1.5 → wepoll-0.3.0}/wepoll/msvc_compat.h +8 -0
- {wepoll-0.1.5 → wepoll-0.3.0}/wepoll/selector.py +24 -28
- {wepoll-0.1.5 → wepoll-0.3.0}/wepoll.egg-info/PKG-INFO +2 -2
- wepoll-0.1.5/tests/test_wepoll_cyares.py +0 -44
- wepoll-0.1.5/tests/test_wepoll_selectors.py +0 -25
- {wepoll-0.1.5 → wepoll-0.3.0}/MANIFEST.in +0 -0
- {wepoll-0.1.5 → wepoll-0.3.0}/README.md +0 -0
- {wepoll-0.1.5 → wepoll-0.3.0}/setup.cfg +0 -0
- {wepoll-0.1.5 → wepoll-0.3.0}/vendor/wepoll/wepoll.c +0 -0
- {wepoll-0.1.5 → wepoll-0.3.0}/vendor/wepoll/wepoll.h +0 -0
- {wepoll-0.1.5 → wepoll-0.3.0}/wepoll/__init__.pxd +0 -0
- {wepoll-0.1.5 → wepoll-0.3.0}/wepoll/socket.pxd +0 -0
- {wepoll-0.1.5 → wepoll-0.3.0}/wepoll.egg-info/SOURCES.txt +0 -0
- {wepoll-0.1.5 → wepoll-0.3.0}/wepoll.egg-info/dependency_links.txt +0 -0
- {wepoll-0.1.5 → wepoll-0.3.0}/wepoll.egg-info/not-zip-safe +0 -0
- {wepoll-0.1.5 → wepoll-0.3.0}/wepoll.egg-info/top_level.txt +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: wepoll
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Cython adaptation of the wepoll C Library providing epoll selectors to windows
|
|
5
5
|
Author-email: Vizonex <VizonexBusiness@gmail.com>
|
|
6
|
-
License: MIT
|
|
6
|
+
License-Expression: MIT
|
|
7
7
|
Project-URL: homepage, https://github.com/Vizonex/pywepoll
|
|
8
8
|
Project-URL: repository, https://github.com/Vizonex/pywepoll.git
|
|
9
9
|
Requires-Python: >=3.10
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "wepoll"
|
|
3
3
|
description = "Cython adaptation of the wepoll C Library providing epoll selectors to windows"
|
|
4
|
-
|
|
4
|
+
dynamic = ["version"]
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "Vizonex", email = "VizonexBusiness@gmail.com" }
|
|
7
7
|
]
|
|
8
8
|
readme = "README.md"
|
|
9
|
-
license =
|
|
9
|
+
license = "MIT"
|
|
10
10
|
requires-python = ">=3.10"
|
|
11
11
|
dependencies = []
|
|
12
12
|
|
|
13
13
|
[tool.cibuildwheel]
|
|
14
14
|
build-frontend = "build"
|
|
15
15
|
|
|
16
|
+
[tool.setuptools.dynamic]
|
|
17
|
+
version = {attr = "wepoll.__version__"}
|
|
18
|
+
|
|
19
|
+
|
|
16
20
|
[build-system]
|
|
17
21
|
requires = ["setuptools", "cython", "wheel"]
|
|
22
|
+
build-backend = "setuptools.build_meta"
|
|
23
|
+
|
|
18
24
|
|
|
19
25
|
[tool.setuptools]
|
|
20
26
|
zip-safe = false
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
from Cython.Build import cythonize
|
|
2
2
|
from setuptools import Extension, setup
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
# TODO: Move to pyproject.toml setup like in pyduktape3 in 0.1.6
|
|
4
|
+
# TODO: Move to pyproject.toml setup like in pyduktape3 somewhere around 0.3.0
|
|
6
5
|
setup(
|
|
7
6
|
ext_modules=cythonize(
|
|
8
7
|
[
|
|
@@ -15,4 +14,3 @@ setup(
|
|
|
15
14
|
]
|
|
16
15
|
)
|
|
17
16
|
)
|
|
18
|
-
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from wepoll import epoll, EPOLLIN, EPOLLOUT
|
|
2
|
+
import pytest
|
|
3
|
+
|
|
4
|
+
cyares = pytest.importorskip("cyares")
|
|
5
|
+
if cyares is not None:
|
|
6
|
+
from cyares import Channel
|
|
7
|
+
|
|
8
|
+
# based off pycares's testsuite
|
|
9
|
+
|
|
10
|
+
READ = EPOLLIN
|
|
11
|
+
WRITE = EPOLLOUT
|
|
12
|
+
|
|
13
|
+
class TestCyaresWepoll:
|
|
14
|
+
channel: "Channel"
|
|
15
|
+
|
|
16
|
+
def wait(self):
|
|
17
|
+
# The function were really testing is this wait function
|
|
18
|
+
|
|
19
|
+
while self.channel.running_queries:
|
|
20
|
+
timeout = self.channel.timeout()
|
|
21
|
+
if timeout == 0.0:
|
|
22
|
+
self.channel.process_no_fds()
|
|
23
|
+
continue
|
|
24
|
+
for fd, event in self.poll.poll(timeout):
|
|
25
|
+
if event & ~EPOLLIN:
|
|
26
|
+
self.channel.process_write_fd(fd)
|
|
27
|
+
if event & ~EPOLLOUT:
|
|
28
|
+
self.channel.process_read_fd(fd)
|
|
29
|
+
|
|
30
|
+
def socket_state_cb(self, fd: int, r:bool, w: bool):
|
|
31
|
+
flags = 0
|
|
32
|
+
if r:
|
|
33
|
+
flags |= READ
|
|
34
|
+
if w:
|
|
35
|
+
flags |= WRITE
|
|
36
|
+
|
|
37
|
+
if flags:
|
|
38
|
+
self.poll.register(fd, flags)
|
|
39
|
+
else:
|
|
40
|
+
self.poll.unregister(fd)
|
|
41
|
+
|
|
42
|
+
def test_resolve(self):
|
|
43
|
+
self.poll = epoll()
|
|
44
|
+
self.channel = Channel(event_thread=False, servers=["8.8.8.8", "8.8.4.4"], sock_state_cb=self.socket_state_cb)
|
|
45
|
+
fut = self.channel.query("python.org", "A")
|
|
46
|
+
self.wait()
|
|
47
|
+
assert fut.result()
|
|
@@ -2,18 +2,19 @@ from wepoll import WepollEventLoop
|
|
|
2
2
|
from cyares.aio import DNSResolver
|
|
3
3
|
import pytest
|
|
4
4
|
|
|
5
|
-
import anyio
|
|
6
|
-
|
|
7
|
-
|
|
8
5
|
@pytest.fixture(
|
|
9
|
-
params=[
|
|
6
|
+
params=[
|
|
7
|
+
pytest.param(
|
|
8
|
+
("asyncio", {"loop_factory": WepollEventLoop}),
|
|
9
|
+
id="asyncio[WepollEventLoop]",
|
|
10
|
+
)
|
|
11
|
+
]
|
|
10
12
|
)
|
|
11
13
|
def anyio_backend(request: pytest.FixtureRequest):
|
|
12
14
|
return request.param
|
|
13
15
|
|
|
16
|
+
|
|
14
17
|
@pytest.mark.anyio
|
|
15
|
-
async def test_dns_resolver_over_wepoll(
|
|
18
|
+
async def test_dns_resolver_over_wepoll() -> None:
|
|
16
19
|
async with DNSResolver(["8.8.8.8", "8.8.4.4"], event_thread=False) as dns:
|
|
17
|
-
assert await dns.query("google.com", "A")
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
assert await dns.query("google.com", "A")
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import selectors
|
|
2
|
+
import tempfile
|
|
3
|
+
import unittest
|
|
4
|
+
from test.test_selectors import ScalableSelectorMixIn, BaseSelectorTestCase
|
|
5
|
+
from wepoll import EpollSelector
|
|
6
|
+
|
|
7
|
+
# Code is borrowed from python's testsuite to ensure wepoll matches up with unix epolls
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class EpollSelectorTestCase(
|
|
11
|
+
BaseSelectorTestCase, ScalableSelectorMixIn, unittest.TestCase
|
|
12
|
+
):
|
|
13
|
+
SELECTOR = EpollSelector
|
|
14
|
+
|
|
15
|
+
def test_modify_unregister(self):
|
|
16
|
+
if self.SELECTOR.__name__ == "EpollSelector":
|
|
17
|
+
patch = unittest.mock.patch("wepoll.EpollSelector._selector_cls")
|
|
18
|
+
else:
|
|
19
|
+
raise self.skipTest("")
|
|
20
|
+
|
|
21
|
+
with patch as m:
|
|
22
|
+
m.return_value.modify = unittest.mock.Mock(side_effect=ZeroDivisionError)
|
|
23
|
+
s = self.SELECTOR()
|
|
24
|
+
self.addCleanup(s.close)
|
|
25
|
+
rd, wr = self.make_socketpair()
|
|
26
|
+
s.register(rd, selectors.EVENT_READ)
|
|
27
|
+
self.assertEqual(len(s._map), 1)
|
|
28
|
+
with self.assertRaises(ZeroDivisionError):
|
|
29
|
+
s.modify(rd, selectors.EVENT_WRITE)
|
|
30
|
+
self.assertEqual(len(s._map), 0)
|
|
31
|
+
|
|
32
|
+
def test_register_file(self):
|
|
33
|
+
# epoll(7) returns EPERM when given a file to watch
|
|
34
|
+
s = self.SELECTOR()
|
|
35
|
+
with tempfile.NamedTemporaryFile() as f:
|
|
36
|
+
with self.assertRaises(IOError):
|
|
37
|
+
s.register(f, selectors.EVENT_READ)
|
|
38
|
+
# the SelectorKey has been removed
|
|
39
|
+
with self.assertRaises(KeyError):
|
|
40
|
+
s.get_key(f)
|
|
41
|
+
|
|
42
|
+
def test_empty_select(self):
|
|
43
|
+
# Issue #23009: Make sure EpollSelector.select() works when no FD is
|
|
44
|
+
# registered.
|
|
45
|
+
s = self.SELECTOR()
|
|
46
|
+
self.addCleanup(s.close)
|
|
47
|
+
self.assertEqual(s.select(timeout=0), [])
|
|
@@ -15,7 +15,7 @@ from .loop import WepollEventLoop
|
|
|
15
15
|
from .selector import EpollSelector
|
|
16
16
|
|
|
17
17
|
__author__ = "Vizonex"
|
|
18
|
-
__version__ = "0.
|
|
18
|
+
__version__ = "0.3.0"
|
|
19
19
|
__all__ = (
|
|
20
20
|
"EPOLLERR",
|
|
21
21
|
"EPOLLHUP",
|
|
@@ -33,4 +33,3 @@ __all__ = (
|
|
|
33
33
|
"__version__",
|
|
34
34
|
"epoll",
|
|
35
35
|
)
|
|
36
|
-
|