Bug 298414 - textproc/py-rst2ansi: unbreak py-b2 after py-docutils 0.22.4
Summary: textproc/py-rst2ansi: unbreak py-b2 after py-docutils 0.22.4
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Craig Leres
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-09-11 20:27 UTC by Craig Leres
Modified: 2026-11-13 23:36 UTC (History)
1 user (show)

See Also:
PopularMoment: maintainer-feedback+


Attachments
patch (636 bytes, patch)
2026-09-11 20:29 UTC, Craig Leres
leres: maintainer-approval? (PopularMoment)
Details | Diff
textproc/py-rst2ansi: Fix with docutils 0.22 and Python 3.14 (git format-patch) (5.50 KB, patch)
2026-10-23 19:07 UTC, Patrick Crandol
PopularMoment: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Craig Leres freebsd_committer freebsd_triage 2026-09-11 20:27:43 UTC
I upgraded py-docutils from 0.22.2 to 0.22.4 and py-b2 started giving a traceback. This is a solved issue with py-rst2ansi from last year:

    https://github.com/Snaipe/python-rst2ansi/issues/16

SafeString is documented to have been removed from docutils in 0.22:

    https://www.docutils.org/RELEASE-NOTES.html#release-0-22-2025-07-29

SafeString was not being used by py-rst2ansi, only imported.

Here's a quick patch to comment out the problematic lines.
Comment 1 Craig Leres freebsd_committer freebsd_triage 2026-09-11 20:29:37 UTC
Created attachment 274652 [details]
patch
Comment 2 Patrick Crandol 2026-10-23 19:07:44 UTC
Created attachment 276339 [details]
textproc/py-rst2ansi: Fix with docutils 0.22 and Python 3.14 (git format-patch)

I ran into the same break while working on bug 292105 (Python 3.13 as
the default), so here is a patch that takes the fix from upstream and
also covers a Python 3.14 problem. Either it or attachment 274652 [details] fixes
py-b2; use whichever you prefer.

The patch backports two fixes from upstream master:
- 81758ed drops the unused docutils.utils.error_reporting imports
  (upstream issue #16), the same fix as attachment 274652 [details]
- 3728e16 passes an 8-byte struct winsize to the TIOCGWINSZ ioctl in
  rst2ansi/get_terminal_size.py; Python 3.14 rejects the old 4-byte
  buffer with SystemError (upstream issue #18)

PORTREVISION is bumped.

Misc changes:
- the port switches to USE_PYTHON=pep517 (the package metadata becomes
  dist-info)
- portlint warnings are fixed
- the patches in files/ get a header saying what each one does and its
  upstream status (Description, Issue ID, Changeset, TODO)

Impact: 1 port depends on it, devel/py-b2.

Tested: poudriere bulk on amd64, both with Python 3.12 and with
DEFAULT_VERSIONS+=python=3.13, after the pep517 switch: builds, installs
the package metadata as .dist-info, and the modules import from the
built package (only optional extras are missing).

Upstream: github.com/Snaipe/python-rst2ansi has made no release since
0.1.5 (2016), but both fixes were merged on master on 2026-01-07; this
is a backport.
Comment 3 commit-hook freebsd_committer freebsd_triage 2026-11-13 23:35:56 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5d372232c7ad6f3099783b5d5aade655610fc9c1

commit 5d372232c7ad6f3099783b5d5aade655610fc9c1
Author:     Craig Leres <leres@FreeBSD.org>
AuthorDate: 2026-11-13 23:35:04 +0000
Commit:     Craig Leres <leres@FreeBSD.org>
CommitDate: 2026-11-13 23:35:04 +0000

    textproc/py-rst2ansi: unbreak py-b2 after py-docutils 0.22.4

    The contributed patch includes the change I proposed and also fixes
    a Python 3.14 issue.

        The patch backports two fixes from upstream master:

        - 81758ed drops the unused docutils.utils.error_reporting imports
          (upstream issue #16), the same fix as attachment 274652 [details]

        - 3728e16 passes an 8-byte struct winsize to the TIOCGWINSZ
          ioctl in rst2ansi/get_terminal_size.py; Python 3.14 rejects
          the old 4-byte
          buffer with SystemError (upstream issue #18)

    Also update pkg-descr and switch to pep517.

    PR:             298414
    Approved by:    PopularMoment@protonmail.com (maintainer)
    Obtained from:  Patrick Crandol

 textproc/py-rst2ansi/Makefile                       |  6 ++++--
 .../py-rst2ansi/files/patch-rst2ansi_ansi.py (new)  | 16 ++++++++++++++++
 .../files/patch-rst2ansi_get_terminal_size.py (new) | 21 +++++++++++++++++++++
 .../files/patch-rst2ansi_visitor.py (new)           | 16 ++++++++++++++++
 textproc/py-rst2ansi/pkg-descr                      |  4 ++++
 5 files changed, 61 insertions(+), 2 deletions(-)
Comment 4 Craig Leres freebsd_committer freebsd_triage 2026-11-13 23:36:22 UTC
Thanks for the patch!