|
| 1 | +# Copyright 1999-2024 Gentoo Authors |
| 2 | +# Distributed under the terms of the GNU General Public License v2 |
| 3 | + |
| 4 | +EAPI=8 |
| 5 | + |
| 6 | +DISTUTILS_EXT=1 |
| 7 | +DISTUTILS_USE_PEP517=setuptools |
| 8 | +PYTHON_COMPAT=( python3_{10..12} ) |
| 9 | + |
| 10 | +inherit distutils-r1 pypi |
| 11 | + |
| 12 | +DESCRIPTION="Ultra-fast implementation of asyncio event loop on top of libuv" |
| 13 | +HOMEPAGE=" |
| 14 | + https://github.com/magicstack/uvloop/ |
| 15 | + https://pypi.org/project/uvloop/ |
| 16 | +" |
| 17 | +SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${PN}-0.19.0-cython3.patch.xz" |
| 18 | + |
| 19 | +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 -riscv ~sparc ~x86" |
| 20 | +LICENSE="MIT" |
| 21 | +SLOT="0" |
| 22 | +IUSE="examples" |
| 23 | + |
| 24 | +DEPEND=" |
| 25 | + >=dev-libs/libuv-1.11.0:= |
| 26 | +" |
| 27 | +RDEPEND=" |
| 28 | + ${DEPEND} |
| 29 | +" |
| 30 | +BDEPEND=" |
| 31 | + >=dev-python/cython-0.29.36[${PYTHON_USEDEP}] |
| 32 | + test? ( |
| 33 | + dev-python/aiohttp[${PYTHON_USEDEP}] |
| 34 | + >=dev-python/pyopenssl-22.0.0[${PYTHON_USEDEP}] |
| 35 | + dev-python/psutil[${PYTHON_USEDEP}] |
| 36 | + ) |
| 37 | +" |
| 38 | + |
| 39 | +PATCHES=( |
| 40 | + "${WORKDIR}"/${PN}-0.19.0-cython3.patch |
| 41 | +) |
| 42 | + |
| 43 | +distutils_enable_tests pytest |
| 44 | + |
| 45 | +python_prepare_all() { |
| 46 | + rm -r vendor || die |
| 47 | + cat <<-EOF >> setup.cfg || die |
| 48 | + [build_ext] |
| 49 | + use_system_libuv=True |
| 50 | + cython_always=True |
| 51 | + EOF |
| 52 | + |
| 53 | + # force cythonization |
| 54 | + rm uvloop/loop.c || die |
| 55 | + |
| 56 | + distutils-r1_python_prepare_all |
| 57 | +} |
| 58 | + |
| 59 | +python_test() { |
| 60 | + local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 |
| 61 | + local EPYTEST_IGNORE=( |
| 62 | + # linting |
| 63 | + tests/test_sourcecode.py |
| 64 | + ) |
| 65 | + local EPYTEST_DESELECT=( |
| 66 | + # TODO: expects some... cython_helper? |
| 67 | + tests/test_libuv_api.py::Test_UV_libuv::test_libuv_get_loop_t_ptr |
| 68 | + # unhappy about sandbox injecting its envvars |
| 69 | + tests/test_process.py::Test_UV_Process::test_process_env_2 |
| 70 | + tests/test_process.py::Test_AIO_Process::test_process_env_2 |
| 71 | + # hangs |
| 72 | + tests/test_tcp.py::Test_AIO_TCPSSL::test_remote_shutdown_receives_trailing_data |
| 73 | + # crashes on assertion |
| 74 | + # https://github.com/MagicStack/uvloop/issues/574 |
| 75 | + tests/test_cython.py::TestCythonIntegration::test_cython_coro_is_coroutine |
| 76 | + ) |
| 77 | + |
| 78 | + rm -rf uvloop || die |
| 79 | + epytest -s |
| 80 | +} |
| 81 | + |
| 82 | +python_install_all() { |
| 83 | + use examples && dodoc -r examples |
| 84 | + distutils-r1_python_install_all |
| 85 | +} |
0 commit comments