diff options
author | Khem Raj <raj.khem@gmail.com> | 2018-08-08 15:49:13 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-08-14 11:36:31 +0100 |
commit | 13028bd6e60135ae8042022209beeb72f0d6cf09 (patch) | |
tree | 1114daaedb3909cebb596543e04542279219d630 /meta/lib | |
parent | 37c4f89d716478acd10b12e38d9122bef7e7a4bf (diff) | |
download | poky-13028bd6e60135ae8042022209beeb72f0d6cf09.tar.gz |
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
(From OE-Core rev: e763151e1f7cfe9ea56de06f41769f8a3d74d219)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oe/maketype.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/meta/lib/oe/maketype.py b/meta/lib/oe/maketype.py index f88981dd90..c36e7b5604 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. | |||
7 | 7 | ||
8 | import inspect | 8 | import inspect |
9 | import oe.types as types | 9 | import oe.types as types |
10 | import collections | 10 | try: |
11 | # Python 3.7+ | ||
12 | from collections.abc import Callable | ||
13 | except ImportError: | ||
14 | # Python < 3.7 | ||
15 | from collections import Callable | ||
11 | 16 | ||
12 | available_types = {} | 17 | available_types = {} |
13 | 18 | ||
@@ -96,7 +101,7 @@ for name in dir(types): | |||
96 | continue | 101 | continue |
97 | 102 | ||
98 | obj = getattr(types, name) | 103 | obj = getattr(types, name) |
99 | if not isinstance(obj, collections.Callable): | 104 | if not isinstance(obj, Callable): |
100 | continue | 105 | continue |
101 | 106 | ||
102 | register(name, obj) | 107 | register(name, obj) |