configure: Require python3 >= 3.5
PATCH 1/1 configure: Require python3 >= 3.5
The oldest python3 version in distros that will be supported by QEMU 4.1 is 3.5.3 (the one in Debian Stretch). Error out if running python3 < 3.5.
We have a .travis.yml job configured to use Python 3.4. Change it to use Python 3.5.
--- configure | 5 +++-- .travis.yml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)
configure +3 -2
@@ -1841,8 +1841,9 @@ fi # Note that if the Python conditional here evaluates True we will exit # with status 1 which is a shell 'false' value. -if ! $python -c 'import sys; sys.exit(sys.version_info < (2,7))'; then - error_exit "Cannot use '$python', Python 2 >= 2.7 or Python 3 is required." \ +if ! $python -c 'import sys; sys.exit(sys.version_info < (2,7) or \ + (3,0) <= sys.version_info < (3,5))'; then + error_exit "Cannot use '$python', Python 2 >= 2.7 or Python 3 >= 3.5 is required." \ "Use --python=/path/to/python to specify a supported Python." fi
.travis.yml +1 -1
@@ -211,7 +211,7 @@ matrix: - CONFIG="--target-list=x86_64-softmmu" language: python python: - - "3.4" + - "3.5" - env:
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
Quoted 18 lines · Eduardo Habkost
The oldest python3 version in distros that will be supported by QEMU 4.1 is 3.5.3 (the one in Debian Stretch). Error out if running python3 < 3.5.
We have a .travis.yml job configured to use Python 3.4. Change it to use Python 3.5.
Signed-off-by Eduardo Habkost <[email protected]>--- configure | 5 +++-- .travis.yml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)configure +0
-0
configure fi · line 1846
Quoted 8 lines
configure +3
-2@@ -1841,8 +1841,9 @@ fi # Note that if the Python conditional here evaluates True we will exit # with status 1 which is a shell 'false' value. -if ! $python -c 'import sys; sys.exit(sys.version_info < (2,7))'; then - error_exit "Cannot use '$python', Python 2 >= 2.7 or Python 3 is required." \ +if ! $python -c 'import sys; sys.exit(sys.version_info < (2,7) or \ + (3,0) <= sys.version_info < (3,5))'; then + error_exit "Cannot use '$python', Python 2 >= 2.7 or Python 3 >= 3.5 is required." \
Nit: There won't be a Python2 > 2.7 anymore, so you could also replace "2 >= 2.7" with "2.7" here. But well, it will go away next year anyway, so:
Quoted 34 lines · Eduardo Habkost
The oldest python3 version in distros that will be supported by QEMU 4.1 is 3.5.3 (the one in Debian Stretch). Error out if running python3 < 3.5.
We have a .travis.yml job configured to use Python 3.4. Change it to use Python 3.5.
Signed-off-by Eduardo Habkost <[email protected]>--- configure | 5 +++-- .travis.yml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)configure +3
-2@@ -1841,8 +1841,9 @@ fi # Note that if the Python conditional here evaluates True we will exit # with status 1 which is a shell 'false' value. -if ! $python -c 'import sys; sys.exit(sys.version_info < (2,7))'; then - error_exit "Cannot use '$python', Python 2 >= 2.7 or Python 3 is required." \ +if ! $python -c 'import sys; sys.exit(sys.version_info < (2,7) or \ + (3,0) <= sys.version_info < (3,5))'; then + error_exit "Cannot use '$python', Python 2 >= 2.7 or Python 3 >= 3.5 is required." \ "Use --python=/path/to/python to specify a supported Python." fi.travis.yml +0
-0
.travis.yml matrix: · line 217
Quoted 8 lines
.travis.yml +1
-1@@ -211,7 +211,7 @@ matrix: - CONFIG="--target-list=x86_64-softmmu" language: python python: - - "3.4" + - "3.5" - env:
Easily missed, good work.
My grep for similar references to Python versions we don't support found a few 2.x, x < 7. Not this patch's problem, of course, but let me show them anyway:
* scripts/qapi/common.py
# re.subn() lacks flags support before Python 2.7, use re.compile()
I'll clean this up.
* tests/image-fuzzer/
docs/image-fuzzer.txt "Fuzzer requirements" item "17. Should be compatible with python version 2.4-2.7".
Stefan, does the fuzzer need porting to Python 3?
Two spots in the code are marked as 2.4 work-arounds:
tests/image-fuzzer/qcow2/fuzz.py: in Python 2.4
tests/image-fuzzer/runner.py: # Python 2.4 doesn't support 'finally' and 'except' in the same 'try'
Grep also found tests/vm/netbsd and tests/vm/openbsd pass --python=python2.7 to configure. Eduardo, should they be upgraded to a suitable version of Python 3? Possibly in your "[PATCH] Deprecate Python 2 support"?
If yes, then https://wiki.qemu.org/Hosts/BSD also needs an update.
Am 09.05.2019 um 07:45 hat Markus Armbruster geschrieben:
Quoted 13 lines
Quoted 12 lines · Eduardo Habkost
.travis.yml +1
-1@@ -211,7 +211,7 @@ matrix: - CONFIG="--target-list=x86_64-softmmu" language: python python: - - "3.4" + - "3.5"
Quoted 7 lines
.travis.yml matrix: · line 217
Quoted 1 line
.travis.yml +0
-0- env:Easily missed, good work.
My grep for similar references to Python versions we don't support found a few 2.x, x < 7. Not this patch's problem, of course, but let me show them anyway:
I'm sure that we have a few more instances of Python 2 compatibility code in qemu-iotests that can be removed after this is merged. These are what I could find quickly, but there are probably more:
242: # Read one byte in a way compatible with Python 2
iotests.py: # Python < 3.4 needs to know not to add whitespace when pretty-printing:
149:from __future__ import print_function 165:from __future__ import print_function iotests.py:from __future__ import print_function nbd-fault-injector.py:from __future__ import print_function qcow2.py:from __future__ import print_function qed.py:from __future__ import print_function
044:if sys.version_info.major == 2:
163:if sys.version_info.major == 2:
iotests.py: if sys.version_info.major >= 3:
iotests.py: if sys.version_info.major >= 3:
nbd-fault-injector.py:if sys.version_info.major >= 3:
I'm planning to take care of the qemu-iotests ones.
Also, with Python 3.5 as the new minimum, I think I'd like to add type hints to iotests.py and possibly the qemu package (for QEMUQtestMachine and friends). The syntax isn't as nice as if we could go straight to 3.6, but still, finally some type checking instead of running into stupid runtime bugs!
Kevin
Am 09.05.2019 um 11:24 hat Kevin Wolf geschrieben:
Quoted 42 lines
Am 09.05.2019 um 07:45 hat Markus Armbruster geschrieben:
Quoted 13 lines
Quoted 12 lines · Eduardo Habkost
.travis.yml +1
-1@@ -211,7 +211,7 @@ matrix: - CONFIG="--target-list=x86_64-softmmu" language: python python: - - "3.4" + - "3.5"Quoted 7 lines
.travis.yml matrix: · line 217
Quoted 1 line
.travis.yml +0
-0- env:Easily missed, good work.
My grep for similar references to Python versions we don't support found a few 2.x, x < 7. Not this patch's problem, of course, but let me show them anyway:
I'm sure that we have a few more instances of Python 2 compatibility code in qemu-iotests that can be removed after this is merged. These are what I could find quickly, but there are probably more:
242: # Read one byte in a way compatible with Python 2
iotests.py: # Python < 3.4 needs to know not to add whitespace when pretty-printing:149:from
__future__importprint_function165:from__future__importprint_functioniotests.py:from__future__importprint_functionnbd-fault-injector.py:from__future__importprint_functionqcow2.py:from__future__importprint_functionqed.py:from__future__importprint_function044:if sys.version_info.major == 2:
163:if sys.version_info.major == 2:
iotests.py: if sys.version_info.major >= 3:
iotests.py: if sys.version_info.major >= 3:
nbd-fault-injector.py:if sys.version_info.major >= 3:
Quoted 7 lines
I'm planning to take care of the qemu-iotests ones.
Also, with Python 3.5 as the new minimum, I think I'd like to add type hints to
iotests.pyand possibly the qemu package (for QEMUQtestMachine and friends). The syntax isn't as nice as if we could go straight to 3.6, but still, finally some type checking instead of running into stupid runtime bugs!
Ah, sorry, I was getting too excited there. We only deprecate 2.x now (and not even in this patch), but don't remove it yet. So I guess this will have to wait until next year.
Kevin
Quoted 51 lines · Kevin Wolf
Am 09.05.2019 um 11:24 hat Kevin Wolf geschrieben:
Quoted 42 lines
Am 09.05.2019 um 07:45 hat Markus Armbruster geschrieben:
Quoted 13 lines
Quoted 12 lines · Eduardo Habkost
.travis.yml +1
-1@@ -211,7 +211,7 @@ matrix: - CONFIG="--target-list=x86_64-softmmu" language: python python: - - "3.4" + - "3.5"Quoted 7 lines
.travis.yml matrix: · line 217
Quoted 1 line
.travis.yml +0
-0- env:Easily missed, good work.
My grep for similar references to Python versions we don't support found a few 2.x, x < 7. Not this patch's problem, of course, but let me show them anyway:
I'm sure that we have a few more instances of Python 2 compatibility code in qemu-iotests that can be removed after this is merged. These are what I could find quickly, but there are probably more:
242: # Read one byte in a way compatible with Python 2
iotests.py: # Python < 3.4 needs to know not to add whitespace when pretty-printing:149:from
__future__importprint_function165:from__future__importprint_functioniotests.py:from__future__importprint_functionnbd-fault-injector.py:from__future__importprint_functionqcow2.py:from__future__importprint_functionqed.py:from__future__importprint_function044:if sys.version_info.major == 2:
163:if sys.version_info.major == 2:
iotests.py: if sys.version_info.major >= 3:
iotests.py: if sys.version_info.major >= 3:
nbd-fault-injector.py:if sys.version_info.major >= 3:Quoted 7 lines
I'm planning to take care of the qemu-iotests ones.
Also, with Python 3.5 as the new minimum, I think I'd like to add type hints to
iotests.pyand possibly the qemu package (for QEMUQtestMachine and friends). The syntax isn't as nice as if we could go straight to 3.6, but still, finally some type checking instead of running into stupid runtime bugs!
Quoted 3 lines
Ah, sorry, I was getting too excited there. We only deprecate 2.x now (and not even in this patch), but don't remove it yet. So I guess this will have to wait until next year.
If you're happy using one of the comment based hinting syntax, that will work, or at least not break, with python 2
https://www.bernat.tech/the-state-of-type-hints-in-python/
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|