summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-12-09 14:05:22 -0500
committerRichard Purdie <rpurdie@linux.intel.com>2011-01-04 14:46:47 +0000
commitc8d2dad04960746d38d28bb2c5aba8363534541a (patch)
tree1871652c0d8d52ad23d216db0da03392b276c11d
parent72c6953488149f1c1fe93a1191f5aa88e6f128de (diff)
downloadpoky-c8d2dad04960746d38d28bb2c5aba8363534541a.tar.gz
Rename the ui 'init' method to 'main'
As these may run the UI in a blocking fashion and then return the exit code, 'init' was an inappropriate name, and 'main' is more appropriate. (Bitbake rev: 4d081a0ed759bd526ab01849d650bd9e8d80ddd1) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
-rwxr-xr-xbitbake/bin/bitbake21
-rw-r--r--bitbake/lib/bb/ui/depexp.py2
-rw-r--r--bitbake/lib/bb/ui/goggle.py2
-rw-r--r--bitbake/lib/bb/ui/knotty.py2
-rw-r--r--bitbake/lib/bb/ui/ncurses.py2
-rw-r--r--bitbake/lib/bb/ui/puccho.py2
6 files changed, 10 insertions, 21 deletions
diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake
index 1dbaf96b41..51cb87e285 100755
--- a/bitbake/bin/bitbake
+++ b/bitbake/bin/bitbake
@@ -46,9 +46,6 @@ __version__ = "1.11.0"
46logger = logging.getLogger("BitBake") 46logger = logging.getLogger("BitBake")
47 47
48 48
49#============================================================================#
50# BBOptions
51#============================================================================#
52class BBConfiguration(object): 49class BBConfiguration(object):
53 """ 50 """
54 Manages build options and configurations for one run 51 Manages build options and configurations for one run
@@ -89,13 +86,8 @@ warnings.filterwarnings("ignore", category=PendingDeprecationWarning)
89warnings.filterwarnings("ignore", category=ImportWarning) 86warnings.filterwarnings("ignore", category=ImportWarning)
90warnings.filterwarnings("ignore", category=DeprecationWarning, module="<string>$") 87warnings.filterwarnings("ignore", category=DeprecationWarning, module="<string>$")
91 88
92#============================================================================#
93# main
94#============================================================================#
95 89
96def main(): 90def main():
97 return_value = 1
98
99 parser = optparse.OptionParser( 91 parser = optparse.OptionParser(
100 version = "BitBake Build Tool Core version %s, %%prog version %s" % (bb.__version__, __version__), 92 version = "BitBake Build Tool Core version %s, %%prog version %s" % (bb.__version__, __version__),
101 usage = """%prog [options] [package ...] 93 usage = """%prog [options] [package ...]
@@ -190,7 +182,6 @@ Default BBFILES are the .bb files in the current directory.""")
190 bb.utils.clean_environment() 182 bb.utils.clean_environment()
191 183
192 cooker = bb.cooker.BBCooker(configuration, server) 184 cooker = bb.cooker.BBCooker(configuration, server)
193
194 cooker.parseCommandLine() 185 cooker.parseCommandLine()
195 186
196 serverinfo = server.BitbakeServerInfo(cooker.server) 187 serverinfo = server.BitbakeServerInfo(cooker.server)
@@ -201,7 +192,7 @@ Default BBFILES are the .bb files in the current directory.""")
201 logger.removeHandler(loghandler) 192 logger.removeHandler(loghandler)
202 193
203 # Setup a connection to the server (cooker) 194 # Setup a connection to the server (cooker)
204 serverConnection = server.BitBakeServerConnection(serverinfo) 195 server_connection = server.BitBakeServerConnection(serverinfo)
205 196
206 # Launch the UI 197 # Launch the UI
207 if configuration.ui: 198 if configuration.ui:
@@ -214,17 +205,15 @@ Default BBFILES are the .bb files in the current directory.""")
214 # Dynamically load the UI based on the ui name. Although we 205 # Dynamically load the UI based on the ui name. Although we
215 # suggest a fixed set this allows you to have flexibility in which 206 # suggest a fixed set this allows you to have flexibility in which
216 # ones are available. 207 # ones are available.
217 uimodule = __import__("bb.ui", fromlist = [ui]) 208 module = __import__("bb.ui", fromlist = [ui])
218 ui_init = getattr(uimodule, ui).init 209 ui_main = getattr(module, ui).main
219 except AttributeError: 210 except AttributeError:
220 print("FATAL: Invalid user interface '%s' specified. " % ui) 211 print("FATAL: Invalid user interface '%s' specified. " % ui)
221 print("Valid interfaces are 'ncurses', 'depexp' or the default, 'knotty'.") 212 print("Valid interfaces are 'ncurses', 'depexp' or the default, 'knotty'.")
222 else: 213 else:
223 return_value = server.BitbakeUILauch().launch(serverinfo, ui_init, serverConnection.connection, serverConnection.events) 214 return server.BitbakeUILauch().launch(serverinfo, ui_main, server_connection.connection, server_connection.events)
224 finally: 215 finally:
225 serverConnection.terminate() 216 server_connection.terminate()
226
227 return return_value
228 217
229if __name__ == "__main__": 218if __name__ == "__main__":
230 ret = main() 219 ret = main()
diff --git a/bitbake/lib/bb/ui/depexp.py b/bitbake/lib/bb/ui/depexp.py
index 155a892f9f..31004db44a 100644
--- a/bitbake/lib/bb/ui/depexp.py
+++ b/bitbake/lib/bb/ui/depexp.py
@@ -185,7 +185,7 @@ class gtkthread(threading.Thread):
185 gtk.main() 185 gtk.main()
186 gtkthread.quit.set() 186 gtkthread.quit.set()
187 187
188def init(server, eventHandler): 188def main(server, eventHandler):
189 189
190 try: 190 try:
191 cmdline = server.runCommand(["getCmdLineAction"]) 191 cmdline = server.runCommand(["getCmdLineAction"])
diff --git a/bitbake/lib/bb/ui/goggle.py b/bitbake/lib/bb/ui/goggle.py
index 858ca14c45..40923ba88d 100644
--- a/bitbake/lib/bb/ui/goggle.py
+++ b/bitbake/lib/bb/ui/goggle.py
@@ -49,7 +49,7 @@ class MainWindow (gtk.Window):
49 self.set_default_size(640, 480) 49 self.set_default_size(640, 480)
50 scrolled_window.add (self.cur_build_tv) 50 scrolled_window.add (self.cur_build_tv)
51 51
52def init (server, eventHandler): 52def main (server, eventHandler):
53 gobject.threads_init() 53 gobject.threads_init()
54 gtk.gdk.threads_init() 54 gtk.gdk.threads_init()
55 55
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 21160bff5f..9385883ea9 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -66,7 +66,7 @@ class BBLogFormatter(logging.Formatter):
66 else: 66 else:
67 return logging.Formatter.format(self, record) 67 return logging.Formatter.format(self, record)
68 68
69def init(server, eventHandler): 69def main(server, eventHandler):
70 70
71 # Get values of variables which control our output 71 # Get values of variables which control our output
72 includelogs = server.runCommand(["getVariable", "BBINCLUDELOGS"]) 72 includelogs = server.runCommand(["getVariable", "BBINCLUDELOGS"])
diff --git a/bitbake/lib/bb/ui/ncurses.py b/bitbake/lib/bb/ui/ncurses.py
index 3fed4c58a8..3bc8373964 100644
--- a/bitbake/lib/bb/ui/ncurses.py
+++ b/bitbake/lib/bb/ui/ncurses.py
@@ -324,7 +324,7 @@ class NCursesUI:
324 shutdown = shutdown + 1 324 shutdown = shutdown + 1
325 pass 325 pass
326 326
327def init(server, eventHandler): 327def main(server, eventHandler):
328 if not os.isatty(sys.stdout.fileno()): 328 if not os.isatty(sys.stdout.fileno()):
329 print("FATAL: Unable to run 'ncurses' UI without a TTY.") 329 print("FATAL: Unable to run 'ncurses' UI without a TTY.")
330 return 330 return
diff --git a/bitbake/lib/bb/ui/puccho.py b/bitbake/lib/bb/ui/puccho.py
index a627fc803f..3ce4590c16 100644
--- a/bitbake/lib/bb/ui/puccho.py
+++ b/bitbake/lib/bb/ui/puccho.py
@@ -390,7 +390,7 @@ def running_build_failed_cb (running_build, manager):
390 print("build failed") 390 print("build failed")
391 manager.notify_build_failed () 391 manager.notify_build_failed ()
392 392
393def init (server, eventHandler): 393def main (server, eventHandler):
394 # Initialise threading... 394 # Initialise threading...
395 gobject.threads_init() 395 gobject.threads_init()
396 gtk.gdk.threads_init() 396 gtk.gdk.threads_init()