From bc7f3b0b0d33fb58272a98c862dc9a1fa913fcd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 30 Jan 2020 17:32:21 +0100 Subject: [PATCH] scripts/checkpatch.pl: Only allow Python 3 interpreter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since commit ddf9069963 QEMU requires Python >= 3.5. PEP 0394 [*] states that 'python3' should be available and that 'python' is optional. To avoid problem with unsupported versions, enforce the shebang interpreter to Python 3. [*] https://www.python.org/dev/peps/pep-0394/ Reported-by: John Snow Acked-by: Paolo Bonzini Message-Id: <20200130163232.10446-2-philmd@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- scripts/checkpatch.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 3aef6e3dfe..ce43a306f8 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1460,6 +1460,12 @@ sub process { } } +# Only allow Python 3 interpreter + if ($realline == 1 && + $line =~ /^\+#!\ *\/usr\/bin\/(?:env )?python$/) { + ERROR("please use python3 interpreter\n" . $herecurr); + } + # Accept git diff extended headers as valid patches if ($line =~ /^(?:rename|copy) (?:from|to) [\w\/\.\-]+\s*$/) { $is_patch = 1;