7 lines
597 B
Python
7 lines
597 B
Python
from pathlib import Path
|
|
import re,json,hashlib
|
|
out=Path(__file__).resolve().parent;history=[]
|
|
for name in ['BUILD-CANDIDATE.log','BUILD-COMPATIBILITY.log','TYPES-CHECK.log','LINT.log']:
|
|
p=out/name;raw=p.read_bytes();text=raw.decode('utf-16') if raw.startswith(b'\xff\xfe') else raw.decode('utf-8-sig');text=re.sub(r'\x1b\[[0-9;]*[A-Za-z]','',text);history.append({'name':name,'source_sha256':hashlib.sha256(raw).hexdigest(),'normalization':'UTF-8; terminal colour escapes removed'});p.write_text(text,'utf-8')
|
|
(out/'NORMALIZACAO-LOGS.json').write_text(json.dumps(history,indent=2)+'\n','utf-8')
|