[libvirt] [RFC PATCH v2 8/8] python3: Fix sort function

Andrea Bolognani abologna at redhat.com
Thu Mar 15 16:11:10 UTC 2018

This deals with cls.version possibly being None.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
Really not sure about this one. The script runs all the way to
the end after applying it, so there's that I guess.

 src/hyperv/hyperv_wmi_generator.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/hyperv/hyperv_wmi_generator.py b/src/hyperv/hyperv_wmi_generator.py
index 7dc11ba905..d548102117 100755
--- a/src/hyperv/hyperv_wmi_generator.py
+++ b/src/hyperv/hyperv_wmi_generator.py
@@ -59,7 +59,7 @@ class WmiClass:
         # sort vesioned classes by version in case input file did not have them
         # in order
-        self.versions = sorted(self.versions, key=lambda cls: cls.version)
+        self.versions = sorted(self.versions, key=lambda cls: cls.version or "")
         # if there's more than one verion make sure first one has name suffixed
         # because we'll generate "common" memeber and will be the "base" name

More information about the libvir-list mailing list