]> git.ipfire.org Git - thirdparty/git.git/commit
ci/test-documentation: work around SyntaxWarning in Python 3.12
authorPatrick Steinhardt <ps@pks.im>
Thu, 6 Jun 2024 08:01:14 +0000 (10:01 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 6 Jun 2024 15:20:51 +0000 (08:20 -0700)
commitf60fec6a1665891e50b94ff553b4165fe8ab3f2d
tree7f821dfdbc94fe745bdc03efd43cd9d3ac235731
parent401151de9e58f5da7dd6c3d6ce1ffba94c0ed740
ci/test-documentation: work around SyntaxWarning in Python 3.12

In Python 3.6, unrecognized escape sequences in regular expressions
started to produce a DeprecationWarning [1]. In Python 3.12, this was
upgraded to a SyntaxWarning and will eventually be raised even further
to a SyntaxError. We indirectly hit such unrecognized escape sequences
via Asciidoc, which results in a bunch of warnings:

    $ asciidoc -o /dev/null git-cat-file.txt
    <unknown>:1: SyntaxWarning: invalid escape sequence '\S'
    <unknown>:1: SyntaxWarning: invalid escape sequence '\S'

This in turn causes our "ci/test-documentation.sh" script to fail, as it
checks that stderr of `make doc` is empty.

These escape sequences seem to be part of Asciidoc itself. In the long
term, we should probably consider dropping support for Asciidoc in favor
of Asciidoctor. Upstream also considers itself to be legacy software and
recommends to move away from it [2]:

    It is suggested that unless you specifically require the AsciiDoc.py
    toolchain, you should find a processor that handles the modern
    AsciiDoc syntax.

For now though, let's expand its lifetime a little bit more by filtering
out these new warnings. We should probably reconsider once the warnings
are upgraded to errors by Python.

[1]: https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals
[2]: https://github.com/asciidoc-py/asciidoc-py/blob/6d9f76cff0dc3b7ca21bdd570200f8518464d99b/README.md#asciidocpy

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
ci/test-documentation.sh