git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 4/4] ci/test-documentation: work around SyntaxWarning in Python 3.12

From
Patrick Steinhardt <ps@pks.im>
Date
Jun 6, 2024, 08:01 UTC
Message-ID
<c13fed9ebf2ff4a68e12661c31ac4be4405028b3.1717660597.git.ps@pks.im>
In-Reply-To
<cover.1717660597.git.ps@pks.im>

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>
---
 ci/test-documentation.sh | 1 +
 1 file changed, 1 insertion(+)
diff --git a/ci/test-documentation.sh b/ci/test-documentation.sh
index de41888430..02b3af3941 100755
--- a/ci/test-documentation.sh
+++ b/ci/test-documentation.sh
@@ -11,6 +11,7 @@ filter_log () {
 	    -e '/^    \* new asciidoc flags$/d' \
 	    -e '/stripped namespace before processing/d' \
 	    -e '/Attributed.*IDs for element/d' \
+	    -e '/SyntaxWarning: invalid escape sequence/d' \
 	    "$1"
 }
 
-- 
2.45.2.409.g7b0defb391.dirty
Previous: Patrick SteinhardtNext: James Liu
Message 17 of 18 in “Documentation: improve linting of manpage existence”
  1. 0/4 Documentation: improve linting of manpage existencePatrick Steinhardt, Jun 5, 2024
  2. 1/4 Makefile: extract script to lint missing/extraneous manpagesPatrick Steinhardt, Jun 5, 2024
  3. Junio C HamanoJun 5, 2024
  4. Patrick SteinhardtJun 5, 2024
  5. James LiuJun 6, 2024
  6. Junio C HamanoJun 6, 2024
  7. 2/4 Documentation/lint-manpages: bubble up errorsPatrick Steinhardt, Jun 5, 2024
  8. Junio C HamanoJun 5, 2024
  9. 3/4 gitlab-ci: add job to run `make check-docs`Patrick Steinhardt, Jun 5, 2024
  10. 4/4 ci/test-documentation: work around SyntaxWarning in Python 3.12Patrick Steinhardt, Jun 5, 2024
  11. Junio C HamanoJun 5, 2024
  12. 0/4 Documentation: improve linting for manpage existencePatrick Steinhardt, Jun 6, 2024
  13. 1/4 Makefile: extract script to lint missing/extraneous manpagesPatrick Steinhardt, Jun 6, 2024
  14. Junio C HamanoJun 7, 2024
  15. 2/4 Documentation/lint-manpages: bubble up errorsPatrick Steinhardt, Jun 6, 2024
  16. 3/4 gitlab-ci: add job to run `make check-docs`Patrick Steinhardt, Jun 6, 2024
  17. 4/4 ci/test-documentation: work around SyntaxWarning in Python 3.12Patrick Steinhardt, Jun 6, 2024
  18. James LiuJun 7, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.