From c37446c43001afc31168045c4cb18e1e4efb3f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Ferreira?= Date: Wed, 22 Dec 2021 18:38:55 +0000 Subject: [PATCH] pre_commit: prefer pythonX over pythonX.Y MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch prevent reinstallation of pre-commit hooks or any script generated by shebang function to just update the script shebang, since the scripts are not heavily dependent on a specific Python 3 version: /usr/bin/env: ‘python3.9’: No such file or directory Signed-off-by: Luís Ferreira --- pre_commit/commands/install_uninstall.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pre_commit/commands/install_uninstall.py b/pre_commit/commands/install_uninstall.py index 7974423b..214f5ccb 100644 --- a/pre_commit/commands/install_uninstall.py +++ b/pre_commit/commands/install_uninstall.py @@ -59,8 +59,8 @@ def shebang() -> str: py, _ = os.path.splitext(SYS_EXE) else: exe_choices = [ - f'python{sys.version_info[0]}.{sys.version_info[1]}', f'python{sys.version_info[0]}', + f'python{sys.version_info[0]}.{sys.version_info[1]}', ] # avoid searching for bare `python` as it's likely to be python 2 if SYS_EXE != 'python':