Message ID | 20180115102621.9183-4-berrange@redhat.com |
---|---|
State | New |
Headers | show |
Series | Support building with py2 or py3 | expand |
On 01/15/2018 07:26 AM, Daniel P. Berrange wrote: > The OrderedDict class appeared in the 'collections' module > from python 2.7 onwards, so use that in preference to our > local backport if available. > > Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > --- > scripts/qapi.py | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/scripts/qapi.py b/scripts/qapi.py > index 5ef50317ca..7ec2e00b2c 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', >
diff --git a/scripts/qapi.py b/scripts/qapi.py index 5ef50317ca..7ec2e00b2c 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',
The OrderedDict class appeared in the 'collections' module from python 2.7 onwards, so use that in preference to our local backport if available. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- scripts/qapi.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)