Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 2/7] [pre-commit] Move gdb/contrib/setup.cfg to gdb/pyproject.toml
Date: Tue, 10 Mar 2026 10:18:38 +0100	[thread overview]
Message-ID: <20260310091843.3214063-3-tdevries@suse.de> (raw)
In-Reply-To: <20260310091843.3214063-1-tdevries@suse.de>

The codespell settings are currently in gdb/contrib/setup.cfg.

There's a goal to move settings of Python tools used for gdb to
gdb/pyproject.toml.

Do so, and update the args entries in .pre-commit-config.yaml:
...
- args: [--config, gdb/contrib/setup.cfg]
+ args: [--toml, gdb/pyproject.toml]
...

It's necessary to point codespell as used in pre-commit to the pyproject.toml
file, because:
- pre-commit uses codespell with the repository root as working directory
- codespell currently only supports discovery of configuration files in the
  working directory.  There's an issue open to support hierarchical
  pyproject.toml files [1].

Likewise, it's necessary to point codespell on the CLI to the pyproject.toml
file:
...
$ codespell --toml gdb/pyproject.toml
...

Now that the codespell settings are in gdb/pyproject.toml, codespell will
automatically discover it when running codespell in the gdb directory.
However, that's not useful, because the paths in gdb/pyproject.toml are
relative to the repository root.  Hopefully, that will be fixed once codespell
supports hierarchical toml files.

In the mean time, we could fix this by moving the settings to a pyproject.toml
file in the repository root.  But we have been avoiding this sofar (to keep
project-related things out of the repository root as much as possible), so we
continue having this pre-existing issue.

[1] https://github.com/codespell-project/codespell/issues/3737
---
 .pre-commit-config.yaml |  4 ++--
 gdb/contrib/setup.cfg   | 13 -------------
 gdb/pyproject.toml      | 14 ++++++++++++++
 pyproject.toml          |  0
 4 files changed, 16 insertions(+), 15 deletions(-)
 delete mode 100644 gdb/contrib/setup.cfg
 create mode 100644 pyproject.toml

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index dec172379e9..679d089aa94 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -72,11 +72,11 @@ repos:
     hooks:
     - id: codespell
       files: '^(gdbsupport|gdbserver|gdb/(dwarf2|tui|target|data-directory|po|system-gdbinit|mi|syscalls|arch|regformats|compile|python|guile|config|unittests|cli|testsuite/gdb.(ctf|dap|debuginfod|gdb|go|guile|mi|modula2|objc|opencl|opt|pascal|perf|replay|reverse|rocm|server|stabs|testsuite|tui|xml)))/'
-      args: [--config, gdb/contrib/setup.cfg]
+      args: [--toml, gdb/pyproject.toml]
     - id: codespell
       name: codespell-log
       entry: gdb/contrib/codespell-log.sh
-      args: [--config, gdb/contrib/setup.cfg]
+      args: [--toml, gdb/pyproject.toml]
       always_run: true
       verbose: true
       stages: [commit-msg]
diff --git a/gdb/contrib/setup.cfg b/gdb/contrib/setup.cfg
deleted file mode 100644
index 654eca6b768..00000000000
--- a/gdb/contrib/setup.cfg
+++ /dev/null
@@ -1,13 +0,0 @@
-[codespell]
-
-# Skip ChangeLogs and generated files.
-skip = */ChangeLog*,*/configure,gdbsupport/Makefile.in,*.dat,*.eps,gdb/features/*.c,gdb/ada-casefold.h,gdb/copying.c,gdb/gdbarch-gen.h,gdb/gdbarch-gen.c,gdb/target-delegates-gen.c
-
-ignore-words = gdb/contrib/codespell-ignore-words.txt
-dictionary = gdb/contrib/codespell-dictionary.txt,-
-
-# Ignore all URLs.
-uri-ignore-words-list = *
-
-# How to ignore blocks of code.
-ignore-multiline-regex = codespell:ignore-begin.*?codespell:ignore-end
diff --git a/gdb/pyproject.toml b/gdb/pyproject.toml
index 2dc00f4abb2..2b66f47b5a0 100644
--- a/gdb/pyproject.toml
+++ b/gdb/pyproject.toml
@@ -38,3 +38,17 @@ indent-namespace-eval = true
 
 # Used by tclfmt.
 spaces-in-braces = false
+
+[tool.codespell]
+
+# Skip ChangeLogs and generated files.
+skip = '*/ChangeLog*,*/configure,gdbsupport/Makefile.in,*.dat,*.eps,gdb/features/*.c,gdb/ada-casefold.h,gdb/copying.c,gdb/gdbarch-gen.h,gdb/gdbarch-gen.c,gdb/target-delegates-gen.c'
+
+ignore-words = 'gdb/contrib/codespell-ignore-words.txt'
+dictionary = 'gdb/contrib/codespell-dictionary.txt,-'
+
+# Ignore all URLs.
+uri-ignore-words-list = '*'
+
+# How to ignore blocks of code.
+ignore-multiline-regex = 'codespell:ignore-begin.*?codespell:ignore-end'
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 00000000000..e69de29bb2d
-- 
2.51.0


  parent reply	other threads:[~2026-03-10  9:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10  9:18 [PATCH 0/7] [pre-commit] Some codespell fixes Tom de Vries
2026-03-10  9:18 ` [PATCH 1/7] [pre-commit] Make codespell:ignore-begin/end non-greedy Tom de Vries
2026-03-10  9:18 ` Tom de Vries [this message]
2026-03-10  9:18 ` [PATCH 3/7] [pre-commit] Make gdb/contrib codespell-clean Tom de Vries
2026-03-10  9:18 ` [PATCH 4/7] [pre-commit] Make gdb/nat codespell-clean Tom de Vries
2026-03-10  9:18 ` [PATCH 5/7] [pre-commit] Make gdb/features codespell-clean Tom de Vries
2026-03-10  9:18 ` [PATCH 6/7] [pre-commit] Make gdb/stubs codespell-clean Tom de Vries
2026-03-10  9:18 ` [PATCH 7/7] [pre-commit] Make gdb/doc codespell-clean Tom de Vries
2026-03-24 15:37 ` [PING][PATCH 0/7] [pre-commit] Some codespell fixes Tom de Vries
2026-04-10 12:38 ` Tom de Vries
2026-04-24 13:20   ` [PING^2][PATCH " Tom de Vries
2026-06-01 12:34     ` Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260310091843.3214063-3-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox