Exemple #1
0
 def get_drives():
     """Return a list of drives with their filesystems"""
     lsblk_output = system.read_process_output(["lsblk", "-f", "--json"])
     return [
         drive for drive in json.loads(lsblk_output)["blockdevices"]
         if drive["fstype"] != "squashfs"
     ]
Exemple #2
0
 def get_ldconfig_libs(self):
     """Return a list of available libraries, as returned by `ldconfig -p`."""
     ldconfig = self.get("ldconfig")
     if not ldconfig:
         logger.error("Could not detect ldconfig on this system")
         return []
     output = system.read_process_output([ldconfig, "-p"]).split("\n")
     return [line.strip("\t") for line in output if line.startswith("\t")]
Exemple #3
0
def get_wine_version(wine_path="wine"):
    """Return the version of Wine installed on the system."""
    if wine_path != "wine" and not system.path_exists(wine_path):
        return
    if wine_path == "wine" and not system.find_executable("wine"):
        return
    if os.path.isabs(wine_path):
        wine_stats = os.stat(wine_path)
        if wine_stats.st_size < 2000:
            # This version is a script, ignore it
            return
    version = system.read_process_output([wine_path, "--version"])
    if not version:
        logger.error("Error reading wine version for %s", wine_path)
        return
    if version.startswith("wine-"):
        version = version[5:]
    return version
Exemple #4
0
def _get_vidmodes():
    """Return video modes from XrandR"""
    logger.debug("Retrieving video modes from XrandR")
    return read_process_output([LINUX_SYSTEM.get("xrandr")]).split("\n")
Exemple #5
0
 def get_arch_from_dll(dll_path):
     if "x86-64" in read_process_output(["file", dll_path]):
         return "win64"
     return "win32"
Exemple #6
0
def get_innoextract_list(file_path):
    """Return the list of files contained in a GOG archive"""
    output = system.read_process_output(
        [get_innoextract_path(), "-lmq", file_path])
    return [line[3:] for line in output.split("\n") if line]
Exemple #7
0
 def get_glxinfo_output():
     """Return the glxinfo -B output"""
     return read_process_output(["glxinfo", "-B"])