You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
676 B
Python
25 lines
676 B
Python
#!/usr/bin/env python3
|
|
|
|
from os import system
|
|
import xml.etree.ElementTree as ET
|
|
import pathlib
|
|
|
|
def _colorize(color, *a, **kwa):
|
|
system(f'tput setaf {color}')
|
|
print(*a, **kwa)
|
|
system('tput sgr0')
|
|
|
|
def green(*a, **kwa): return _colorize(2, *a, **kwa)
|
|
def red(*a, **kwa): return _colorize(1, *a, **kwa)
|
|
|
|
root = ET.parse('verapdf_report.xml').getroot()
|
|
for job in root.findall('./jobs/job'):
|
|
file = job.find('./item/name').text
|
|
file = pathlib.Path(file).name
|
|
result = job.find('./validationReport')
|
|
ok = result.attrib[r'isCompliant'] == 'true'
|
|
resstr = result.attrib[r'statement']
|
|
print(f'{file}: ', end='', flush=True)
|
|
display = green if ok else red
|
|
display(resstr)
|