Re: Building docs of compiled extensions with new macros

2021-08-19 Thread Elliott Sales de Andrade
On Wed, 18 Aug 2021 at 19:51, Miro Hrončok  wrote:
>
> 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.
>

It is a bit weird, at least by definition of the stages.

> 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}/
>

That also does work, if a bit undocumented.

It seems that pip may be changing to in-tree builds?
https://github.com/pypa/pip/issues/7555
Are we moving towards that as well? It seems like that would make it
simpler to build the docs for cases like this.

> --
> Miro Hrončok
> --
> Phone: +420777974800
> IRC: mhroncok
>


-- 
Elliott
___
python-devel mailing list -- python-devel@lists.fedoraproject.org
To unsubscribe send an email to python-devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure


Re: Building docs of compiled extensions with new macros

2021-08-19 Thread Miro Hrončok

On 19. 08. 21 10:25, Elliott Sales de Andrade wrote:

It seems that pip may be changing to in-tree builds?
https://github.com/pypa/pip/issues/7555
Are we moving towards that as well? It seems like that would make it
simpler to build the docs for cases like this.


Eventually yes.

--
Miro Hrončok
--
Phone: +420777974800
IRC: mhroncok
___
python-devel mailing list -- python-devel@lists.fedoraproject.org
To unsubscribe send an email to python-devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure


Re: Building docs of compiled extensions with new macros

2021-08-19 Thread Benjamin Beasley
I have also resorted to manually installing the wheel to a temporary directory 
in %build, then setting PYTHONPATH to include the temporary directory to build 
the documentation. I don’t like this solution very well either, but it is a 
third alternative that seems to work well. See 
https://src.fedoraproject.org/rpms/python-asyncpg/blob/ca0bedc42ddba790ffda74cbaa48a06daf7d141e/f/python-asyncpg.spec#_103
 for an example.
___
python-devel mailing list -- python-devel@lists.fedoraproject.org
To unsubscribe send an email to python-devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure