diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2015-12-31 18:42:13 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-06 15:27:34 +0000 |
commit | 01419d5565a5e3762ec4a2a382f2099683615e52 (patch) | |
tree | 80cfa986d690dcbd6e962ad02f27dc8dd8fcbbf6 /bitbake | |
parent | 763506d49bbc781d0dbb0a7af425d7e77c948248 (diff) | |
download | poky-01419d5565a5e3762ec4a2a382f2099683615e52.tar.gz |
bitbake: cooker: add state.get_name method
Added method to convert state code into the human readable name.
It will be used in logging and error reporting.
(Bitbake rev: 9ec6379b27d210214d0b3f2e55962f721b7f5f51)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 5ceb198c05..edceca00ed 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -67,6 +67,14 @@ class CollectionError(bb.BBHandledException): | |||
67 | class state: | 67 | class state: |
68 | initial, parsing, running, shutdown, forceshutdown, stopped, error = range(7) | 68 | initial, parsing, running, shutdown, forceshutdown, stopped, error = range(7) |
69 | 69 | ||
70 | @classmethod | ||
71 | def get_name(cls, code): | ||
72 | for name in dir(cls): | ||
73 | value = getattr(cls, name) | ||
74 | if type(value) == type(cls.initial) and value == code: | ||
75 | return name | ||
76 | raise ValueError("Invalid status code: %s" % code) | ||
77 | |||
70 | 78 | ||
71 | class SkippedPackage: | 79 | class SkippedPackage: |
72 | def __init__(self, info = None, reason = None): | 80 | def __init__(self, info = None, reason = None): |