Пример #1
0
def launch_download_daemon(oldpid, env):
    kill_process(oldpid)

    env['DEMOCRACY_DOWNLOADER_LOG'] = app.config.get(prefs.DOWNLOADER_LOG_PATHNAME)
    if bits_32():
        env['VERSIONER_PYTHON_PREFER_32_BIT'] = "yes"
    env["MIRO_APP_VERSION"] = app.config.get(prefs.APP_VERSION)
    env.update(os.environ)

    command_line = _app_command_line()
    launch_path = command_line[0]
    launch_arguments = command_line[1:] + [u'--download-daemon']

    global dlTask
    dlTask = NSTask.alloc().init()
    dlTask.setLaunchPath_(launch_path)
    dlTask.setArguments_(launch_arguments)
    dlTask.setEnvironment_(env)

    controller = NSApplication.sharedApplication().delegate()
    nc = NSNotificationCenter.defaultCenter()
    nc.addObserver_selector_name_object_(controller, 'downloaderDaemonDidTerminate:', NSTaskDidTerminateNotification, dlTask)

    logging.debug('Launching Download Daemon')
    dlTask.launch()
Пример #2
0
def launch_download_daemon(oldpid, env):
    kill_process(oldpid)

    env['DEMOCRACY_DOWNLOADER_LOG'] = app.config.get(
        prefs.DOWNLOADER_LOG_PATHNAME)
    if bits_32():
        env['VERSIONER_PYTHON_PREFER_32_BIT'] = "yes"
    env["MIRO_APP_VERSION"] = app.config.get(prefs.APP_VERSION)
    env.update(os.environ)

    command_line = _app_command_line()
    launch_path = command_line[0]
    launch_arguments = command_line[1:] + [u'--download-daemon']

    global dlTask
    dlTask = NSTask.alloc().init()
    dlTask.setLaunchPath_(launch_path)
    dlTask.setArguments_(launch_arguments)
    dlTask.setEnvironment_(env)

    controller = NSApplication.sharedApplication().delegate()
    nc = NSNotificationCenter.defaultCenter()
    nc.addObserver_selector_name_object_(controller,
                                         'downloaderDaemonDidTerminate:',
                                         NSTaskDidTerminateNotification,
                                         dlTask)

    logging.debug('Launching Download Daemon')
    dlTask.launch()
Пример #3
0
def miro_helper_program_info():
    cmd_line = _app_command_line() + [u'--miro-helper']
    env = {
            'MIRO_APP_VERSION': app.config.get(prefs.APP_VERSION)
    }
    if bits_32():
        env['VERSIONER_PYTHON_PREFER_32_BIT'] = 'yes'
    return cmd_line, env
Пример #4
0
def _app_command_line():
    """Get the command line to lanch the Miro.app bundle. """
    exe = NSBundle.mainBundle().executablePath()

    # If we are running in 32 bit mode we want our spawned stuff to be
    # 32-bit too.  Otherwise we running in the "best" mode so do nothing.
    if bits_32():
        return ['/usr/bin/arch', '-32', exe]
    else:
        return [exe]
Пример #5
0
def _app_command_line():
    """Get the command line to lanch the Miro.app bundle. """
    exe = NSBundle.mainBundle().executablePath()

    # If we are running in 32 bit mode we want our spawned stuff to be
    # 32-bit too.  Otherwise we running in the "best" mode so do nothing.
    if bits_32():
        return ['/usr/bin/arch', '-32', exe]
    else:
        return [exe]
Пример #6
0
def miro_helper_program_info():
    cmd_line = _app_command_line() + [u'--miro-helper']
    env = {'MIRO_APP_VERSION': app.config.get(prefs.APP_VERSION)}
    if bits_32():
        env['VERSIONER_PYTHON_PREFER_32_BIT'] = 'yes'
    return cmd_line, env