Use verified CLI preparations when web PHP cannot execute processes
tests / ci (push) Canceled after 0s
tests / ci (push) Canceled after 0s
This commit is contained in:
@@ -267,7 +267,10 @@ if __name__ == "__main__":
|
||||
cli.add_argument("--baseline-year", type=int)
|
||||
cli.add_argument("--output", required=True)
|
||||
cli.add_argument("--records-output")
|
||||
cli.add_argument("--preparation-receipt")
|
||||
args = cli.parse_args()
|
||||
if args.preparation_receipt and not args.records_output:
|
||||
cli.error('--preparation-receipt requires --records-output')
|
||||
result = parse(args.file, args.baseline_year)
|
||||
if args.records_output:
|
||||
record_path = Path(args.records_output)
|
||||
@@ -276,4 +279,10 @@ if __name__ == "__main__":
|
||||
target.write(json.dumps(record, ensure_ascii=False, separators=(',', ':'))+'\n')
|
||||
result['records_file_sha256'] = hashlib.sha256(record_path.read_bytes()).hexdigest()
|
||||
Path(args.output).write_text(json.dumps(result, ensure_ascii=False, separators=(",", ":")), encoding="utf-8")
|
||||
if args.preparation_receipt:
|
||||
receipt = dict(sha256=result['sha256'], baseline_year=args.baseline_year,
|
||||
parser_sha256=hashlib.sha256(Path(__file__).read_bytes()).hexdigest(),
|
||||
preview_sha256=hashlib.sha256(Path(args.output).read_bytes()).hexdigest(),
|
||||
records_sha256=result['records_file_sha256'], record_count=result['record_count'])
|
||||
Path(args.preparation_receipt).write_text(json.dumps(receipt, separators=(',', ':')), encoding='utf-8')
|
||||
print(json.dumps({k: v for k, v in result.items() if k not in ("records", "issues")}, ensure_ascii=False))
|
||||
|
||||
Reference in New Issue
Block a user