TL;DR How do you get distutils/setuptools to include a non-pure data file correctly?
I've got a project that does some non-trivial code generation using a custom toolchain, and then wraps that generated code with SWIG, and finally builds Python extensions. Cmake encapsulates all this excellently and in the end I have a single folder in the project's root that works exactly as any other Python package.
I'd like to have a simple setup.py
so I can wrap this package into a wheel and ship it off to PyPI so that normal Python users don't have to deal with the build process. There are plenty of answers on SO for how to force setuptools to generate a non-pure wheel, and then you can bundle the extensions by using the package_data
field or a MANIFEST.in
file.
The problem is this method results in a malformed wheel, because the extensions get included under purelib
instead of the root directory (where they belong in a Root-Is-Pure: False
wheel). Some tools and distros rely on this seperation being correct.
Answers I'm not interested in: Custom extensions to run cmake from within setup.py
(Don't want to add another layer of indirection for configuring the project, don't want to maintain it when build options change), modifying the generated wheel, and I'd prefer to avoid adding any more files to the project root than just setup.py