#!/usr/bin/env python3
from pathlib import Path
import subprocess, json, sys
REQ={
 'SentinelOS-Dark':'/usr/share/icons/SentinelOS-Dark',
 'SentinelOS-Light':'/usr/share/icons/SentinelOS-Light',
 'SentinelOS-Green':'/usr/share/icons/SentinelOS-Green',
 'SentinelOS-Purple':'/usr/share/icons/SentinelOS-Purple',
 'SentinelOS-Red':'/usr/share/icons/SentinelOS-Red',
}
MAN='/usr/share/sentinelos/theme-base/official-icon-baseline.json'
def pkgver(p):
 r=subprocess.run(['dpkg-query','-W','-f=${Version}',p],text=True,stdout=subprocess.PIPE,stderr=subprocess.DEVNULL)
 return r.stdout.strip() if r.returncode==0 else 'missing'
def summary():
 print('SentinelOS Official Icon Baseline')
 print('version: 0.2.5a')
 print('source_upload: ICONS(1).zip')
 print('policy: official baseline iconset')
 for k,v in REQ.items(): print(f'{k}: {"present" if Path(v).is_dir() else "missing"}')
 for p in ['sentinelos-icon-theme','sentinelos-icon-theme-light','sentinelos-icon-theme-green','sentinelos-icon-theme-purple','sentinelos-icon-theme-red']:
  print(f'{p}: {pkgver(p)}')
def verify():
 ok=True
 for k,v in REQ.items():
  if not Path(v).is_dir(): print(f'missing icon theme: {k}'); ok=False
 if not Path(MAN).exists(): print('missing manifest:',MAN); ok=False
 print('verify: ok' if ok else 'verify: failed')
 return 0 if ok else 1
if '--verify' in sys.argv: sys.exit(verify())
summary()
