python-pycdio/tests/scripts/print-iso-volid
Brian C. Lane 64067d247b tests: Add simple test for python-pycdio
This is a simple tmt test demonstrating that the installed library can
be used.

Resolves: RHEL-75941
2025-01-22 16:27:42 -08:00

20 lines
411 B
Python
Executable File

#!/usr/bin/python3
import sys
import iso9660
if len(sys.argv) < 2:
print(f"USAGE: {sys.argv[0]} ISOFILE", file=sys.stderr)
sys.exit(1)
iso = iso9660.ISO9660.IFS(source=sys.argv[1])
if not iso.is_open():
raise RuntimeError(f"error opening file: {sys.argv[1]}")
label = iso.get_volume_id()
if label is None:
raise RuntimeError("error reading volume id")
print(f"LABEL = {label}")
sys.exit(0)