python: Explicit usage of Python 3
Subsystems (2)
v2 cover python: Explicit usage of Python 3
Hello,
These are mechanical sed patches used to convert the code base to Python 3, as suggested on this thread:
https://www.mail-archive.com/[email protected]/msg675024.html
Since v1:
- new checkpatch.pl patch
- addressed Kevin and Vladimir review comments
- added R-b/A-b tags
Regards,
Phil.
Philippe Mathieu-Daudé (12):
scripts/checkpatch.pl: Only allow Python 3 interpreter tests/qemu-iotests/check: Allow use of python3 interpreter tests/qemu-iotests: Explicit usage of Python 3 (scripts with __main__)
tests: Explicit usage of Python 3
scripts: Explicit usage of Python 3 (scripts with __main__) scripts/minikconf: Explicit usage of Python 3 tests/acceptance: Remove shebang header
scripts/tracetool: Remove shebang header
tests/vm: Remove shebang header
tests/qemu-iotests: Explicit usage of Python3 (scripts without
__main__)
scripts: Explicit usage of Python 3 (scripts without __main__) tests/qemu-iotests/check: Only check for Python 3 interpreter
scripts/analyse-9p-simpletrace.py | 2 +- scripts/analyse-locks-simpletrace.py | 2 +- scripts/checkpatch.pl | 6 ++++++ scripts/decodetree.py | 2 +- scripts/device-crash-test | 2 +- scripts/kvm/kvm_flightrecorder | 2 +- scripts/minikconf.py | 1 + scripts/qapi-gen.py | 2 +- scripts/qmp/qemu-ga-client | 2 +- scripts/qmp/qmp | 2 +- scripts/qmp/qmp-shell | 2 +- scripts/qmp/qom-fuse | 2 +- scripts/render_block_graph.py | 2 +- scripts/replay-dump.py | 2 +- scripts/simpletrace.py | 2 +- scripts/tracetool.py | 2 +- scripts/tracetool/__init__.py | 1 - scripts/tracetool/backend/__init__.py | 1 - scripts/tracetool/backend/dtrace.py | 1 - scripts/tracetool/backend/ftrace.py | 1 - scripts/tracetool/backend/log.py | 1 - scripts/tracetool/backend/simple.py | 1 - scripts/tracetool/backend/syslog.py | 1 - scripts/tracetool/backend/ust.py | 1 - scripts/tracetool/format/__init__.py | 1 - scripts/tracetool/format/c.py | 1 - scripts/tracetool/format/d.py | 1 - scripts/tracetool/format/h.py | 1 - scripts/tracetool/format/log_stap.py | 1 - scripts/tracetool/format/simpletrace_stap.py | 1 - scripts/tracetool/format/stap.py | 1 - scripts/tracetool/format/tcg_h.py | 1 - scripts/tracetool/format/tcg_helper_c.py | 1 - scripts/tracetool/format/tcg_helper_h.py | 1 - scripts/tracetool/format/tcg_helper_wrapper_h.py | 1 - scripts/tracetool/format/ust_events_c.py | 1 - scripts/tracetool/format/ust_events_h.py | 1 - scripts/tracetool/transform.py | 1 - scripts/tracetool/vcpu.py | 1 - scripts/vmstate-static-checker.py | 2 +- tests/acceptance/virtio_seg_max_adjust.py | 1 - tests/acceptance/x86_cpu_model_versions.py | 1 - tests/docker/travis.py | 2 +- tests/qapi-schema/test-qapi.py | 2 +- tests/qemu-iotests/030 | 2 +- tests/qemu-iotests/040 | 2 +- tests/qemu-iotests/041 | 2 +- tests/qemu-iotests/044 | 2 +- tests/qemu-iotests/045 | 2 +- tests/qemu-iotests/055 | 2 +- tests/qemu-iotests/056 | 2 +- tests/qemu-iotests/057 | 2 +- tests/qemu-iotests/065 | 2 +- tests/qemu-iotests/093 | 2 +- tests/qemu-iotests/096 | 2 +- tests/qemu-iotests/118 | 2 +- tests/qemu-iotests/124 | 2 +- tests/qemu-iotests/129 | 2 +- tests/qemu-iotests/132 | 2 +- tests/qemu-iotests/136 | 2 +- tests/qemu-iotests/139 | 2 +- tests/qemu-iotests/147 | 2 +- tests/qemu-iotests/148 | 2 +- tests/qemu-iotests/149 | 2 +- tests/qemu-iotests/151 | 2 +- tests/qemu-iotests/152 | 2 +- tests/qemu-iotests/155 | 2 +- tests/qemu-iotests/163 | 2 +- tests/qemu-iotests/165 | 2 +- tests/qemu-iotests/169 | 2 +- tests/qemu-iotests/194 | 2 +- tests/qemu-iotests/196 | 2 +- tests/qemu-iotests/199 | 2 +- tests/qemu-iotests/202 | 2 +- tests/qemu-iotests/203 | 2 +- tests/qemu-iotests/205 | 2 +- tests/qemu-iotests/206 | 2 +- tests/qemu-iotests/207 | 2 +- tests/qemu-iotests/208 | 2 +- tests/qemu-iotests/209 | 2 +- tests/qemu-iotests/210 | 2 +- tests/qemu-iotests/211 | 2 +- tests/qemu-iotests/212 | 2 +- tests/qemu-iotests/213 | 2 +- tests/qemu-iotests/216 | 2 +- tests/qemu-iotests/218 | 2 +- tests/qemu-iotests/219 | 2 +- tests/qemu-iotests/222 | 2 +- tests/qemu-iotests/224 | 2 +- tests/qemu-iotests/228 | 2 +- tests/qemu-iotests/234 | 2 +- tests/qemu-iotests/235 | 2 +- tests/qemu-iotests/236 | 2 +- tests/qemu-iotests/237 | 2 +- tests/qemu-iotests/238 | 2 +- tests/qemu-iotests/242 | 2 +- tests/qemu-iotests/245 | 2 +- tests/qemu-iotests/246 | 2 +- tests/qemu-iotests/248 | 2 +- tests/qemu-iotests/254 | 2 +- tests/qemu-iotests/255 | 2 +- tests/qemu-iotests/256 | 2 +- tests/qemu-iotests/257 | 2 +- tests/qemu-iotests/258 | 2 +- tests/qemu-iotests/260 | 2 +- tests/qemu-iotests/262 | 2 +- tests/qemu-iotests/264 | 2 +- tests/qemu-iotests/266 | 2 +- tests/qemu-iotests/277 | 2 +- tests/qemu-iotests/280 | 2 +- tests/qemu-iotests/281 | 2 +- tests/qemu-iotests/check | 2 +- tests/qemu-iotests/nbd-fault-injector.py | 2 +- tests/qemu-iotests/qcow2.py | 2 +- tests/qemu-iotests/qed.py | 2 +- tests/vm/basevm.py | 1 - tests/vm/centos | 2 +- tests/vm/fedora | 2 +- tests/vm/freebsd | 2 +- tests/vm/netbsd | 2 +- tests/vm/openbsd | 2 +- tests/vm/ubuntu.i386 | 2 +- 122 files changed, 101 insertions(+), 120 deletions(-) mode change 100755 => 100644 tests/acceptance/virtio_seg_max_adjust.py mode change 100755 => 100644 tests/vm/basevm.py
Signature · 1 line
2.21.1
PATCH v2 1/12 scripts/checkpatch.pl: Only allow Python 3 interpreter
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/
---
Cc: Eric Blake <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Wei Yang <[email protected]>
--- scripts/checkpatch.pl | 6 ++++++ 1 file changed, 6 insertions(+)
scripts/checkpatch.pl +6 -0
@@ -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;
Signature · 1 line
2.21.1
PATCH v2 2/12 tests/qemu-iotests/check: Allow use of python3 interpreter
In reply to Philippe Mathieu-DaudéAs we want to enforce a unique and explicit Python 3 interpreter, we need let this script handle 'python3' too.
--- tests/qemu-iotests/check | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tests/qemu-iotests/check +2 -1
@@ -825,7 +825,8 @@ do start=$(_wallclock) - if [ "$(head -n 1 "$source_iotests/$seq")" == "#!/usr/bin/env python" ]; then + if [ "$(head -n 1 "$source_iotests/$seq" | sed 's/3$//')" \ + == "#!/usr/bin/env python" ]; then if $python_usable; then run_command="$PYTHON $seq" else
Signature · 1 line
2.21.1
PATCH v2 3/12 tests/qemu-iotests: Explicit usage of Python 3 (scripts with __main__)
In reply to Philippe Mathieu-DaudéUse the program search path to find the Python 3 interpreter.
Patch created mechanically by running:
$ sed -i "s,^#\!/usr/bin/\(env\ \)\?python$,#\!/usr/bin/env python3," \
$(git grep -l 'if __name__.*__main__')--- tests/qemu-iotests/030 | 2 +- tests/qemu-iotests/040 | 2 +- tests/qemu-iotests/041 | 2 +- tests/qemu-iotests/044 | 2 +- tests/qemu-iotests/045 | 2 +- tests/qemu-iotests/055 | 2 +- tests/qemu-iotests/056 | 2 +- tests/qemu-iotests/057 | 2 +- tests/qemu-iotests/065 | 2 +- tests/qemu-iotests/093 | 2 +- tests/qemu-iotests/096 | 2 +- tests/qemu-iotests/118 | 2 +- tests/qemu-iotests/124 | 2 +- tests/qemu-iotests/129 | 2 +- tests/qemu-iotests/132 | 2 +- tests/qemu-iotests/136 | 2 +- tests/qemu-iotests/139 | 2 +- tests/qemu-iotests/147 | 2 +- tests/qemu-iotests/148 | 2 +- tests/qemu-iotests/151 | 2 +- tests/qemu-iotests/152 | 2 +- tests/qemu-iotests/155 | 2 +- tests/qemu-iotests/163 | 2 +- tests/qemu-iotests/165 | 2 +- tests/qemu-iotests/169 | 2 +- tests/qemu-iotests/196 | 2 +- tests/qemu-iotests/199 | 2 +- tests/qemu-iotests/205 | 2 +- tests/qemu-iotests/245 | 2 +- tests/qemu-iotests/257 | 2 +- tests/qemu-iotests/258 | 2 +- tests/qemu-iotests/281 | 2 +- tests/qemu-iotests/nbd-fault-injector.py | 2 +- tests/qemu-iotests/qcow2.py | 2 +- tests/qemu-iotests/qed.py | 2 +- 35 files changed, 35 insertions(+), 35 deletions(-)
tests/qemu-iotests/030 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for image streaming. #
tests/qemu-iotests/040 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for image block commit. #
tests/qemu-iotests/041 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for image mirroring. #
tests/qemu-iotests/044 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests growing a large refcount table. #
tests/qemu-iotests/045 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for fdsets and getfd. #
tests/qemu-iotests/055 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for drive-backup and blockdev-backup #
tests/qemu-iotests/056 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for drive-backup #
tests/qemu-iotests/057 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for internal snapshot. #
tests/qemu-iotests/065 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test for additional information emitted by qemu-img info on qcow2 # images
tests/qemu-iotests/093 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for IO throttling #
tests/qemu-iotests/096 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test that snapshots move the throttling configuration to the active # layer
tests/qemu-iotests/118 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test case for the QMP 'change' command and all other associated # commands
tests/qemu-iotests/124 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for incremental drive-backup #
tests/qemu-iotests/129 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests that "bdrv_drain_all" doesn't drain block jobs #
tests/qemu-iotests/132 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test mirror with unmap #
tests/qemu-iotests/136 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for block device statistics #
tests/qemu-iotests/139 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test cases for the QMP 'blockdev-del' command #
tests/qemu-iotests/147 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test case for NBD's blockdev-add interface #
tests/qemu-iotests/148 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test the rate limit of QMP events #
tests/qemu-iotests/151 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for active mirroring #
tests/qemu-iotests/152 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for drive-mirror with source size unaligned to granularity #
tests/qemu-iotests/155 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test whether the backing BDSs are correct after completion of a # mirror block job; in "existing" modes (drive-mirror with
tests/qemu-iotests/163 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for shrinking images #
tests/qemu-iotests/165 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for persistent dirty bitmaps. #
tests/qemu-iotests/169 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for dirty bitmaps migration. #
tests/qemu-iotests/196 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test clearing unknown autoclear_features flag by qcow2 after # migration. This test mimics migration to older qemu.
tests/qemu-iotests/199 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for dirty bitmaps postcopy migration. #
tests/qemu-iotests/205 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for qmp command nbd-server-remove. #
tests/qemu-iotests/245 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test cases for the QMP 'x-blockdev-reopen' command #
tests/qemu-iotests/257 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test bitmap-sync backups (incremental, differential, and partials) #
tests/qemu-iotests/258 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Very specific tests for adjacent commit/stream block jobs #
tests/qemu-iotests/281 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test cases for blockdev + IOThread interactions #
tests/qemu-iotests/nbd-fault-injector.py +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # NBD server - fault injection utility # # Configuration file syntax:
tests/qemu-iotests/qcow2.py +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function import sys
tests/qemu-iotests/qed.py +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tool to manipulate QED image files #
Signature · 1 line
2.21.1
PATCH v2 4/12 tests: Explicit usage of Python 3
In reply to Philippe Mathieu-DaudéUse the program search path to find the Python 3 interpreter.
Patch created mechanically by running:
$ sed -i "s,^#\!/usr/bin/\(env\ \)\?python$,#\!/usr/bin/env python3," \
$(git grep -l 'if __name__.*__main__')--- tests/docker/travis.py | 2 +- tests/qapi-schema/test-qapi.py | 2 +- tests/vm/centos | 2 +- tests/vm/fedora | 2 +- tests/vm/freebsd | 2 +- tests/vm/netbsd | 2 +- tests/vm/openbsd | 2 +- tests/vm/ubuntu.i386 | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-)
tests/docker/travis.py +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Travis YAML config parser #
tests/qapi-schema/test-qapi.py +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # QAPI parser test harness #
tests/vm/centos +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # CentOS image #
tests/vm/fedora +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Fedora VM image #
tests/vm/freebsd +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # FreeBSD VM image #
tests/vm/netbsd +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # NetBSD VM image #
tests/vm/openbsd +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # OpenBSD VM image #
tests/vm/ubuntu.i386 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Ubuntu i386 image #
Signature · 1 line
2.21.1
PATCH v2 5/12 scripts: Explicit usage of Python 3 (scripts with __main__)
In reply to Philippe Mathieu-DaudéUse the program search path to find the Python 3 interpreter.
Patch created mechanically by running:
$ sed -i "s,^#\!/usr/bin/\(env\ \)\?python$,#\!/usr/bin/env python3," \
$(git grep -l 'if __name__.*__main__')--- scripts/analyse-locks-simpletrace.py | 2 +- scripts/decodetree.py | 2 +- scripts/device-crash-test | 2 +- scripts/kvm/kvm_flightrecorder | 2 +- scripts/qapi-gen.py | 2 +- scripts/qmp/qemu-ga-client | 2 +- scripts/qmp/qmp | 2 +- scripts/qmp/qmp-shell | 2 +- scripts/qmp/qom-fuse | 2 +- scripts/render_block_graph.py | 2 +- scripts/replay-dump.py | 2 +- scripts/simpletrace.py | 2 +- scripts/tracetool.py | 2 +- scripts/vmstate-static-checker.py | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-)
scripts/analyse-locks-simpletrace.py +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Analyse lock events and compute statistics
scripts/decodetree.py +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright (c) 2018 Linaro Limited # # This library is free software; you can redistribute it and/or
scripts/device-crash-test +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2017 Red Hat Inc #
scripts/kvm/kvm_flightrecorder +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # KVM Flight Recorder - ring buffer tracing script #
scripts/qapi-gen.py +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # QAPI generator # # This work is licensed under the terms of the GNU GPL, version 2 or later.
scripts/qmp/qemu-ga-client +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python3 # QEMU Guest Agent Client #
scripts/qmp/qmp +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python3 # # QMP command line tool #
scripts/qmp/qmp-shell +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python3 # # Low-level QEMU shell on top of QMP. #
scripts/qmp/qom-fuse +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python3 ## # QEMU Object Model test tools #
scripts/render_block_graph.py +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Render Qemu Block Graph #
scripts/replay-dump.py +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Dump the contents of a recorded execution stream
scripts/simpletrace.py +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Pretty-printer for simple trace backend binary trace files #
scripts/tracetool.py +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- """
scripts/vmstate-static-checker.py +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python3 # # Compares vmstate information stored in JSON format, obtained from # the -dump-vmstate QEMU command.
Signature · 1 line
2.21.1
PATCH v2 6/12 scripts/minikconf: Explicit usage of Python 3
In reply to Philippe Mathieu-DaudéUse the program search path to find the Python 3 interpreter.
Patch created manually after running:
$ git grep -l 'if __name__.*__main__' \
| xargs grep -LF '#!/usr/bin/env python3'--- scripts/minikconf.py | 1 + 1 file changed, 1 insertion(+)
scripts/minikconf.py +1 -0
@@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # # Mini-Kconfig parser #
Signature · 1 line
2.21.1
PATCH v2 7/12 tests/acceptance: Remove shebang header
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ chmod 644 $(git grep -lF '#!/usr/bin/env python' \
| xargs grep -L 'if __name__.*__main__')
$ sed -i "/^#\!\/usr\/bin\/\(env\ \)\?python.\?$/d" \
$(git grep -lF '#!/usr/bin/env python' \
| xargs grep -L 'if __name__.*__main__')--- tests/acceptance/virtio_seg_max_adjust.py | 1 - tests/acceptance/x86_cpu_model_versions.py | 1 - 2 files changed, 2 deletions(-) mode change 100755 => 100644 tests/acceptance/virtio_seg_max_adjust.py
tests/acceptance/virtio_seg_max_adjust.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # # Test virtio-scsi and virtio-blk queue settings for all machine types #
tests/acceptance/x86_cpu_model_versions.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # # Basic validation of x86 versioned CPU models and CPU model aliases #
Signature · 1 line
2.21.1
Philippe Mathieu-Daudé
AppliedRe: [PATCH v2 07/12] tests/acceptance: Remove shebang header
Quoted 36 lines · Philippe Mathieu-Daudé
Patch created mechanically by running:
$ chmod 644 $(git grep -lF '#!/usr/bin/env python' \ | xargs grep -L 'if __name__.*__main__') $ sed -i "/^#\!\/usr\/bin\/\(env\ \)\?python.\?$/d" \ $(git grep -lF '#!/usr/bin/env python' \ | xargs grep -L 'if __name__.*__main__')Reported-by Vladimir Sementsov-Ogievskiy <[email protected]>Suggested-by Stefan Hajnoczi <[email protected]>Reviewed-by Wainer dos Santos Moschetta <[email protected]>Acked-by Stefan Hajnoczi <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/acceptance/virtio_seg_max_adjust.py | 1 - tests/acceptance/x86_cpu_model_versions.py | 1 - 2 files changed, 2 deletions(-)mode change 100755 => 100644
tests/acceptance/virtio_seg_max_adjust.pytests/acceptance/virtio_seg_max_adjust.py +0
-1@@ -1,4 +1,3 @@ -#!/usr/bin/env python # # Test virtio-scsi and virtio-blk queue settings for all machine types #tests/acceptance/x86_cpu_model_versions.py +0
-0
tests/acceptance/x86_cpu_model_versions.py line 3
Quoted 4 lines
tests/acceptance/x86_cpu_model_versions.py +0
-1@@ -1,4 +1,3 @@ -#!/usr/bin/env python # # Basic validation of x86 versioned CPU models and CPU model aliases #
Thanks, applied to my python-next tree:
https://gitlab.com/philmd/qemu/commits/python-next
Re: [PATCH v2 07/12] tests/acceptance: Remove shebang header
In reply to Philippe Mathieu-DaudéQuoted 7 lines · Philippe Mathieu-Daudé
Patch created mechanically by running:
$ chmod 644 $(git grep -lF '#!/usr/bin/env python' \ | xargs grep -L 'if __name__.*__main__') $ sed -i "/^#\!\/usr\/bin\/\(env\ \)\?python.\?$/d" \ $(git grep -lF '#!/usr/bin/env python' \ | xargs grep -L 'if __name__.*__main__')
OK, but my question is why? Aren't shebangs considered good practice for finding the executable for a script?
If the acceptance scripts are special in this regard we should say why in the commit message.
Quoted 32 lines
Reported-by Vladimir Sementsov-Ogievskiy <[email protected]>Suggested-by Stefan Hajnoczi <[email protected]>Reviewed-by Wainer dos Santos Moschetta <[email protected]>Acked-by Stefan Hajnoczi <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/acceptance/virtio_seg_max_adjust.py | 1 - tests/acceptance/x86_cpu_model_versions.py | 1 - 2 files changed, 2 deletions(-) mode change 100755 => 100644 tests/acceptance/virtio_seg_max_adjust.pytests/acceptance/virtio_seg_max_adjust.py +0
-1@@ -1,4 +1,3 @@ -#!/usr/bin/env python # # Test virtio-scsi and virtio-blk queue settings for all machine types #tests/acceptance/x86_cpu_model_versions.py +0
-1@@ -1,4 +1,3 @@ -#!/usr/bin/env python # # Basic validation of x86 versioned CPU models and CPU model aliases #
Signature · 1 line
Alex Bennée
PATCH v2 8/12 scripts/tracetool: Remove shebang header
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ chmod 644 $(git grep -lF '#!/usr/bin/env python' \
| xargs grep -L 'if __name__.*__main__')
$ sed -i "/^#\!\/usr\/bin\/\(env\ \)\?python.\?$/d" \
$(git grep -lF '#!/usr/bin/env python' \
| xargs grep -L 'if __name__.*__main__')--- scripts/tracetool/__init__.py | 1 - scripts/tracetool/backend/__init__.py | 1 - scripts/tracetool/backend/dtrace.py | 1 - scripts/tracetool/backend/ftrace.py | 1 - scripts/tracetool/backend/log.py | 1 - scripts/tracetool/backend/simple.py | 1 - scripts/tracetool/backend/syslog.py | 1 - scripts/tracetool/backend/ust.py | 1 - scripts/tracetool/format/__init__.py | 1 - scripts/tracetool/format/c.py | 1 - scripts/tracetool/format/d.py | 1 - scripts/tracetool/format/h.py | 1 - scripts/tracetool/format/log_stap.py | 1 - scripts/tracetool/format/simpletrace_stap.py | 1 - scripts/tracetool/format/stap.py | 1 - scripts/tracetool/format/tcg_h.py | 1 - scripts/tracetool/format/tcg_helper_c.py | 1 - scripts/tracetool/format/tcg_helper_h.py | 1 - scripts/tracetool/format/tcg_helper_wrapper_h.py | 1 - scripts/tracetool/format/ust_events_c.py | 1 - scripts/tracetool/format/ust_events_h.py | 1 - scripts/tracetool/transform.py | 1 - scripts/tracetool/vcpu.py | 1 - 23 files changed, 23 deletions(-)
scripts/tracetool/__init__.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """
scripts/tracetool/backend/__init__.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """
scripts/tracetool/backend/dtrace.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """
scripts/tracetool/backend/ftrace.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """
scripts/tracetool/backend/log.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """
scripts/tracetool/backend/simple.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """
scripts/tracetool/backend/syslog.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """
scripts/tracetool/backend/ust.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """
scripts/tracetool/format/__init__.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """
scripts/tracetool/format/c.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """
scripts/tracetool/format/d.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """
scripts/tracetool/format/h.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """
scripts/tracetool/format/log_stap.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """
scripts/tracetool/format/simpletrace_stap.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """
scripts/tracetool/format/stap.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """
scripts/tracetool/format/tcg_h.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """
scripts/tracetool/format/tcg_helper_c.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """
scripts/tracetool/format/tcg_helper_h.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """
scripts/tracetool/format/tcg_helper_wrapper_h.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """
scripts/tracetool/format/ust_events_c.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """
scripts/tracetool/format/ust_events_h.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """
scripts/tracetool/transform.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """
scripts/tracetool/vcpu.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """
Signature · 1 line
2.21.1
PATCH v2 9/12 tests/vm: Remove shebang header
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ chmod 644 $(git grep -lF '#!/usr/bin/env python' \
| xargs grep -L 'if __name__.*__main__')
$ sed -i "/^#\!\/usr\/bin\/\(env\ \)\?python.\?$/d" \
$(git grep -lF '#!/usr/bin/env python' \
| xargs grep -L 'if __name__.*__main__')--- tests/vm/basevm.py | 1 - 1 file changed, 1 deletion(-) mode change 100755 => 100644 tests/vm/basevm.py
tests/vm/basevm.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # # VM testing base class #
Signature · 1 line
2.21.1
PATCH v2 10/12 tests/qemu-iotests: Explicit usage of Python3 (scripts without __main__)
In reply to Philippe Mathieu-DaudéUse the program search path to find the Python 3 interpreter.
Patch created mechanically by running:
$ sed -i "s,^#\!/usr/bin/\(env\ \)\?python$,#\!/usr/bin/env python3," \
$(git grep -lF '#!/usr/bin/env python' \
| xargs grep -L 'if __name__.*__main__')--- tests/qemu-iotests/149 | 2 +- tests/qemu-iotests/194 | 2 +- tests/qemu-iotests/202 | 2 +- tests/qemu-iotests/203 | 2 +- tests/qemu-iotests/206 | 2 +- tests/qemu-iotests/207 | 2 +- tests/qemu-iotests/208 | 2 +- tests/qemu-iotests/209 | 2 +- tests/qemu-iotests/210 | 2 +- tests/qemu-iotests/211 | 2 +- tests/qemu-iotests/212 | 2 +- tests/qemu-iotests/213 | 2 +- tests/qemu-iotests/216 | 2 +- tests/qemu-iotests/218 | 2 +- tests/qemu-iotests/219 | 2 +- tests/qemu-iotests/222 | 2 +- tests/qemu-iotests/224 | 2 +- tests/qemu-iotests/228 | 2 +- tests/qemu-iotests/234 | 2 +- tests/qemu-iotests/235 | 2 +- tests/qemu-iotests/236 | 2 +- tests/qemu-iotests/237 | 2 +- tests/qemu-iotests/238 | 2 +- tests/qemu-iotests/242 | 2 +- tests/qemu-iotests/246 | 2 +- tests/qemu-iotests/248 | 2 +- tests/qemu-iotests/254 | 2 +- tests/qemu-iotests/255 | 2 +- tests/qemu-iotests/256 | 2 +- tests/qemu-iotests/260 | 2 +- tests/qemu-iotests/262 | 2 +- tests/qemu-iotests/264 | 2 +- tests/qemu-iotests/266 | 2 +- tests/qemu-iotests/277 | 2 +- tests/qemu-iotests/280 | 2 +- 35 files changed, 35 insertions(+), 35 deletions(-)
tests/qemu-iotests/149 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2016 Red Hat, Inc. #
tests/qemu-iotests/194 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2017 Red Hat, Inc. #
tests/qemu-iotests/202 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2017 Red Hat, Inc. #
tests/qemu-iotests/203 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2017 Red Hat, Inc. #
tests/qemu-iotests/206 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test qcow2 and file image creation #
tests/qemu-iotests/207 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test ssh image creation #
tests/qemu-iotests/208 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2018 Red Hat, Inc. #
tests/qemu-iotests/209 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for NBD BLOCK_STATUS extension #
tests/qemu-iotests/210 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test luks and file image creation #
tests/qemu-iotests/211 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test VDI and file image creation #
tests/qemu-iotests/212 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test parallels and file image creation #
tests/qemu-iotests/213 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test vhdx and file image creation #
tests/qemu-iotests/216 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copy-on-read tests using a COR filter node #
tests/qemu-iotests/218 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # This test covers what happens when a mirror block job is cancelled # in various phases of its existence.
tests/qemu-iotests/219 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2018 Red Hat, Inc. #
tests/qemu-iotests/222 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # This test covers the basic fleecing workflow, which provides a # point-in-time snapshot of a node that can be queried over NBD.
tests/qemu-iotests/224 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test json:{} filenames with qemu-internal BDSs # (the one of commit, to be precise)
tests/qemu-iotests/228 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test for when a backing file is considered overridden (thus, a # json:{} filename is generated for the overlay) and when it is not
tests/qemu-iotests/234 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2018 Red Hat, Inc. #
tests/qemu-iotests/235 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Simple mirror test #
tests/qemu-iotests/236 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test bitmap merges. #
tests/qemu-iotests/237 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test vmdk and file image creation #
tests/qemu-iotests/238 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Regression test for throttle group member unregister segfault with iothread #
tests/qemu-iotests/242 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test for qcow2 bitmap printed information #
tests/qemu-iotests/246 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test persistent bitmap resizing. #
tests/qemu-iotests/248 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test resume mirror after auto pause on ENOSPC #
tests/qemu-iotests/254 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test external snapshot with bitmap copying and moving. #
tests/qemu-iotests/255 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test commit job graph modifications while requests are active #
tests/qemu-iotests/256 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test incremental/backup across iothread contexts #
tests/qemu-iotests/260 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Tests for temporary external snapshot when we have bitmaps. #
tests/qemu-iotests/262 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2019 Red Hat, Inc. #
tests/qemu-iotests/264 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test nbd reconnect #
tests/qemu-iotests/266 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test VPC and file image creation #
tests/qemu-iotests/277 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Test NBD client reconnection #
tests/qemu-iotests/280 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2019 Red Hat, Inc. #
Signature · 1 line
2.21.1
PATCH v2 11/12 scripts: Explicit usage of Python 3 (scripts without __main__)
In reply to Philippe Mathieu-DaudéUse the program search path to find the Python 3 interpreter.
Patch created mechanically by running:
$ sed -i "s,^#\!/usr/bin/\(env\ \)\?python$,#\!/usr/bin/env python3," \
$(git grep -lF '#!/usr/bin/env python' \
| xargs grep -L 'if __name__.*__main__')--- scripts/analyse-9p-simpletrace.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/analyse-9p-simpletrace.py +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Pretty print 9p simpletrace log # Usage: ./analyse-9p-simpletrace <trace-events> <trace-pid> #
Signature · 1 line
2.21.1
PATCH v2 12/12 tests/qemu-iotests/check: Only check for Python 3 interpreter
In reply to Philippe Mathieu-DaudéAll the iotests Python scripts have been converted to search for the Python 3 interpreter. Update the ./check script accordingly.
--- tests/qemu-iotests/check | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tests/qemu-iotests/check +1 -2
@@ -825,8 +825,7 @@ do start=$(_wallclock) - if [ "$(head -n 1 "$source_iotests/$seq" | sed 's/3$//')" \ - == "#!/usr/bin/env python" ]; then + if [ "$(head -n 1 "$source_iotests/$seq")" == "#!/usr/bin/env python3" ]; then if $python_usable; then run_command="$PYTHON $seq" else
Signature · 1 line
2.21.1
Quoted 10 lines · Philippe Mathieu-Daudé
Hello,
These are mechanical sed patches used to convert the code base to Python 3, as suggested on this thread:
https://www.mail-archive.com/[email protected]/msg675024.htmlSince v1:
- new checkpatch.pl patch
- addressed Kevin and Vladimir review comments
- added R-b/A-b tags
Queued, thanks.
Paolo
Quoted 26 lines · Philippe Mathieu-Daudé
Hello,
These are mechanical sed patches used to convert the code base to Python 3, as suggested on this thread:
https://www.mail-archive.com/[email protected]/msg675024.htmlSince v1:
- new checkpatch.pl patch
- addressed Kevin and Vladimir review comments
- added R-b/A-b tagsRegards,
Phil.
Philippe Mathieu-Daudé (12):
scripts/checkpatch.pl: Only allow Python 3 interpreter tests/qemu-iotests/check: Allow use of python3 interpreter tests/qemu-iotests: Explicit usage of Python 3 (scripts with__main__)
tests: Explicit usage of Python 3
scripts: Explicit usage of Python 3 (scripts with__main__)scripts/minikconf: Explicit usage of Python 3 tests/acceptance: Remove shebang header
scripts/tracetool: Remove shebang header
tests/vm: Remove shebang header
tests/qemu-iotests: Explicit usage of Python3 (scripts without
Quoted 3 lines
__main__)scripts: Explicit usage of Python 3 (scripts without
__main__) tests/qemu-iotests/check: Only check for Python 3 interpreter
Series applied to my python-next tree:
https://gitlab.com/philmd/qemu/commits/python-next