From 841b1ebfc4037069668abb8630532245f81d5770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Karada=C5=9F?= <54038084+deniskrds@users.noreply.github.com> Date: Wed, 27 Aug 2025 00:56:15 +0300 Subject: [PATCH] fix(build): require Cython >=3.0 for Python 3.10+ to fix wheel build Python 3.10+ removed `longintrepr.h` (PEP 620), causing wheel build failures for `btdht`. This change adds a Python version-based dependency on Cython >=3.0 to restore compatibility while preserving support for older Python versions. --- setup.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/setup.py b/setup.py index 3e5d542..983db46 100755 --- a/setup.py +++ b/setup.py @@ -3,6 +3,7 @@ from setuptools import setup from setuptools import Extension import distutils.command.clean + try: from Cython.Build import cythonize has_cython = True @@ -21,6 +22,13 @@ with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme: README = readme.read() + setup_requires = [] + import sys + if sys.version_info > (3, 10): + setup_requires.append("cython>=3.0") + else: + setup_requires.append("cython>=0.29,<3.0") + setup( name="btdht", version=VERSION, @@ -45,6 +53,7 @@ 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Communications :: File Sharing' ], + setup_requires=setup_requires, install_requires=["datrie >= 0.7", "netaddr >= 0.7.12", "six >= 1.8"], url='https://github.com/nitmir/btdht/', download_url="https://github.com/nitmir/btdht/releases/latest",