SHA256
1
0
forked from pool/qemu
qemu/0035-qapi-Use-OrderedDict-from-standard-.patch
Bruce Rogers bd7e079f56 Accepting request 569754 from home:bfrogers:branches:Virtualization
Hopefully we're at least close to the right stuff for handling python2 vs python3 right with these changes.

OBS-URL: https://build.opensuse.org/request/show/569754
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=384
2018-01-25 23:50:30 +00:00

35 lines
1.0 KiB
Diff

From 020f50663afabc52c305a3956def8c94af7b5531 Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <berrange@redhat.com>
Date: Mon, 15 Jan 2018 17:39:47 -0700
Subject: [PATCH] qapi: Use OrderedDict from standard library if available
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The OrderedDict class appeared in the 'collections' module
from python 2.7 onwards, so use that in preference to our
local backport if available.
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
scripts/qapi.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/scripts/qapi.py b/scripts/qapi.py
index d5ac21ad35..dba6cd6779 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -18,7 +18,10 @@ import os
import re
import string
import sys
-from ordereddict import OrderedDict
+try:
+ from collections import OrderedDict
+except:
+ from ordereddict import OrderedDict
builtin_types = {
'null': 'QTYPE_QNULL',