@dataclass class Section:
prefix: str
files: list[str]
@dataclass class Manifest:
file: Path
sections: list[Section]
def __str__(self):
res = [f"Source: {self.file}"] for sec in self.sections:
res.append(f" Section: {sec.prefix}") for f in sec.files:
res.append(f" File: {f}") return"\n".join(res)
def parse_section(node: ET.Element) -> Section: assert node.tag == "gresource"
prefix = node.attrib.get("prefix", "/")
files = [] for child in node: if child.tag == "file": if child.text isNone:
error("Invalid file component")
file = child.text
files.append(file) return Section(prefix, files)
def load_manifest(manifest: Path) -> Manifest:
tree = ET.parse(manifest)
root = tree.getroot() if root.tag != "gresources": raise RuntimeError("Invalid manifest file")
sections = [] for node in root: if node.tag == "gresource":
section = parse_section(node)
sections.append(section) return Manifest(manifest, sections)
def check_file(manifest: Manifest, file: Path):
manifest_basedir = manifest.file.parent.name # normalize the absolute path to the location of the manifest
idx = file.parts.index(manifest_basedir)
check = manifest.file.parent.joinpath(*file.parts[idx + 1:]) ifnot check.exists():
error(f"File {file} not found in {basedir}")
check_file = "/".join(file.parts[idx + 1:])
found = False for sect in manifest.sections: for f in sect.files: if f == check_file:
found = True break if found: break ifnot found:
error(f"File {file} not found in the manifest")
def main():
parser = argparse.ArgumentParser()
parser.add_argument("manifest", help="The GResource manifest to check")
parser.add_argument("files", nargs="+", help="The list of files to check")
args = parser.parse_args()
try:
manifest = load_manifest(Path(args.manifest).resolve()) except Exception as err:
error(f"Unable to parse {args.manifest}: {err}")
for file in args.files:
check_file(manifest, Path(file).resolve())
if __name__ == "__main__":
main()
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-07-02)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.