Skip to contentSkip to conversation

configure: Require Python >= 3.5

PATCH In review Eduardo Habkost 5 participants 11 messages Oct 16, 2019 – Oct 18, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configure: Require Python >= 3.5

Python 3.5 is the oldest Python version available on our supported build platforms, and Python 2 end of life will be 3 weeks after the planned release date of QEMU 4.2.0. Drop Python 2 support from configure completely, and require Python 3.5 or newer.

---
 configure              | 18 ++++--------------
 tests/Makefile.include |  5 -----
 2 files changed, 4 insertions(+), 19 deletions(-)
configure +4 -14
index 08ca4bcb46..870657ec7b 100755
@@ -895,9 +895,9 @@ fi
 : ${install=${INSTALL-install}}
 # We prefer python 3.x. A bare 'python' is traditionally
 # python 2.x, but some distros have it as python 3.x, so
-# we check that before python2
+# we check that too
 python=
-for binary in "${PYTHON-python3}" python python2
+for binary in "${PYTHON-python3}" python
 do
     if has "$binary"
     then
@@ -1824,8 +1824,8 @@ 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 < (3,5))'; then
+  error_exit "Cannot use '$python', Python >= 3.5 is required." \
       "Use --python=/path/to/python to specify a supported Python."
 fi
 
@@ -6456,15 +6456,6 @@ if test "$supported_os" = "no"; then
     echo "us upstream at [email protected]."
 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 < (3,0))'; then
-  echo
-  echo "warning: Python 2 support is deprecated" >&2
-  echo "warning: Python 3 will be required for building future versions of QEMU" >&2
-  python2="y"
-fi
-
 config_host_mak="config-host.mak"
 
 echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
@@ -7282,7 +7273,6 @@ echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
 echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
 echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
 echo "PYTHON=$python" >> $config_host_mak
-echo "PYTHON2=$python2" >> $config_host_mak
 echo "CC=$cc" >> $config_host_mak
 if $iasl -h > /dev/null 2>&1; then
   echo "IASL=$iasl" >> $config_host_mak
tests/Makefile.include +0 -5
index 3543451ed3..54ee1f0a2f 100644
@@ -1137,7 +1137,6 @@ TESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results
 AVOCADO_SHOW=app
 AVOCADO_TAGS=$(patsubst %-softmmu,-t arch:%, $(filter %-softmmu,$(TARGET_DIRS)))
 
-ifneq ($(PYTHON2),y)
 $(TESTS_VENV_DIR): $(TESTS_VENV_REQ)
 	$(call quiet-command, \
             $(PYTHON) -m venv --system-site-packages $@, \
@@ -1146,10 +1145,6 @@ $(TESTS_VENV_DIR): $(TESTS_VENV_REQ)
             $(TESTS_VENV_DIR)/bin/python -m pip -q install -r $(TESTS_VENV_REQ), \
             PIP, $(TESTS_VENV_REQ))
 	$(call quiet-command, touch $@)
-else
-$(TESTS_VENV_DIR):
-	$(error "venv directory for tests requires Python 3")
-endif
 
 $(TESTS_RESULTS_DIR):
 	$(call quiet-command, mkdir -p $@, \
Signature · 1 line
2.21.0
#1 lore raw
Quoted 7 lines · Eduardo Habkost

Python 3.5 is the oldest Python version available on our supported build platforms, and Python 2 end of life will be 3 weeks after the planned release date of QEMU 4.2.0. Drop Python 2 support from configure completely, and require Python 3.5 or newer.

Seems like a good time and place to mention this. Kevin, you require 3.6+ for iotests, which are -- at present -- invoked as part of "make check".

Do we care? Basically, this just means that iotests won't run for systems that don't have 3.6+, which would be platforms like Debian 9 -- which is why ehabkost is choosing 3.5 here.

--js

Quoted 80 lines
---
 configure              | 18 ++++--------------
 tests/Makefile.include |  5 -----
 2 files changed, 4 insertions(+), 19 deletions(-)
configure +4 -14
index 08ca4bcb46..870657ec7b 100755
@@ -895,9 +895,9 @@ fi
 : ${install=${INSTALL-install}}
 # We prefer python 3.x. A bare 'python' is traditionally
 # python 2.x, but some distros have it as python 3.x, so
-# we check that before python2
+# we check that too
 python=
-for binary in "${PYTHON-python3}" python python2
+for binary in "${PYTHON-python3}" python
 do
     if has "$binary"
     then
@@ -1824,8 +1824,8 @@ 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 < (3,5))'; then
+  error_exit "Cannot use '$python', Python >= 3.5 is required." \
       "Use --python=/path/to/python to specify a supported Python."
 fi
 
@@ -6456,15 +6456,6 @@ if test "$supported_os" = "no"; then
     echo "us upstream at [email protected]."
 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 < (3,0))'; then
