summaryrefslogtreecommitdiff
path: root/oso.py
blob: 2aaee76f533a145aee973030bf6d4a983ed4e576 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os


def start_server(ctx):
    # Declare Subplot library names. In the generated Python program, the
    # libraries will be included and can just be used via names, but to placate
    # automated checks that only see this file, get the names from globals() at
    # runtime.
    daemon_start_on_port = globals()["daemon_start_on_port"]
    runcmd_helper_srcdir_path = globals()["runcmd_helper_srcdir_path"]
    srcdir = globals()["srcdir"]

    # This installs srcdir in $PATH so that we can run the client and server
    # easily.
    runcmd_helper_srcdir_path(ctx)

    # Start server.
    server = os.path.join(srcdir, "server.py")
    daemon_start_on_port(ctx, path=server, args="", name="server", port=5000)


def stop_server(ctx):
    daemon_stop = globals()["daemon_stop"]
    daemon_stop(ctx, name="server")


def answer_is(ctx, index):
    pass