コード例 #1
0
ファイル: shell.py プロジェクト: epeli/subssh
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
コード例 #2
0
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"
コード例 #3
0
ファイル: dispatcher.py プロジェクト: epeli/subssh
def dispatch():

    user = tools.get_user()


    if user.cmd:
        user.interactive = False
        return apprunner.run(user)
    else:
        user.interactive = True
        return shell.prompt(user)
コード例 #4
0
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)
コード例 #5
0
ファイル: demo.py プロジェクト: lcgong/apprunner
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())