Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] [pre-commit] Stop using deprecated language script
@ 2026-06-16  9:23 Tom de Vries
  2026-06-16 13:46 ` Simon Marchi
  0 siblings, 1 reply; 4+ messages in thread
From: Tom de Vries @ 2026-06-16  9:23 UTC (permalink / raw)
  To: gdb-patches

In v4.4.0, pre-commit renamed language script to unsupported_script.

The rename was done to stress that pre-commit doesn't provide an environment
for the script to run in [1].

The language script is now a deprecated alias for unsupported_script, and the
plan seems to be to initially produce a deprecation warning, and eventually
remove support for the alias completely.

Start using the new name: unsupported_script.

Furthermore, the check-include-guards hook uses language python, and indeed it
uses a python script, but it doesn't really need a virtual environment.  It
imports modules fnmatch, re, sys and typing, all of which are available in
python 3.10 and later, which is the environment pre-commit itself requires
(because we require pre-commit v4.5.1 or later, and pre-commit requires python
3.10 since v4.4.0).  So while we're at it, use unsupported_script for this
hook as well, reducing the amount of environments pre-commit has to manage.

Tested using "pre-commit run --all-files" with python 3.10, as well as 3.13.

[1] https://github.com/pre-commit/pre-commit/pull/3577
---
 .pre-commit-config.yaml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 3c2a27acb11..351b9f6933f 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -84,7 +84,7 @@ repos:
     hooks:
     - id: check-include-guards
       name: check-include-guards
-      language: python
+      language: unsupported_script
       entry: gdb/check-include-guards.py
       # All gdb header files, but not headers in the test suite.
       files: '^(gdb(support|server)?)/.*\.h$'
@@ -100,7 +100,7 @@ repos:
       stages: [pre-commit]
     - id: check-whitespace
       name: check-whitespace
-      language: script
+      language: unsupported_script
       entry: gdb/contrib/check-whitespace-pre-commit.py
       files: '^(gdb(support|server)?)/.*$'
       pass_filenames: true
@@ -114,7 +114,7 @@ repos:
       require_serial: true
     - id: check-file-mode
       name: check-file-mode
-      language: script
+      language: unsupported_script
       entry: gdb/contrib/check-file-mode.sh
       files: '^(gdb|gdbserver|gdbsupport)/.*$'
   - repo: https://github.com/nmoroze/tclint

base-commit: a3ccc1836915eb694ac0f9b97ebb345bf7c83597
-- 
2.51.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [pre-commit] Stop using deprecated language script
  2026-06-16  9:23 [PATCH] [pre-commit] Stop using deprecated language script Tom de Vries
@ 2026-06-16 13:46 ` Simon Marchi
  2026-06-16 15:32   ` Tom de Vries
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Marchi @ 2026-06-16 13:46 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches

On 6/16/26 5:23 AM, Tom de Vries wrote:
> In v4.4.0, pre-commit renamed language script to unsupported_script.
> 
> The rename was done to stress that pre-commit doesn't provide an environment
> for the script to run in [1].
> 
> The language script is now a deprecated alias for unsupported_script, and the
> plan seems to be to initially produce a deprecation warning, and eventually
> remove support for the alias completely.
> 
> Start using the new name: unsupported_script.
> 
> Furthermore, the check-include-guards hook uses language python, and indeed it
> uses a python script, but it doesn't really need a virtual environment.  It
> imports modules fnmatch, re, sys and typing, all of which are available in
> python 3.10 and later, which is the environment pre-commit itself requires
> (because we require pre-commit v4.5.1 or later, and pre-commit requires python
> 3.10 since v4.4.0).  So while we're at it, use unsupported_script for this
> hook as well, reducing the amount of environments pre-commit has to manage.
> 
> Tested using "pre-commit run --all-files" with python 3.10, as well as 3.13.
> 
> [1] https://github.com/pre-commit/pre-commit/pull/3577

From reading the pre-commit doc, I didn't understand the difference
between "unsupported_script" and "unsupported", did you?

Simon

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [pre-commit] Stop using deprecated language script
  2026-06-16 13:46 ` Simon Marchi
@ 2026-06-16 15:32   ` Tom de Vries
  2026-06-16 15:46     ` Simon Marchi
  0 siblings, 1 reply; 4+ messages in thread
