Example #1
0
def do_get_xpra_command():
    mingw = os.environ.get("MINGW_PREFIX")
    if mingw:
        xpra_script = os.path.join(mingw, "bin", "xpra")
        py = os.path.join(mingw, "bin", "python%i.exe" % sys.version_info[0])
        if os.path.exists(xpra_script) and os.path.exists(py):
            return [py, xpra_script]
    from xpra.platform.paths import default_do_get_xpra_command
    return default_do_get_xpra_command()
Example #2
0
File: paths.py Project: tardyp/Xpra
def do_get_xpra_command():
    from xpra.platform.paths import default_do_get_xpra_command
    d = default_do_get_xpra_command()
    if sys.executable.lower().endswith("xpra_cmd.exe") or sys.executable.lower().endswith("xpra.exe"):
        return [sys.executable]
    mingw = os.environ.get("MINGW_PREFIX")
    if mingw:
        xpra_script = os.path.join(mingw, "bin", "xpra")
        py = os.path.join(mingw, "bin", "python%i.exe" % sys.version_info[0])
        if os.path.exists(xpra_script) and os.path.exists(py):
            return [py, xpra_script]
        elif len(d) == 1:
            if not d[0].lower().endswith(".exe"):
                return [sys.executable, d[0]]
    return d
Example #3
0
def _get_xpra_exe_command(*cmd_options):
    from xpra.platform.paths import get_app_dir
    exe_dir = get_app_dir()
    mingw = os.environ.get("MINGW_PREFIX")
    for cmd in cmd_options:
        exe_name = "%s.exe" % cmd
        if sys.executable.lower().endswith(exe_name):
            #prefer the same executable we were launched from:
            return [sys.executable]
        #try to find it in exe dir:
        exe = os.path.join(exe_dir, exe_name)
        if os.path.exists(exe) and os.path.isfile(exe):
            return [exe]
        #without ".exe" extension:
        script = os.path.join(exe_dir, cmd)
        if os.path.exists(script) and os.path.isfile(script):
            return [script]
        if mingw:
            #the python interpreter to use with the scripts:
            py = os.path.join(mingw, "bin", "python3.exe")
            if os.path.exists(py):
                if cmd.lower() in ("python", "python3"):
                    return [py]
                #ie: /e/Xpra/trunk/src/dist/scripts/xpra
                script = os.path.join(os.getcwd(), "scripts", cmd.lower())
                if os.path.exists(script) and os.path.isfile(script):
                    return [py, script]
                #ie: /mingw64/bin/xpra
                script = os.path.join(mingw, "bin", cmd.lower())
                if os.path.exists(script) and os.path.isfile(script):
                    return [py, script]
    from xpra.platform.paths import default_do_get_xpra_command
    d = default_do_get_xpra_command()
    if len(d) == 1:
        #ie: d="xpra"
        if not d[0].lower().endswith(".exe"):
            return [sys.executable, d[0]]
    return d