-  echo
-  echo "warning: Python 2 support is deprecated" >&2
-  echo "warning: Python 3 will be required for building future versions of QEMU" >&2
-  python2="y"
-fi
-
 config_host_mak="config-host.mak"
 
 echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
@@ -7282,7 +7273,6 @@ echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
 echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
 echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
 echo "PYTHON=$python" >> $config_host_mak
-echo "PYTHON2=$python2" >> $config_host_mak
 echo "CC=$cc" >> $config_host_mak
 if $iasl -h > /dev/null 2>&1; then
   echo "IASL=$iasl" >> $config_host_mak
tests/Makefile.include +0 -5
index 3543451ed3..54ee1f0a2f 100644
@@ -1137,7 +1137,6 @@ TESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results
 AVOCADO_SHOW=app
 AVOCADO_TAGS=$(patsubst %-softmmu,-t arch:%, $(filter %-softmmu,$(TARGET_DIRS)))
 
-ifneq ($(PYTHON2),y)
 $(TESTS_VENV_DIR): $(TESTS_VENV_REQ)
 	$(call quiet-command, \
             $(PYTHON) -m venv --system-site-packages $@, \
@@ -1146,10 +1145,6 @@ $(TESTS_VENV_DIR): $(TESTS_VENV_REQ)
             $(TESTS_VENV_DIR)/bin/python -m pip -q install -r $(TESTS_VENV_REQ), \
             PIP, $(TESTS_VENV_REQ))
 	$(call quiet-command, touch $@)
