libvirt-python: three patches on Makefile, tox.ini, and domstart.py

Hello, I have been using libvirt for some years, and this is my first ever contribution; your feedback is more than welcome. This is a set of patches about changes done in Makefile, tox.ini, and domstart.py. Regards, Ariel

* env variable used to be Python3.6 * Python3.6 is end of life since December 2021 [1]. [1] https://devguide.python.org/versions/ Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr> --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b08e2bd..1cab66c 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ # Shim wrapper around setup.py to allow for familiar build targets PYTHON ?= python +VERSION := $(shell $(PYTHON) -V | perl -nE 'print "$$1$$2" if /\s(\d+)\.(\d+)/') all: $(PYTHON) -m build @@ -12,7 +13,7 @@ clean: rm -rf build/ dist/ check: all - tox -e py36 + tox -e py$(VERSION) test: all tox -- 2.45.2

For repos other than the main 'libvirt' repo, we use merge requests on GitLab. On a Monday in 2024, Ariel Otilibili wrote:
* env variable used to be Python3.6 * Python3.6 is end of life since December 2021 [1].
[1] https://devguide.python.org/versions/
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr> --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile index b08e2bd..1cab66c 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ # Shim wrapper around setup.py to allow for familiar build targets
PYTHON ?= python +VERSION := $(shell $(PYTHON) -V | perl -nE 'print "$$1$$2" if /\s(\d+)\.(\d+)/')
Please, no Makefile-escaped perl. Python should be able to do it too: python -c 'import sys; print("{}{}".format(sys.version_info.major, sys.version_info.minor))'
all: $(PYTHON) -m build @@ -12,7 +13,7 @@ clean: rm -rf build/ dist/
check: all - tox -e py36 + tox -e py$(VERSION)
If I understand correctly, the point of tox is to run the test suite against different Python versions. Having 'py36' hardcoded here made sure it worked against that particular version even if the user has a different version, but I do not understand the benefit of running it against the current version (as opposed to just running pytest directly). Jano
test: all tox -- 2.45.2

Hi Jano, On Tuesday, August 06, 2024 13:00 CEST, Ján Tomko <jtomko@redhat.com> wrote: For repos other than the main 'libvirt' repo, we use merge requests on GitLab. I'll address all your feedback in a PR, later in the day. I used patches because the guidelines advise that (https://libvirt.org/hacking.html) On a Monday in 2024, Ariel Otilibili wrote:
* env variable used to be Python3.6 * Python3.6 is end of life since December 2021 [1].
[1] https://devguide.python.org/versions/
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr> --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile index b08e2bd..1cab66c 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ # Shim wrapper around setup.py to allow for familiar build targets
PYTHON ?= python +VERSION := $(shell $(PYTHON) -V | perl -nE 'print "$$1$$2" if /\s(\d+)\.(\d+)/')
Please, no Makefile-escaped perl. Python should be able to do it too: python -c 'import sys; print("{}{}".format(sys.version_info.major, sys.version_info.minor))' Will change it; I forgot I came across this guideline, https://libvirt.org/programming-languages.html
all: $(PYTHON) -m build @@ -12,7 +13,7 @@ clean: rm -rf build/ dist/
check: all - tox -e py36 + tox -e py$(VERSION)
If I understand correctly, the point of tox is to run the test suite against different Python versions. Having 'py36' hardcoded here made sure it worked against that particular version even if the user has a different version, but I do not understand the benefit of running it against the current version (as opposed to just running pytest directly). My point was to update the version used in this rule; therefore I supposed, if one version were to be used, the latest of the user would make sense. For all the versions used by tox, this patch addresses particularly that: https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/message/VWW7... Ariel Jano
test: all tox -- 2.45.2

* aligned list with supported Python versions [1] * as of today, supported versions are 3.8 to 3.12 https://devguide.python.org/versions/ Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr> --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 3dca5c7..8902423 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py36,py37,py38 +envlist = py38,py39,py310,py311,py312 [testenv] deps= -- 2.45.2

Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr> --- examples/domstart.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/domstart.py b/examples/domstart.py index fdfe25f..9a7d129 100755 --- a/examples/domstart.py +++ b/examples/domstart.py @@ -27,7 +27,7 @@ parser = ArgumentParser(description=__doc__) parser.add_argument("file", metavar="DOMAIN.XML", help="XML configuration of the domain in libvirt's XML format") args = parser.parse_args() -(name, xmldesc) = read_domain(args.file) +name, xmldesc = read_domain(args.file) try: conn = libvirt.open(None) -- 2.45.2
participants (3)
-
Ariel Otilibili
-
Ariel Otilibili-Anieli
-
Ján Tomko