[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 01/12] scripts/checkpatch.pl: Only allow Python 3 interpreter
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 01/12] scripts/checkpatch.pl: Only allow Python 3 interpreter |
Date: |
Thu, 30 Jan 2020 17:32:21 +0100 |
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 <address@hidden>
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
Cc: Eric Blake <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Cc: Wei Yang <address@hidden>
---
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;
--
2.21.1
- [PATCH v2 00/12] python: Explicit usage of Python 3, Philippe Mathieu-Daudé, 2020/01/30
- [PATCH v2 01/12] scripts/checkpatch.pl: Only allow Python 3 interpreter,
Philippe Mathieu-Daudé <=
- [PATCH v2 02/12] tests/qemu-iotests/check: Allow use of python3 interpreter, Philippe Mathieu-Daudé, 2020/01/30
- [PATCH v2 03/12] tests/qemu-iotests: Explicit usage of Python 3 (scripts with __main__), Philippe Mathieu-Daudé, 2020/01/30
- [PATCH v2 04/12] tests: Explicit usage of Python 3, Philippe Mathieu-Daudé, 2020/01/30
- [PATCH v2 05/12] scripts: Explicit usage of Python 3 (scripts with __main__), Philippe Mathieu-Daudé, 2020/01/30
- [PATCH v2 06/12] scripts/minikconf: Explicit usage of Python 3, Philippe Mathieu-Daudé, 2020/01/30
- [PATCH v2 07/12] tests/acceptance: Remove shebang header, Philippe Mathieu-Daudé, 2020/01/30
- [PATCH v2 08/12] scripts/tracetool: Remove shebang header, Philippe Mathieu-Daudé, 2020/01/30
- [PATCH v2 09/12] tests/vm: Remove shebang header, Philippe Mathieu-Daudé, 2020/01/30
- [PATCH v2 10/12] tests/qemu-iotests: Explicit usage of Python3 (scripts without __main__), Philippe Mathieu-Daudé, 2020/01/30