-else
-$(TESTS_VENV_DIR):
-	$(error "venv directory for tests requires Python 3")
-endif
 
 $(TESTS_RESULTS_DIR):
 	$(call quiet-command, mkdir -p $@, \
#2 lore raw
Quoted 11 lines · John Snow
Quoted 7 lines · Eduardo Habkost

Python 3.5 is the oldest Python version available on our supported build platforms, and Python 2 end of life will be 3 weeks after the planned release date of QEMU 4.2.0. Drop Python 2 support from configure completely, and require Python 3.5 or newer.

Quoted 7 lines

Seems like a good time and place to mention this. Kevin, you require 3.6+ for iotests, which are -- at present -- invoked as part of "make check".

Do we care? Basically, this just means that iotests won't run for systems that don't have 3.6+, which would be platforms like Debian 9 -- which is why ehabkost is choosing 3.5 here.

I think it's ok to simply skip the iotests in case we run on a Python 3.5 system.

Thomas

#3 lore raw
In reply to John Snow
Quoted 11 lines · John Snow
Quoted 7 lines · Eduardo Habkost

Python 3.5 is the oldest Python version available on our supported build platforms, and Python 2 end of life will be 3 weeks after the planned release date of QEMU 4.2.0. Drop Python 2 support from configure completely, and require Python 3.5 or newer.

Quoted 7 lines

Seems like a good time and place to mention this. Kevin, you require 3.6+ for iotests, which are -- at present -- invoked as part of "make check".

Do we care? Basically, this just means that iotests won't run for systems that don't have 3.6+, which would be platforms like Debian 9 -- which is why ehabkost is choosing 3.5 here.

Depends what the reason for pickin 3.6 was ? Is it really compelling for iotests to require 3.6, or is it easy to support 3.5. I think in general it is desirable to have a consistent story across the codebase for min versions

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 :|
#4 lore raw
In reply to John Snow

Am 17.10.2019 um 00:48 hat John Snow geschrieben:

Quoted 11 lines · Eduardo Habkost
Quoted 7 lines

Python 3.5 is the oldest Python version available on our supported build platforms, and Python 2 end of life will be 3 weeks after the planned release date of QEMU 4.2.0. Drop Python 2 support from configure completely, and require Python 3.5 or newer.

Quoted 7 lines

Seems like a good time and place to mention this. Kevin, you require 3.6+ for iotests, which are -- at present -- invoked as part of "make check".

Do we care? Basically, this just means that iotests won't run for systems that don't have 3.6+, which would be platforms like Debian 9 -- which is why ehabkost is choosing 3.5 here.

I think we were aware of this when we made the change to iotests. That all tests of the current upstream QEMU version are run on Debian oldstable (with the distro Python version) is, to say the least, not a priority for me. They must not fail, but I'd say skipping is fine.

And actually, we should still have a reasonable coverage there with the shell-based test cases.

Kevin

#5 lore raw
Quoted 25 lines · Kevin Wolf

Am 17.10.2019 um 00:48 hat John Snow geschrieben:

Quoted 11 lines · Eduardo Habkost
Quoted 7 lines

Python 3.5 is the oldest Python version available on our supported build platforms, and Python 2 end of life will be 3 weeks after the planned release date of QEMU 4.2.0. Drop Python 2 support from configure completely, and require Python 3.5 or newer.

Quoted 7 lines

Seems like a good time and place to mention this. Kevin, you require 3.6+ for iotests, which are -- at present -- invoked as part of "make check".

Do we care? Basically, this just means that iotests won't run for systems that don't have 3.6+, which would be platforms like Debian 9 -- which is why ehabkost is choosing 3.5 here.

I think we were aware of this when we made the change to iotests. That all tests of the current upstream QEMU version are run on Debian oldstable (with the distro Python version) is, to say the least, not a priority for me. They must not fail, but I'd say skipping is fine.

Quoted 5 lines

And actually, we should still have a reasonable coverage there with the shell-based test cases.

Kevin

This seems like a weirdly arbitrary decision for a benefit that's not clear to me. Is it because you want variable annotations?

(Well, regardless, you're the ranger in charge of this forest.)

#6 lore raw

Am 17.10.2019 um 21:39 hat John Snow geschrieben:

Quoted 24 lines · Kevin Wolf
Quoted 23 lines

Am 17.10.2019 um 00:48 hat John Snow geschrieben:

Quoted 9 lines · Eduardo Habkost
Quoted 7 lines

Python 3.5 is the oldest Python version available on our supported build platforms, and Python 2 end of life will be 3 weeks after the planned release date of QEMU 4.2.0. Drop Python 2 support from configure completely, and require Python 3.5 or newer.

Quoted 7 lines

Seems like a good time and place to mention this. Kevin, you require 3.6+ for iotests, which are -- at present -- invoked as part of "make check".

Do we care? Basically, this just means that iotests won't run for systems that don't have 3.6+, which would be platforms like Debian 9 -- which is why ehabkost is choosing 3.5 here.

I think we were aware of this when we made the change to iotests. That all tests of the current upstream QEMU version are run on Debian oldstable (with the distro Python version) is, to say the least, not a priority for me. They must not fail, but I'd say skipping is fine.

Quoted 5 lines
Quoted 2 lines

And actually, we should still have a reasonable coverage there with the shell-based test cases.

This seems like a weirdly arbitrary decision for a benefit that's not clear to me. Is it because you want variable annotations?

Yes, the discussion about type annotations is what made me check whether we could do 3.6, because if we want to make use of type checking, we'll need it for both functions and variables to get reasonable results.

And actually, we currently don't have any Python tests in the auto group, so the only effect is for people manually running ./check on Debian oldstable. I'm not sure, but I suspect this might be the empty set.

Kevin

#7 lore raw
Quoted 35 lines · Kevin Wolf

Am 17.10.2019 um 21:39 hat John Snow geschrieben:

Quoted 24 lines · Kevin Wolf
Quoted 23 lines

Am 17.10.2019 um 00:48 hat John Snow geschrieben:

Quoted 9 lines · Eduardo Habkost
Quoted 7 lines

Python 3.5 is the oldest Python version available on our supported build platforms, and Python 2 end of life will be 3 weeks after the planned release date of QEMU 4.2.0. Drop Python 2 support from configure completely, and require Python 3.5 or newer.

Quoted 7 lines

Seems like a good time and place to mention this. Kevin, you require 3.6+ for iotests, which are -- at present -- invoked as part of "make check".

Do we care? Basically, this just means that iotests won't run for systems that don't have 3.6+, which would be platforms like Debian 9 -- which is why ehabkost is choosing 3.5 here.

I think we were aware of this when we made the change to iotests. That all tests of the current upstream QEMU version are run on Debian oldstable (with the distro Python version) is, to say the least, not a priority for me. They must not fail, but I'd say skipping is fine.

Quoted 5 lines
Quoted 2 lines

And actually, we should still have a reasonable coverage there with the shell-based test cases.

This seems like a weirdly arbitrary decision for a benefit that's not clear to me. Is it because you want variable annotations?

Yes, the discussion about type annotations is what made me check whether we could do 3.6, because if we want to make use of type checking, we'll need it for both functions and variables to get reasonable results.

Quoted 7 lines

And actually, we currently don't have any Python tests in the auto group, so the only effect is for people manually running ./check on Debian oldstable. I'm not sure, but I suspect this might be the empty set.

Kevin

It would have an effect on `make docker-test-block@debian-amd64" I think, but I guess nobody runs that right now.

Well, alright.

--js

Reviewed-by on v1 1/1
#8 lore raw
In reply to Eduardo Habkost
Quoted 6 lines · Eduardo Habkost

Python 3.5 is the oldest Python version available on our supported build platforms, and Python 2 end of life will be 3 weeks after the planned release date of QEMU 4.2.0. Drop Python 2 support from configure completely, and require Python 3.5 or newer.

Which distributions constrain us to 3.5 right now? I know Debian9 is one of them, but I'm not sure what others exist.

I know I went through and checked a month ago, but I'm very smart and didn't write it down.

It might be nice to document (somewhere) so we know when we can require something newer than 3.5 at the next major deprecation event.

Quoted 1 line

Thanks!

Quoted 80 lines
---
 configure              | 18 ++++--------------
 tests/Makefile.include |  5 -----
 2 files changed, 4 insertions(+), 19 deletions(-)
configure +4 -14
index 08ca4bcb46..870657ec7b 100755
@@ -895,9 +895,9 @@ fi
 : ${install=${INSTALL-install}}
 # We prefer python 3.x. A bare 'python' is traditionally
 # python 2.x, but some distros have it as python 3.x, so
-# we check that before python2
+# we check that too
 python=
-for binary in "${PYTHON-python3}" python python2
+for binary in "${PYTHON-python3}" python
 do
     if has "$binary"
     then
@@ -1824,8 +1824,8 @@ 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 < (3,5))'; then
+  error_exit "Cannot use '$python', Python >= 3.5 is required." \
       "Use --python=/path/to/python to specify a supported Python."
 fi
 
@@ -6456,15 +6456,6 @@ if test "$supported_os" = "no"; then
     echo "us upstream at [email protected]."
 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 < (3,0))'; then
-  echo
-  echo "warning: Python 2 support is deprecated" >&2
-  echo "warning: Python 3 will be required for building future versions of QEMU" >&2
-  python2="y"
-fi
-
 config_host_mak="config-host.mak"
 
 echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
@@ -7282,7 +7273,6 @@ echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
 echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
 echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
 echo "PYTHON=$python" >> $config_host_mak
-echo "PYTHON2=$python2" >> $config_host_mak
 echo "CC=$cc" >> $config_host_mak
 if $iasl -h > /dev/null 2>&1; then
   echo "IASL=$iasl" >> $config_host_mak
tests/Makefile.include +0 -5
index 3543451ed3..54ee1f0a2f 100644
@@ -1137,7 +1137,6 @@ TESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results
 AVOCADO_SHOW=app
 AVOCADO_TAGS=$(patsubst %-softmmu,-t arch:%, $(filter %-softmmu,$(TARGET_DIRS)))
 
-ifneq ($(PYTHON2),y)
 $(TESTS_VENV_DIR): $(TESTS_VENV_REQ)
 	$(call quiet-command, \
             $(PYTHON) -m venv --system-site-packages $@, \
@@ -1146,10 +1145,6 @@ $(TESTS_VENV_DIR): $(TESTS_VENV_REQ)
             $(TESTS_VENV_DIR)/bin/python -m pip -q install -r $(TESTS_VENV_REQ), \
             PIP, $(TESTS_VENV_REQ))
 	$(call quiet-command, touch $@)
-else
-$(TESTS_VENV_DIR):
-	$(error "venv directory for tests requires Python 3")
-endif
 
 $(TESTS_RESULTS_DIR):
 	$(call quiet-command, mkdir -p $@, \
#9 lore raw
Quoted 10 lines · John Snow
Quoted 6 lines · Eduardo Habkost

Python 3.5 is the oldest Python version available on our supported build platforms, and Python 2 end of life will be 3 weeks after the planned release date of QEMU 4.2.0. Drop Python 2 support from configure completely, and require Python 3.5 or newer.

Quoted 8 lines

Which distributions constrain us to 3.5 right now? I know Debian9 is one of them, but I'm not sure what others exist.

I know I went through and checked a month ago, but I'm very smart and didn't write it down.

It might be nice to document (somewhere) so we know when we can require something newer than 3.5 at the next major deprecation event.

I've summarized the release dates and Python version information I could find here: https://wiki.qemu.org/Supported_Build_Platforms

Quoted 5 lines
Quoted 2 lines

Thanks!

Signature · 1 line
Eduardo
#10 lore raw
Quoted 14 lines · Eduardo Habkost
Quoted 13 lines · John Snow
Quoted 6 lines · Eduardo Habkost

Python 3.5 is the oldest Python version available on our supported build platforms, and Python 2 end of life will be 3 weeks after the planned release date of QEMU 4.2.0. Drop Python 2 support from configure completely, and require Python 3.5 or newer.

Which distributions constrain us to 3.5 right now? I know Debian9 is one of them, but I'm not sure what others exist.

Quoted 9 lines
Quoted 5 lines

I know I went through and checked a month ago, but I'm very smart and didn't write it down.

It might be nice to document (somewhere) so we know when we can require something newer than 3.5 at the next major deprecation event.

I've summarized the release dates and Python version information I could find here: https://wiki.qemu.org/Supported_Build_Platforms

You are an ABSOLUTE CHAMPION. Thank you so much!