diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-20 11:57:44 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-06-02 08:24:01 +0100 |
commit | 3b3997174831931ea472167ba6cc854a4972ccce (patch) | |
tree | 861b0bcb54e70fbe59bf7920862954dcec40a1e8 /meta/lib/oe/classutils.py | |
parent | 52c4b7f247618f185a11dfb1cf15d0490d074379 (diff) | |
download | poky-3b3997174831931ea472167ba6cc854a4972ccce.tar.gz |
classes/lib: Complete transition to python3
This patch contains all the other misc pieces of the transition to
python3 which didn't make sense to be broken into individual patches.
(From OE-Core rev: fcd6b38bab8517d83e1ed48eef1bca9a9a190f57)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/classutils.py')
-rw-r--r-- | meta/lib/oe/classutils.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/meta/lib/oe/classutils.py b/meta/lib/oe/classutils.py index 98bb059a71..e7856c86f2 100644 --- a/meta/lib/oe/classutils.py +++ b/meta/lib/oe/classutils.py | |||
@@ -1,4 +1,11 @@ | |||
1 | class ClassRegistry(type): | 1 | |
2 | class ClassRegistryMeta(type): | ||
3 | """Give each ClassRegistry their own registry""" | ||
4 | def __init__(cls, name, bases, attrs): | ||
5 | cls.registry = {} | ||
6 | type.__init__(cls, name, bases, attrs) | ||
7 | |||
8 | class ClassRegistry(type, metaclass=ClassRegistryMeta): | ||
2 | """Maintain a registry of classes, indexed by name. | 9 | """Maintain a registry of classes, indexed by name. |
3 | 10 | ||
4 | Note that this implementation requires that the names be unique, as it uses | 11 | Note that this implementation requires that the names be unique, as it uses |
@@ -12,12 +19,6 @@ Subclasses of ClassRegistry may define an 'implemented' property to exert | |||
12 | control over whether the class will be added to the registry (e.g. to keep | 19 | control over whether the class will be added to the registry (e.g. to keep |
13 | abstract base classes out of the registry).""" | 20 | abstract base classes out of the registry).""" |
14 | priority = 0 | 21 | priority = 0 |
15 | class __metaclass__(type): | ||
16 | """Give each ClassRegistry their own registry""" | ||
17 | def __init__(cls, name, bases, attrs): | ||
18 | cls.registry = {} | ||
19 | type.__init__(cls, name, bases, attrs) | ||
20 | |||
21 | def __init__(cls, name, bases, attrs): | 22 | def __init__(cls, name, bases, attrs): |
22 | super(ClassRegistry, cls).__init__(name, bases, attrs) | 23 | super(ClassRegistry, cls).__init__(name, bases, attrs) |
23 | try: | 24 | try: |