From 1e7ec68bbd2dd6887d1ccfe386ac62dc3b17316e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Thu, 18 Apr 2019 10:23:51 +0200 Subject: [PATCH] comps-wrapper: Emit attributes sorted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Python 3.8 no longer sorts attributes automatically, which is causing some of the tests to fail. The easiest fix is to update the code to make sure sorting is in place. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1698514 Signed-off-by: Lubomír Sedlář --- pungi/wrappers/comps.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pungi/wrappers/comps.py b/pungi/wrappers/comps.py index 3c26a566..eabdbf2a 100644 --- a/pungi/wrappers/comps.py +++ b/pungi/wrappers/comps.py @@ -301,9 +301,10 @@ class CompsWrapper(object): for type_name in TYPE_MAPPING.values(): for pkg in sorted(packages_by_type[type_name], key=attrgetter('name')): - node = append(doc, packagelist, "packagereq", pkg.name, type=type_name) + kwargs = {"type": type_name} if type_name == "conditional": - node.setAttribute("requires", pkg.requires) + kwargs["requires"] = pkg.requires + append(doc, packagelist, "packagereq", pkg.name, **kwargs) group_node.appendChild(packagelist) @@ -422,7 +423,7 @@ def append(doc, parent, elem, content=None, lang=None, **kwargs): node.appendChild(doc.createTextNode(content)) if lang: node.setAttribute("xml:lang", lang) - for attr, value in kwargs.items(): + for attr, value in sorted(kwargs.items()): node.setAttribute(attr, value) parent.appendChild(node) return node