@@ -8,6 +8,11 @@ import xml.etree.ElementTree as ET
|
||||
import zipfile
|
||||
|
||||
|
||||
def catalogue_bytes(data):
|
||||
# Preserve the exact approved Windows artifact on every platform.
|
||||
return (json.dumps(data, ensure_ascii=False, separators=(",", ":")) + "\r\n").encode("utf-8")
|
||||
|
||||
|
||||
def prepare(source, destination):
|
||||
content = Path(source).read_bytes()
|
||||
digest = hashlib.sha256(content).hexdigest()
|
||||
@@ -81,7 +86,7 @@ def prepare(source, destination):
|
||||
if previous["manifest"]["source_sha256"] != digest:
|
||||
raise ValueError("Preserve previous catalogue: use a new destination for a new source revision")
|
||||
destination.parent.mkdir(parents=True, exist_ok=True)
|
||||
destination.write_text(json.dumps(result, ensure_ascii=False, separators=(",", ":")) + "\n", encoding="utf-8")
|
||||
destination.write_bytes(catalogue_bytes(result))
|
||||
print(json.dumps(manifest, ensure_ascii=False, indent=2))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user