lib/oe: Fix collections ABCs DeprecationWarning in Python 3.7+

- Prefer collections.abc (new in Python 3.3) over collections for abstract base classes

- In Python 3.8, the abstract base classes in collections.abc will no longer be exposed in
  the regular collections module. This will help create a clearer distinction between
  the concrete classes and the abstract base classes."

- https://docs.python.org/3.7/whatsnew/3.7.html#deprecated

- see c66f9f8d39

(From OE-Core rev: b254ab6ce34da3d3241a51958b5770664d317fcc)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Khem Raj 2018-08-08 15:49:13 -07:00 committed by Richard Purdie
parent 3794496ef7
commit 8dcc23b5cc

View File

@ -7,7 +7,12 @@ the arguments of the type's factory for details.
import inspect
import oe.types as types
import collections
try:
# Python 3.7+
from collections.abc import Callable
except ImportError:
# Python < 3.7
from collections import Callable
available_types = {}
@ -96,7 +101,7 @@ for name in dir(types):
continue
obj = getattr(types, name)
if not isinstance(obj, collections.Callable):
if not isinstance(obj, Callable):
continue
register(name, obj)