Cleanup
ci / checks (push) Failing after 23m22s

This commit is contained in:
khodowany
2026-10-08 02:13:45 -05:00
parent 300097a37e
commit bc7baea7c4
88 changed files with 18844 additions and 1335 deletions
+5 -17
View File
@@ -7,7 +7,6 @@ import json
import math
import pathlib
import shutil
import tempfile
import time
import PIL.PdfParser
@@ -19,7 +18,7 @@ import generator.engraving.layout
import generator.engraving.notation
import generator.engraving.raster
import generator.engraving.types
import generator.model
import generator.validation
# Two layout units per PDF point: guitar staff spacing is five points.
# Raster resolution is independent of layout and the device's display theme.
@@ -30,7 +29,7 @@ MEDIA_BOX = [0, 0, 612, 792]
VERSION = 'letter-parts-v1'
def layout_part(document, fonts):
generator.model.validate_document(document)
generator.validation.validate_document(document)
style = dataclasses.replace(generator.engraving.types.score_style(document, STYLE), system_gap=STYLE.system_gap)
# Measure numbers are centered over barlines and can extend left of the
# staff. Reserve their actual overhang inside the half-inch paper margin.
@@ -123,7 +122,7 @@ def renderer_key(fonts):
def restore(entry, key, target):
try:
if generator.engraving.cache.has_symlink(entry):
if generator.cache.has_symlink(entry):
return None
pdf, manifest = entry / 'part.pdf', entry / 'print.json'
if pdf.is_symlink() or manifest.is_symlink():
@@ -138,21 +137,10 @@ def restore(entry, key, target):
return None
def store(entry, key, target, pages):
if generator.engraving.cache.has_symlink(entry.parent):
raise ValueError('print cache must not contain symlinks')
entry.parent.mkdir(parents=True, exist_ok=True)
if entry.is_symlink() or entry.is_file():
entry.unlink()
entry.mkdir(exist_ok=True)
with tempfile.TemporaryDirectory(prefix='.print_', dir=entry.parent) as temporary:
staged = pathlib.Path(temporary)
with generator.cache.stage_entry(entry, '.print_') as staged:
shutil.copyfile(target, staged / 'part.pdf')
(staged / 'print.json').write_text(json.dumps({'key': key, 'sha256': hashlib.sha256(target.read_bytes()).hexdigest(), 'pages': pages}))
for name in ('part.pdf', 'print.json'):
destination = entry / name
if destination.is_dir() and not destination.is_symlink():
shutil.rmtree(destination)
(staged / name).replace(destination)
generator.cache.publish_files(entry, staged, ('part.pdf', 'print.json'))
def generate_tree(root, font_path, *, cache_dir=None, progress=False):
"""Called inside the normal build's atomic staging directory."""