[oe-commits] [openembedded-core] 02/35: lib/oe: Fix collections ABCs DeprecationWarning in Python 3.7+
git at git.openembedded.org
git at git.openembedded.org
Sat Aug 11 10:07:28 UTC 2018
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master-next
in repository openembedded-core.
commit e763151e1f7cfe9ea56de06f41769f8a3d74d219
Author: Khem Raj <raj.khem at gmail.com>
AuthorDate: Wed Aug 8 15:49:13 2018 -0700
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 https://github.com/python/cpython/commit/c66f9f8d3909f588c251957d499599a1680e2320
Signed-off-by: Khem Raj <raj.khem at gmail.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
meta/lib/oe/maketype.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/meta/lib/oe/maketype.py b/meta/lib/oe/maketype.py
index f88981d..c36e7b5 100644
--- a/meta/lib/oe/maketype.py
+++ b/meta/lib/oe/maketype.py
@@ -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)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list