On 18. 08. 21 11:09, Elliott Sales de Andrade wrote:
I've been experimenting with the new macros for Python packages, and ran into some issues building Sphinx docs for compiled extensions.
When building docs, one usually has to be able to import the project. When the project uses compiled extensions, it is not sufficient to point to the original unpacked sources, but instead must point to the built ones. However, since the new %pyprojec_wheel creates a wheel, I don't know how to do this properly.
Setting e.g., PYTHONPATH=/path/to/*.whl doesn't seem to work (it seems to load everything else but the shared library):
- pushd docs
~/build/BUILD/pikepdf-2.16.1/docs ~/build/BUILD/pikepdf-2.16.1 ++ ls /builddir/build/BUILD/pikepdf-2.16.1/docs/../pyproject-wheeldir/pikepdf-2.16.1-cp310-cp310-linux_x86_64.whl
- PYTHONPATH=/builddir/build/BUILD/pikepdf-2.16.1/docs/../pyproject-wheeldir/pikepdf-2.16.1-cp310-cp310-linux_x86_64.whl
- sphinx-build-3 . ../html
Running Sphinx v4.1.2
... ImportError: pikepdf's extension library failed to import
I've run into this in the past as well. I am not yet sure if putting a whl file with extension modules on PYTHONPATH should work or not, but it doesn't.
You should be able to build the docs in %install, after installing the wheel by putting %{buildroot}%{python3_sitearch} to PYTHONPATH. It is a bit weird, but it worked for me in the past.
If that is not desired or working, you can find the built extension in %{_pyproject_builddir}/pip-req-build-*/build/lib.%{python3_platform}-%{python3_version}/