ws-arch2-cab: archive/cab (MSCF read: stored / MSZIP folders with the carried-over deflate dictionary, reserve areas, checksums, attributes, UTF-8 names, spanned files UNSUPPORTED; write: one stored / MSZIP folder) vs cabextract / gcab / 7z; Deflate.inflate gains an optional preset dictionary (5th argument, Inflate.raw 7th; backward compatible)
This commit is contained in:
1 parent
53b41c7275
commit
825c45b03c
10 files changed
+851
-4
No files matched your search
@@ -0,0 +1,30 @@
|
||||
# Docs inputs for the archive page's Cabinet section (tools/fixtures.py; tools/docs_check.py explains the inputs): an
|
||||
# MSZIP cabinet of a small tree by gcab.
|
||||
# tests/gen/docs_arch_cab.luau { files = { [name] = bytes }, vars = { cabBytes = "setup.cab" } }
|
||||
import importlib.util, os, subprocess, tempfile
|
||||
|
||||
INPUTS = ["tools/docs_check.py"]
|
||||
|
||||
MTIME = 1767225600 # 2026-01-01T00:00:00Z
|
||||
|
||||
|
||||
def docs_check(ctx):
|
||||
spec = importlib.util.spec_from_file_location("docs_check", os.path.join(ctx.root, "tools", "docs_check.py"))
|
||||
m = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(m)
|
||||
return m
|
||||
|
||||
|
||||
def generate(ctx):
|
||||
dc = docs_check(ctx)
|
||||
files = {}
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
os.makedirs(os.path.join(d, "bin"))
|
||||
for n, data in (("readme.txt", b"formats-luau cabinet\n" * 20), ("bin/tool.dll", bytes(range(256)) * 64)):
|
||||
with open(os.path.join(d, n), "wb") as f:
|
||||
f.write(data)
|
||||
os.utime(os.path.join(d, n), (MTIME, MTIME))
|
||||
subprocess.run(["nix", "shell", "nixpkgs#gcab", "-c", "gcab", "-c", "-z", "setup.cab", "readme.txt", "bin/tool.dll"],
|
||||
cwd=d, check=True, capture_output=True, env=dict(os.environ, TZ="UTC"))
|
||||
files["setup.cab"] = open(os.path.join(d, "setup.cab"), "rb").read()
|
||||
dc.emit_inputs(ctx, files, {"cabBytes": "setup.cab"})
|
||||
Reference in new issue
Block a user