Enforce the extension module in setup.py

Without this change, [cibuildwheel](https://github.com/pypa/cibuildwheel) cannot build a correct wheel from the generated project. The problem is that the native lib is added by `MANIFEST.in` and `python3 -m pip wheel` ignores it and thinks that the package is pure Python. Thefore it builds a pure wheel and the packaging pipeline crashes.
This commit is contained in:
Vadim Markovtsev 2023-04-14 17:01:06 +02:00 committed by GitHub
parent 5271841b4c
commit d314ab95bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -19,6 +19,12 @@ const (
with open("README.md", "r") as fh: with open("README.md", "r") as fh:
long_description = fh.read() long_description = fh.read()
class BinaryDistribution(setuptools.Distribution):
def has_ext_modules(_):
return True
setuptools.setup( setuptools.setup(
name="%[1]s%[2]s", name="%[1]s%[2]s",
version="%[3]s", version="%[3]s",
@ -35,6 +41,7 @@ setuptools.setup(
"Operating System :: OS Independent", "Operating System :: OS Independent",
], ],
include_package_data=True, include_package_data=True,
distclass=BinaryDistribution,
) )
` `