INNER CODE UNIT · Python

owning_package

CyrilPeng/Venera-Next · .github/scripts/appimage_runtime.py:64

def owning_package(source):
    # ldconfig may report /lib aliases on merged-/usr hosts while dpkg records
    # the package's /usr/lib path (or the other way around).
    candidates = [source, source.resolve()]
    for path in list(candidates):
        name = str(path)
        if name.startswith("/usr/lib/"):
            candidates.append(Path(name.removeprefix("/usr")))
        elif name.startswith("/lib/"):
            candidates.append(Path("/usr" + name))
    for path in dict.fromkeys(candidates):
        result = subprocess.run(["dpkg-query", "-S", str(path)], text=True, capture_output=True)
        if result.returncode == 0:
            return result.stdout.splitlines()[0].split(": ", 1)[0]
    raise RuntimeError(f"Cannot identify dependency package for {source}")


def collect_runtime(appdir):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…