Detect veraPDF when version line is preceded by JVM warnings

This commit is contained in:
James R. Barlow
2026-06-30 01:03:02 -07:00
parent efe83e8c54
commit 7512b1042a
2 changed files with 36 additions and 9 deletions
+9 -3
View File
@@ -62,12 +62,18 @@ def get_version(
f"Could not find program '{program}' on the PATH"
) from e
match = re.match(regex, output.strip())
if not match:
# Some tools (e.g. veraPDF launched on a recent JDK) print warnings before
# the version line, so scan each line rather than only the start of output.
version = None
for line in output.splitlines():
match = re.match(regex, line.strip())
if match:
version = match.group(1)
break
if version is None:
raise MissingDependencyError(
f"The program '{program}' did not report its version. "
f"Message was:\n{output}"
)
version = match.group(1)
return version