[binutils-gdb] [pre-commit] Stop using deprecated language script

Tom de Vries via Gdb-cvs <[email protected]> Tue, 16 Jun 2026 18:34:18 +0000 (GMT)
Newsgroups gmane.comp.gdb.cvs
Message-ID <20260616183418.A4FDD48F6643__23582.5935191073$1781635151$gmane$org@sourceware.org>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ada409879cc393c4cf633efe3d7afb716523f6be

commit ada409879cc393c4cf633efe3d7afb716523f6be
Author: Tom de Vries <[email protected]>
Date:   Tue Jun 16 20:34:14 2026 +0200

    [pre-commit] Stop using deprecated language script
    
    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.
    
    Approved-By: Simon Marchi <[email protected]>
    
    [1] https://github.com/pre-commit/pre-commit/pull/3577

Diff:
---
 .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