Message ID | 20170831142430.16665-4-berrange@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 08/31/2017 09:24 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. Since we're now using argparse.py as a third-party import (commit 47e1cb1f) also for the sake of 2.6, can we treat ordereddict.py as the same sort of third-party import? > > 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 d89af7d6c6..05cb1ee38c 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 d89af7d6c6..05cb1ee38c 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(-)