summaryrefslogtreecommitdiff
path: root/bitbake/lib/bb/utils.py
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-04-09 19:22:52 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2010-07-02 15:41:32 +0100
commit943ece8610fce9e6e5fda1b524ee479f013e8c5b (patch)
treed39ea721e450f19f029eebb750b91b6cf43ea0e8 /bitbake/lib/bb/utils.py
parent9f2d7d816cfe36d9e3cb895f0bd4e8d81ae3bde0 (diff)
downloadopenembedded-core-943ece8610fce9e6e5fda1b524ee479f013e8c5b.tar.gz
openembedded-core-943ece8610fce9e6e5fda1b524ee479f013e8c5b.tar.bz2
openembedded-core-943ece8610fce9e6e5fda1b524ee479f013e8c5b.tar.xz
openembedded-core-943ece8610fce9e6e5fda1b524ee479f013e8c5b.zip
Implement bb.msg.domain as a named tuple, drop the Enum class
Also fixes some bb.msg references from within bb.msg. (Bitbake rev: db95af590f742c8186e84046ad9704fae1733720) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r--bitbake/lib/bb/utils.py40
1 files changed, 0 insertions, 40 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 83304e4a0..eee97276a 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -371,46 +371,6 @@ def simple_exec(code, context):
def better_eval(source, locals):
return eval(source, _context, locals)
-def Enum(*names):
- """
- A simple class to give Enum support
- """
-
- assert names, "Empty enums are not supported"
-
- class EnumClass(object):
- __slots__ = names
- def __iter__(self): return iter(constants)
- def __len__(self): return len(constants)
- def __getitem__(self, i): return constants[i]
- def __repr__(self): return 'Enum' + str(names)
- def __str__(self): return 'enum ' + str(constants)
-
- class EnumValue(object):
- __slots__ = ('__value')
- def __init__(self, value): self.__value = value
- Value = property(lambda self: self.__value)
- EnumType = property(lambda self: EnumType)
- def __hash__(self): return hash(self.__value)
- def __cmp__(self, other):
- # C fans might want to remove the following assertion
- # to make all enums comparable by ordinal value {;))
- assert self.EnumType is other.EnumType, "Only values from the same enum are comparable"
- return cmp(self.__value, other.__value)
- def __invert__(self): return constants[maximum - self.__value]
- def __nonzero__(self): return bool(self.__value)
- def __repr__(self): return str(names[self.__value])
-
- maximum = len(names) - 1
- constants = [None] * len(names)
- for i, each in enumerate(names):
- val = EnumValue(i)
- setattr(EnumClass, each, val)
- constants[i] = val
- constants = tuple(constants)
- EnumType = EnumClass()
- return EnumType
-
def lockfile(name):
"""
Use the file fn as a lock file, return when the lock has been acquired.