43 lines
1.6 KiB
Python
43 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
|
"""Compare one base Config SQL payload with XML files.
|
|
|
|
This is the base-configuration counterpart to extension manifest part analysis.
|
|
It uses the same mechanical payload parser and XML matching logic.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import json
|
|
from pathlib import Path
|
|
|
|
from analyze_1c_manifest_object_parts import load_xml_files, parse_cas_payload, public_payload_report
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser(description="Compare one Config object payload with XML files.")
|
|
parser.add_argument("--config-file", type=Path, required=True)
|
|
parser.add_argument("--object-guid", required=True)
|
|
parser.add_argument("--xml-path", type=Path, action="append", default=[])
|
|
parser.add_argument("--output", type=Path, required=True)
|
|
args = parser.parse_args()
|
|
|
|
xml_files = load_xml_files(args.xml_path)
|
|
payload = parse_cas_payload(args.config_file)
|
|
report = {
|
|
"schema": "onec_config_object_xml_compare.v1",
|
|
"object_guid": args.object_guid.lower(),
|
|
"config_file": str(args.config_file),
|
|
"xml_paths": [str(path) for path in args.xml_path],
|
|
"xml_file_count": len(xml_files),
|
|
"payload": public_payload_report(payload, xml_files),
|
|
}
|
|
args.output.parent.mkdir(parents=True, exist_ok=True)
|
|
args.output.write_text(json.dumps(report, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
|
|
print(json.dumps({"output": str(args.output), "xml_files": len(xml_files)}, ensure_ascii=False))
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|