From: Tom de Vries @ 2026-06-16 15:32 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 6/16/26 3:46 PM, Simon Marchi wrote:
> On 6/16/26 5:23 AM, Tom de Vries wrote:
>> In v4.4.0, pre-commit renamed language script to unsupported_script.
>>
>> The rename was done to stress that pre-commit doesn't provide an environment
>> for the script to run in [1].
>>
>> The language script is now a deprecated alias for unsupported_script, and the
>> plan seems to be to initially produce a deprecation warning, and eventually
>> remove support for the alias completely.
>>
>> Start using the new name: unsupported_script.
>>
>> Furthermore, the check-include-guards hook uses language python, and indeed it
>> uses a python script, but it doesn't really need a virtual environment.  It
>> imports modules fnmatch, re, sys and typing, all of which are available in
>> python 3.10 and later, which is the environment pre-commit itself requires
>> (because we require pre-commit v4.5.1 or later, and pre-commit requires python
>> 3.10 since v4.4.0).  So while we're at it, use unsupported_script for this
>> hook as well, reducing the amount of environments pre-commit has to manage.
>>
>> Tested using "pre-commit run --all-files" with python 3.10, as well as 3.13.
>>
>> [1] https://github.com/pre-commit/pre-commit/pull/3577
> 
>  From reading the pre-commit doc, I didn't understand the difference
> between "unsupported_script" and "unsupported", did you?

Not really.

The difference seems to be that for unsupported_script "the entry should 
be a path relative to the root of the hook repository".

Concretely, a hook like this using unsupported_script works:
...
     - id: bla
       name: bla
       language: unsupported
       entry: sh -c "echo bla; exit 1"
...

Changing the language to unsupported_script gets us: "Executable 
`/data/vries/gdb/binutils-gdb.git/sh"` not found.

To get the same effect, we need:
...
     - id: bla
       name: bla
       language: unsupported_script
       entry: /usr/bin/sh -c "echo bla; exit 1"
...

Note that this version also works fine with language unsupported.

The intent seems to be that unsupported_script is reserved for in-repo 
scripts, and unsupported is the fallback that supports anything else.	

Thanks,
- Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [pre-commit] Stop using deprecated language script
  2026-06-16 15:32   ` Tom de Vries
@ 2026-06-16 15:46     ` Simon Marchi
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Marchi @ 2026-06-16 15:46 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches

On 6/16/26 11:32 AM, Tom de Vries wrote:
> On 6/16/26 3:46 PM, Simon Marchi wrote:
>> On 6/16/26 5:23 AM, Tom de Vries wrote:
>>> In v4.4.0, pre-commit renamed language script to unsupported_script.
>>>
>>> The rename was done to stress that pre-commit doesn't provide an environment
>>> for the script to run in [1].
>>>
>>> The language script is now a deprecated alias for unsupported_script, and the
>>> plan seems to be to initially produce a deprecation warning, and eventually
>>> remove support for the alias completely.
>>>
>>> Start using the new name: unsupported_script.
>>>
>>> Furthermore, the check-include-guards hook uses language python, and indeed it
>>> uses a python script, but it doesn't really need a virtual environment.  It
>>> imports modules fnmatch, re, sys and typing, all of which are available in
>>> python 3.10 and later, which is the environment pre-commit itself requires
>>> (because we require pre-commit v4.5.1 or later, and pre-commit requires python
>>> 3.10 since v4.4.0).  So while we're at it, use unsupported_script for this
>>> hook as well, reducing the amount of environments pre-commit has to manage.
>>>
>>> Tested using "pre-commit run --all-files" with python 3.10, as well as 3.13.
>>>
>>> [1] https://github.com/pre-commit/pre-commit/pull/3577
>>
>>  From reading the pre-commit doc, I didn't understand the difference
>> between "unsupported_script" and "unsupported", did you?
> 
> Not really.
> 
> The difference seems to be that for unsupported_script "the entry should be a path relative to the root of the hook repository".
> 
> Concretely, a hook like this using unsupported_script works:
> ...
>     - id: bla
>       name: bla
>       language: unsupported
>       entry: sh -c "echo bla; exit 1"
> ...
> 
> Changing the language to unsupported_script gets us: "Executable `/data/vries/gdb/binutils-gdb.git/sh"` not found.
> 
> To get the same effect, we need:
> ...
>     - id: bla
>       name: bla
>       language: unsupported_script
>       entry: /usr/bin/sh -c "echo bla; exit 1"
> ...
> 
> Note that this version also works fine with language unsupported.
> 
> The intent seems to be that unsupported_script is reserved for in-repo scripts, and unsupported is the fallback that supports anything else.   

Ok, make sense.  LGTM then.

Approved-By: Simon Marchi <simon.marchi@efficios.com>

Simon

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-06-16 15:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-16  9:23 [PATCH] [pre-commit] Stop using deprecated language script Tom de Vries
2026-06-16 13:46 ` Simon Marchi
2026-06-16 15:32   ` Tom de Vries
2026-06-16 15:46     ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox