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
Configuration error:
There is a programmable error in your configuration file:
Traceback (most recent call last):
File "/builddir/build/BUILD/pikepdf-2.16.1/pyproject-wheeldir/pikepdf-2.16.1-cp310-cp310-linux_x86_64.whl/pikepdf/__init__.py",
line 13, in <module>
from . import _qpdf
ImportError: cannot import name '_qpdf' from partially initialized
module 'pikepdf' (most likely due to a circular import)
(/builddir/build/BUILD/pikepdf-2.16.1/pyproject-wheeldir/pikepdf-2.16.1-cp310-cp310-linux_x86_64.whl/pikepdf/__init__.py)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/sphinx/config.py", line 327,
in eval_config_file
exec(code, namespace)
File "/builddir/build/BUILD/pikepdf-2.16.1/docs/conf.py", line 59, in <module>
import pikepdf # isort:skip pylint: disable=unused-import
File "/builddir/build/BUILD/pikepdf-2.16.1/pyproject-wheeldir/pikepdf-2.16.1-cp310-cp310-linux_x86_64.whl/pikepdf/__init__.py",
line 16, in <module>
raise ImportError(_msg) from _e
ImportError: pikepdf's extension library failed to import
--
Elliott