diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2016-07-06 12:00:32 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-07-08 09:57:28 +0100 |
commit | 9431a6f318aaeda5f90f44f81a978daf50a76e4e (patch) | |
tree | cbbae6fbee2bcce21032d95680827cdd66a2bd00 | |
parent | 70cc20daef087b2dd1567168c9091be0476fefc8 (diff) | |
download | poky-9431a6f318aaeda5f90f44f81a978daf50a76e4e.tar.gz |
bitbake: eventreplay: replace MockConfigParameters with namedtuple
class MockConfigParameters has only one attribute and only __init__
method. Replacing it with namedtuple makes code less nested and more
readable.
[YOCTO #9585]
(Bitbake rev: 5d4df14b0d38f6c89ca16de6dada58b4bb015d71)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-x | bitbake/bin/toaster-eventreplay | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/bitbake/bin/toaster-eventreplay b/bitbake/bin/toaster-eventreplay index a1072988ac..b9ab79e422 100755 --- a/bitbake/bin/toaster-eventreplay +++ b/bitbake/bin/toaster-eventreplay | |||
@@ -30,6 +30,7 @@ from __future__ import print_function | |||
30 | import os | 30 | import os |
31 | import sys, logging | 31 | import sys, logging |
32 | import codecs | 32 | import codecs |
33 | from collections import namedtuple | ||
33 | 34 | ||
34 | # mangle syspath to allow easy import of modules | 35 | # mangle syspath to allow easy import of modules |
35 | sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), | 36 | sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), |
@@ -159,17 +160,6 @@ class FileReadEventsServerConnection(): | |||
159 | 160 | ||
160 | self.events = FileReadEventsServerConnection.EventReader(self) | 161 | self.events = FileReadEventsServerConnection.EventReader(self) |
161 | 162 | ||
162 | |||
163 | |||
164 | |||
165 | |||
166 | class MockConfigParameters(): | ||
167 | """ stand-in for cookerdata.ConfigParameters; as we don't really config a cooker, this | ||
168 | serves just to supply needed interfaces for the toaster ui to work """ | ||
169 | def __init__(self): | ||
170 | self.observe_only = True # we can only read files | ||
171 | |||
172 | |||
173 | # run toaster ui on our mock bitbake class | 163 | # run toaster ui on our mock bitbake class |
174 | if __name__ == "__main__": | 164 | if __name__ == "__main__": |
175 | if len(sys.argv) < 2: | 165 | if len(sys.argv) < 2: |
@@ -178,7 +168,7 @@ if __name__ == "__main__": | |||
178 | 168 | ||
179 | file_name = sys.argv[-1] | 169 | file_name = sys.argv[-1] |
180 | mock_connection = FileReadEventsServerConnection(file_name) | 170 | mock_connection = FileReadEventsServerConnection(file_name) |
181 | configParams = MockConfigParameters() | 171 | configParams = namedtuple('ConfigParams', ['observe_only'])(True) |
182 | 172 | ||
183 | # run the main program and set exit code to the returned value | 173 | # run the main program and set exit code to the returned value |
184 | sys.exit(toasterui.main(mock_connection.connection, mock_connection.events, configParams)) | 174 | sys.exit(toasterui.main(mock_connection.connection, mock_connection.events, configParams)) |