def prompt(user): exit_status = 0 cmd = "" args = [] promt_str = "%s@%s> " % (user.username, config.DISPLAY_HOSTNAME) while cmd not in ("exit", "logout"): try: input_string = raw_input(promt_str) except KeyboardInterrupt: print continue except EOFError: print "exit", return 0 cmd, args = parse_command(input_string) if not cmd: continue user.cmd = cmd user.args = args exit_status = apprunner.run(user) return exit_status
def run(app_name): if not app_name in app_list.keys(): return "App not found", 404 selectedApp = app_list[app_name] compiled = not selectedApp.compiled_successfully if not selectedApp.compiled_successfully: apprunner.stop() if not apprunner.compile(selectedApp): print apprunner.compile_output return get_compiler_json(apprunner.compile_output) apprunner.stop() apprunner.run(selectedApp) if compiled or True: apprunner.save_image(selectedApp.get_image_filename()) return "ok"
def dispatch(): user = tools.get_user() if user.cmd: user.interactive = False return apprunner.run(user) else: user.interactive = True return shell.prompt(user)
from userapp import UserApp import apprunner app = UserApp("TestApp") app.load() app.create_app_interface() if not apprunner.compile(app): print apprunner.compile_output else: apprunner.run(app)
import apprunner import logging import sys import os sys.path.append(os.getcwd()) class Application: async def start(self): print("started") pass async def stop(self): print("stopped") def create_app(): app = Application() return app import sys print(sys.path) if __name__ == "__main__": logging.basicConfig(level=logging.DEBUG) apprunner.run(Application())