Example #1
0
def get_remote_lib_versions(c: typedict,
                            libs=(
                                "glib",
                                "gobject",
                                "gtk",
                                "gdk",
                                "cairo",
                                "pango",
                                "sound.gst",
                                "sound.pygst",
                                "python",
                            )):
    versions = {}
    for x in libs:
        v = c.get("%s.version" % x, None)
        if v is None:
            #fallback to structured access:
            d = c.get(x, None)
            if isinstance(d, dict):
                v = typedict(d).get("version", None)
        if v:
            if isinstance(v, (tuple, list)):
                v = ".".join(str(p) for p in v)
            versions[x] = bytestostr(v)
    return versions
Example #2
0
 def is_needed(cls, caps: typedict) -> bool:
     #pre 2.3 clients;
     if caps.strget("mmap_file"):
         return True
     v = caps.get("mmap")
     #we should be receiving a dict with mmap attributes
     #(but pre v4 clients also send a boolean telling us if mmap is supported by the platform..)
     return isinstance(v, dict)
Example #3
0
    def parse_server_capabilities(self, c: typedict) -> bool:
        p = self._protocol
        if p.TYPE == "rfb":
            #only the xpra protocol provides the server info
            return True
        self._remote_machine_id = c.strget("machine_id")
        self._remote_uuid = c.strget("uuid")
        self._remote_version = c.strget("build.version", c.strget("version"))
        self._remote_revision = c.strget("build.revision",
                                         c.strget("revision"))
        mods = c.get("build.local_modifications")
        if mods and str(mods).find("dfsg") >= 0:  # pragma: no cover
            get_util_logger().warn(
                "Warning: the xpra server is running a buggy Debian version")
            get_util_logger().warn(
                " those are usually out of date and unstable")
        else:
            self._remote_modifications = c.intget("build.local_modifications",
                                                  0)
        self._remote_commit = c.strget("build.commit")
        self._remote_branch = c.strget("build.branch")
        self._remote_build_date = c.strget("build.date")
        self._remote_build_time = c.strget("build.time")
        self._remote_hostname = c.strget("hostname")
        self._remote_display = c.strget("display")
        self._remote_platform = c.strget("platform")
        self._remote_platform_release = c.strget("platform.release")
        self._remote_platform_platform = c.strget("platform.platform")
        self._remote_python_version = c.strget("python.version")
        self._remote_subcommands = c.strtupleget("subcommands")
        self._remote_server_log = c.strget("server-log")
        self._remote_lib_versions = get_remote_lib_versions(c)
        #linux distribution is a tuple of different types, ie: ('Linux Fedora' , 20, 'Heisenbug')
        pld = c.tupleget("platform.linux_distribution")
        if pld and len(pld) == 3:

            def san(v):
                if isinstance(v, int):
                    return v
                return bytestostr(v)

            self._remote_platform_linux_distribution = [san(x) for x in pld]
        verr = version_compat_check(self._remote_version)
        if verr is not None:
            self.warn_and_quit(
                EXIT_INCOMPATIBLE_VERSION,
                "incompatible remote version '%s': %s" %
                (self._remote_version, verr))
            return False
        return True