[binutils-gdb] [pre-commit] add 'tomli' dependency for codespell pre-commit hook

Tom de Vries via Binutils-cvs <[email protected]> Tue, 28 Jul 2026 08:01:18 +0000 (GMT)
Newsgroups gmane.comp.gnu.binutils.cvs
Message-ID <20260728080118.5B7F54B9DB5A__39892.2886628256$1785225688$gmane$org@sourceware.org>
https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dcd02e2a20948=
2dd9fa06945ffec0675da7dfd74e

commit cd02e2a209482dd9fa06945ffec0675da7dfd74e
Author: Rohr, Stephan <[email protected]>
Date:   Tue Jul 28 10:01:13 2026 +0200

    [pre-commit] add 'tomli' dependency for codespell pre-commit hook
   =20
    The codespell pre-commit hook imports the 'tomllib' module to parse
    'pyproject.toml'.  'tomllib' is not available for Python versions 3.10
    and older.  Add a dependency on 'tomli' so the hook also works on these
    Python versions.
   =20
    Approved-By: Tom de Vries <[email protected]>

Diff:
---
 .pre-commit-config.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 66cbc117dfc..8ff84dae274 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -86,10 +86,13 @@ repos:
       - id: codespell
         args: &codespell_args [--toml, gdb/pyproject.toml]
         files: &gdb_files '^(gdb|gdbserver|gdbsupport)/'
+        # 'tomllib' library is not available on Python < 3.11.
+        additional_dependencies: &codespell_deps ['tomli']
       - id: codespell
         name: codespell-log
         entry: gdb/contrib/codespell-log.sh
         args: *codespell_args
+        additional_dependencies: *codespell_deps
         verbose: true
         stages: [commit-msg]