self.bb_cache = None
if server:
- self.server = server.BitBakeServer(self, self.pre_serve, self.post_serve)
+ self.server = server.BitBakeServer(self)
self.configuration = configuration
def server_main(cooker, func, *args):
+ cooker.pre_serve()
+
if cooker.configuration.profile:
try:
import cProfile as profile
print("Raw profiling information saved to profile.log and processed statistics to profile.log.processed")
- return ret
else:
- return func(*args)
+ ret = func(*args)
+ cooker.post_serve()
+ return ret
class CookerExit(bb.event.Event):
"""
# remove this when you're done with debugging
# allow_reuse_address = True
- def __init__(self, cooker, pre_serve, post_serve):
+ def __init__(self, cooker):
self._idlefuns = {}
self.commands = BitBakeServerCommands(self, cooker)
- self.pre_serve = pre_serve
- self.post_serve = post_serve
def register_idle_function(self, function, data):
"""Register a function to be called while the server is idle"""
class BitbakeUILauch():
def launch(self, serverinfo, uifunc, *args):
- serverinfo.server.pre_serve()
- ret = bb.cooker.server_main(serverinfo.cooker, uifunc, *args)
- serverinfo.server.post_serve()
- return ret
+ return bb.cooker.server_main(serverinfo.cooker, uifunc, *args)
class BitBakeServerConnection():
def __init__(self, serverinfo):
# remove this when you're done with debugging
# allow_reuse_address = True
- def __init__(self, cooker, pre_serve, post_serve, interface = ("localhost", 0)):
+ def __init__(self, cooker, interface = ("localhost", 0)):
"""
Constructor
"""
commands = BitBakeServerCommands(self, cooker)
self.autoregister_all_functions(commands, "")
self.cooker = cooker
- self.pre_serve = pre_serve
- self.post_serve = post_serve
def autoregister_all_functions(self, context, prefix):
"""
"""
Serve Requests. Overloaded to honor a quit command
"""
- self.pre_serve()
-
self.quit = False
self.timeout = 0 # Run Idle calls for our first callback
while not self.quit:
except:
pass
- self.post_serve()
self.server_close()
return