Bug 282435

Summary: textproc/py-wtforms: Build broken
Product: Ports & Packages Reporter: Romain Tartière <romain>
Component: Individual Port(s)Assignee: Ruslan Makhmatkhanov <rm>
Status: Closed Overcome By Events    
Severity: Affects Only Me CC: agh, dbaio
Priority: --- Flags: bugzilla: maintainer-feedback? (rm)
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on: 282458    
Bug Blocks:    

Description Romain Tartière freebsd_committer freebsd_triage 2024-10-30 23:05:42 UTC
Hey,

Trying to build some ports, I got hit by textproc/py-wtforms not building in poudriere:

--------------------------- 8< ---------------------------
===>  Building for py311-wtforms-3.1.2_1
* Getting build dependencies for wheel...
* Building wheel...
Successfully built wtforms-3.1.2-py3-none-any.whl
(cd /wrkdirs/usr/ports/textproc/py-wtforms/work-py311/wtforms-3.1.2/docs &&  pip-3.11 install --ignore-installed --isolated  --no-deps --root=/wrkdirs/usr/ports/textproc/py-wtforms/work-py311/wtforms-3.1.2 /wrkdirs/usr/ports/textproc/py-wtforms/work-py311/wtforms-3.1.2/dist/*.whl &&  /usr/bin/env PYTHONPATH=":/wrkdirs/usr/ports/textproc/py-wtforms/work-py311/wtforms-3.1.2/usr/local/lib/python3.11/site-packages" sphinx-build-3.11  -M man . _build/man)
Processing /wrkdirs/usr/ports/textproc/py-wtforms/work-py311/wtforms-3.1.2/dist/wtforms-3.1.2-py3-none-any.whl
Installing collected packages: wtforms
Successfully installed wtforms-3.1.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Running Sphinx v5.3.0

Extension error:
Could not import extension notfound.extension (exception: No module named 'notfound')
*** Error code 2

Stop.
make: stopped in /usr/ports/textproc/py-wtforms
=>> Cleaning up wrkdir
===>  Cleaning for py311-wtforms-3.1.2_1
build of textproc/py-wtforms@py311 | py311-wtforms-3.1.2_1 ended at Wed Oct 30 09:46:41 -10 2024
build time: 00:00:35
!!! build failure encountered !!!
--------------------------- 8< ---------------------------

There seems to be similar failures on pkg-fallout:

https://portsfallout.com/port/24435/


I tried to see what broke and how to fix this, but without success, so I am filling-in this PR to share my findings, track progress an propose a workaround for people hitting this.

The failing command is this pipeline:

--------------------------- 8< ---------------------------
(cd /wrkdirs/usr/ports/textproc/py-wtforms/work-py311/wtforms-3.1.2/docs &&  pip-3.11 install --ignore-installed --isolated  --no-deps --root=/wrkdirs/usr/ports/textproc/py-wtforms/work-py311/wtforms-3.1.2 /wrkdirs/usr/ports/textproc/py-wtforms/work-py311/wtforms-3.1.2/dist/*.whl &&  /usr/bin/env PYTHONPATH=":/wrkdirs/usr/ports/textproc/py-wtforms/work-py311/wtforms-3.1.2/usr/local/lib/python3.11/site-packages" sphinx-build-3.11  -M man . _build/man)
--------------------------- 8< ---------------------------

and more precisely the last command of the pipeline:

--------------------------- 8< ---------------------------
/usr/bin/env PYTHONPATH=":/wrkdirs/usr/ports/textproc/py-wtforms/work-py311/wtforms-3.1.2/usr/local/lib/python3.11/site-packages" sphinx-build-3.11  -M man . _build/man
--------------------------- 8< ---------------------------

This is the part of the Makefile that build docs / man pages (two build/post-build targets in the Makefile, one of them being dependent on the DOCS option being set).

I don't see recent changes in the port itself, and did not find something relevant in the sphinx dependency, but all this python stuff is quite alien for me and I may have missed something :-).

To workaround the issue, I removed these "do-build" / "post-build" targets and adjusted "PLIST_FILES" accordingly.  This allows to build a package without docs/man pages which is fine for my use case to test updates to my ports that depend on this one, but does not feel suitable for inclusion in the ports tree, even as a workaround.  For this reason, I am not providing a patch.

Thank you for your help fixing the root cause of this issue!
Comment 1 Alastair Hogge 2024-10-31 06:12:44 UTC
Hello,

I currently am not able to investigate, however, the documentation additions were the result of my efforts, bug #275931, according to this bug report, I only tested with Python-3.9.

From memory, to enable the man page, and HTML, I had to install WTForms in a private name space '--root=${INSTALL_WRKSRC}', then call Sphinx with the environment ${_DOCS_BUILD_ENV} to locate this private install of WTForms. This was my attempt to remove, and resolve the cyclic dependency many Python packages have on their documentation.

I am not a fan of Python, and most of it makes my head swell. Looking thru https://pip.pypa.io/en/stable/cli/pip_install/ is, I think where I grabbed the options to pass to pip, to install the Port's build of WTForms, which is located in '${WRKSRC}/dist/*.whl' to ${INSTALL_WRKSRC}. If I can get to this on time, I would be looking at Sphinx, because I think that is where the error is, and also updating WTForms, probably updating first. Regarding Sphinx, I would be adding '--verbose', '-vvv' (https://www.sphinx-doc.org/en/master/man/sphinx-build.html) in attempt to get more information from the failure.

There are two bug reports (bug #268018, and bug #282039) open for updating Sphinx, and one review (review D46388). Sphinx is way outdated, and an update is required for other Ports, and Ports I have worked on that do not yet exist in the tree.

It would be a shame to lose documentation, I hope to have time on the weekend to see if my new hardware can help me restore my NAS/build machine, then I would be able to investigate this.
Comment 2 Alastair Hogge 2024-10-31 07:26:47 UTC
According to https://github.com/pallets-eco/wtforms/blob/main/docs/requirements.txt, WTForms will require Sphinx-7 when updated.
Comment 3 Alastair Hogge 2024-10-31 08:39:39 UTC
The same error message is found here:
https://bugs.gentoo.org/691578, however, that Gentoo bug is from 2019.

The Port may require a Sphinx extension, sphinx-notfound-page (https://github.com/readthedocs/sphinx-notfound-page), tho I wonder why it is not listed as a dependency. I am not able to search the Github source code page for WTForms because I have no account, and Gitshit keeps informing me "You have exceeded a secondary rate limit."
Comment 4 Danilo G. Baio freebsd_committer freebsd_triage 2024-11-01 00:35:10 UTC
Hi.

This is an issue introduced in textproc/py-pallets-sphinx-themes 2.2.0. It now requires sphinx-notfound-page.
Comment 5 Ruslan Makhmatkhanov freebsd_committer freebsd_triage 2024-11-15 23:10:26 UTC
Since it wasn't problem in wtforms itself, but in sphinx instead, and since it affected many ports, I preferred to wait for quick resolution of sphinx issue. It's now safe to close.