Exemplo n.º 1
0
def run_controller():
    command = [] if is_frozen() else [executable]
    command.append(CONTROLLER)
    fo = open(CONTROLLER_LOG, "at")
    try:
        controller = Popen(command, stdout=fo, stderr=STDOUT, stdin=PIPE)
    except OSError:
        return

    start = time()
    while time() - start < CONTROLLER_STARTUP_TIME:
        try:
            urlopen(BASE_URL)
            return controller
        except IOError:
            sleep(0.1)
Exemplo n.º 2
0
from common import is_frozen

from os.path import join, dirname, abspath
from sys import platform, executable
from os import environ

if is_frozen():
    APPDIR = abspath(dirname(executable))
    CONTROLLER_DIR = GUI_DIR = APPDIR
    CONTROLLER = join(CONTROLLER_DIR, "sauceserver")
    PROXY = join(CONTROLLER_DIR, "sauceproxy")
    TUNNEL = join(CONTROLLER_DIR, "sauce_tunnel")
    if platform == "win32":
        CONTROLLER += ".exe"
        PROXY += ".exe"
        TUNNEL += ".exe"
else:
    APPDIR = abspath(join(dirname(__file__), ".."))
    CONTROLLER_DIR = join(APPDIR, "controller")
    CONTROLLER = join(CONTROLLER_DIR, "server.py")
    PROXY = join(CONTROLLER_DIR, "proxy.py")
    TUNNEL = join(CONTROLLER_DIR, "sauce_tunnel")
    # FIXME: OS X?
    GUI_DIR = join(APPDIR, "win32")

if platform == "win32":
    import win32process
    CREATION_FLAGS = win32process.CREATE_NO_WINDOW
else:
    CREATION_FLAGS = 0