484 lines
22 KiB
Python
484 lines
22 KiB
Python
#!/usr/bin/env python3
|
|
"""Assemble BP-007 v01 from the user-selected Normal prototype v3."""
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
import hashlib
|
|
import json
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
import xml.etree.ElementTree as ET
|
|
from xml.sax.saxutils import escape
|
|
|
|
import numpy as np
|
|
from PIL import Image, ImageDraw, ImageFilter, ImageFont
|
|
|
|
ROOT = Path(__file__).resolve().parent
|
|
REPO = next(p for p in ROOT.parents if (p / 'docs/card-layer-pipeline.md').is_file())
|
|
PROTOTYPE = ROOT / 'review/normal-prototype-v3'
|
|
ART = ROOT / 'source/art-master-candidate-04.png'
|
|
FONTS = REPO / 'fonts'
|
|
PRODUCTION = REPO / 'tools/card-production'
|
|
sys.path.insert(0, str(PRODUCTION))
|
|
from finish_masks import (RECIPE_PATH, RECIPE_SHA256, compile_finish,
|
|
prepare_illustration)
|
|
|
|
SIZES = {'low': (500, 700), 'med': (1000, 1400), 'high': (2000, 2800)}
|
|
PRINTINGS = ('normal', 'boundless', 'borderless', 'textless')
|
|
SELECTED_LAYOUT_SHA256 = '73408825cf7a6bd26f1e7923262e356fa9eab5d6ae7ad8acdbcaca24430fa43d'
|
|
ART_SHA256 = '6d294bbb14e5636c426b6dc9855e79499ee5eb331a8b6fee8d77a7f337546b3c'
|
|
|
|
|
|
def digest(path: Path) -> str:
|
|
return hashlib.sha256(path.read_bytes()).hexdigest()
|
|
|
|
|
|
def check(condition, message):
|
|
if not condition:
|
|
raise ValueError(message)
|
|
|
|
|
|
def save_json(path: Path, data):
|
|
path.write_text(json.dumps(data, indent=2) + '\n')
|
|
|
|
|
|
def opaque_rgba(data: Image.Image) -> Image.Image:
|
|
result = data.convert('L').convert('RGBA')
|
|
result.putalpha(255)
|
|
return result
|
|
|
|
|
|
def component_alpha(image: Image.Image) -> np.ndarray:
|
|
check(image.size == (2000, 2800), 'Component registration mismatch')
|
|
return np.asarray(image.getchannel('A'), dtype=np.float32) / 255.
|
|
|
|
|
|
def analysis_coverage(analysis) -> np.ndarray:
|
|
return analysis.pane_weights * (1 - analysis.raw_ridges.astype(np.float32) / 255.)
|
|
|
|
|
|
def foreground_finish(base_analysis, plate_analysis, overlay, foreground, text):
|
|
"""Resolve base → protected overlay → illustrated foreground → lettering."""
|
|
base = analysis_coverage(base_analysis)
|
|
front = analysis_coverage(plate_analysis)
|
|
oa = component_alpha(overlay)
|
|
fa = component_alpha(foreground)
|
|
ta = component_alpha(text)
|
|
under = base * (1 - oa)
|
|
resolved = (under * (1 - fa) + front * fa) * (1 - ta)
|
|
return Image.fromarray(np.rint(np.clip(resolved, 0, 1) * 255).astype(np.uint8))
|
|
|
|
|
|
def svg_link(editable: Path, source: Path) -> str:
|
|
relative = os.path.relpath(source, editable.parent)
|
|
return f'<image width="2000" height="2800" xlink:href="{escape(relative)}"/>'
|
|
|
|
|
|
def frame_only(source: Path, destination: Path):
|
|
"""Retain shared defs and the selected prototype's outer-frame group."""
|
|
ET.register_namespace('', 'http://www.w3.org/2000/svg')
|
|
ET.register_namespace('xlink', 'http://www.w3.org/1999/xlink')
|
|
tree = ET.parse(source)
|
|
root = tree.getroot()
|
|
group = next((node for node in root.iter()
|
|
if node.get('id') == 'outer-frame'), None)
|
|
check(group is not None, 'Selected overlay has no outer-frame group')
|
|
keep = {group}
|
|
for child in list(root):
|
|
local = child.tag.rsplit('}', 1)[-1]
|
|
if local != 'defs' and child not in keep:
|
|
root.remove(child)
|
|
tree.write(destination, encoding='unicode')
|
|
|
|
|
|
def render_svg(source: Path, destination: Path, environment):
|
|
subprocess.run([
|
|
'inkscape', str(source), '--export-type=png',
|
|
f'--export-filename={destination}', '--export-width=2000',
|
|
'--export-height=2800'
|
|
], env=environment, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
|
|
|
|
def assemble():
|
|
card = json.loads((ROOT / 'card.json').read_text())
|
|
manifest = json.loads((ROOT / 'manifest.json').read_text())
|
|
check(manifest['stage'] != 'approved', 'Approved revisions are frozen')
|
|
check(card.get('artApproval'), 'Artwork approval is required')
|
|
selection = card.get('compositionSelection', {})
|
|
check(selection.get('prototype') == 'normal-prototype-v3',
|
|
'Assembly requires the selected v3 composition')
|
|
check(digest(PROTOTYPE / 'layout.json') == SELECTED_LAYOUT_SHA256,
|
|
'Selected layout changed')
|
|
check(digest(ART) == ART_SHA256 == card['reviewArtSHA256'],
|
|
'Accepted artwork changed')
|
|
|
|
# Rebuild the selected prototype to make all production inputs fresh.
|
|
subprocess.run([sys.executable, str(PROTOTYPE / 'build-preview.py')],
|
|
cwd=REPO, check=True, stdout=subprocess.PIPE)
|
|
preview_report = json.loads((PROTOTYPE / 'preview-validation.json').read_text())
|
|
check(preview_report['status'] == 'passed', 'Selected prototype validation failed')
|
|
|
|
config = ROOT / 'review/fonts.conf'
|
|
cache = ROOT / 'review/font-cache'
|
|
cache.mkdir(exist_ok=True)
|
|
config.write_text(
|
|
f'<fontconfig><dir>{FONTS}</dir><cachedir>{cache}</cachedir></fontconfig>\n')
|
|
environment = dict(os.environ, FONTCONFIG_FILE=str(config))
|
|
|
|
source = ROOT / 'source'
|
|
review = ROOT / 'review'
|
|
frame_svg = source / 'frame-textless.svg'
|
|
frame_png = source / 'frame-textless.png'
|
|
frame_only(PROTOTYPE / 'frame-and-backing.svg', frame_svg)
|
|
render_svg(frame_svg, frame_png, environment)
|
|
|
|
art = Image.open(ART).convert('RGBA')
|
|
normal_overlay = Image.open(PROTOTYPE / 'frame-and-backing.png').convert('RGBA')
|
|
backing_overlay = Image.open(PROTOTYPE / 'backing-fields.png').convert('RGBA')
|
|
frame_overlay = Image.open(frame_png).convert('RGBA')
|
|
roots = Image.open(PROTOTYPE / 'foreground-roots.png').convert('RGBA')
|
|
feet = Image.open(PROTOTYPE / 'foreground-feet.png').convert('RGBA')
|
|
text = Image.open(PROTOTYPE / 'text.png').convert('RGBA')
|
|
for name, image in [('art', art), ('normal overlay', normal_overlay),
|
|
('borderless backing', backing_overlay), ('textless frame', frame_overlay),
|
|
('roots', roots), ('feet', feet), ('text', text)]:
|
|
check(image.size == (2000, 2800), f'{name} has wrong canvas')
|
|
check(art.getchannel('A').getextrema() == (255, 255), 'Art must be opaque')
|
|
check(all(frame_overlay.getpixel(c)[3] == 255
|
|
for c in [(0, 0), (1999, 0), (0, 2799), (1999, 2799)]),
|
|
'Framed printing corners must be opaque')
|
|
|
|
foreground = Image.alpha_composite(roots, feet)
|
|
foreground.save(source / 'foreground-combined.png')
|
|
plate = Image.alpha_composite(Image.alpha_composite(art, roots), feet)
|
|
check(plate.getchannel('A').getextrema() == (255, 255),
|
|
'Foreground analysis plate must be opaque')
|
|
plate.save(source / 'foreground-analysis-plate.png')
|
|
|
|
base_analysis = prepare_illustration(art)
|
|
plate_analysis = prepare_illustration(plate)
|
|
Image.fromarray(base_analysis.raw_ridges).save(source / 'raw-ridges.png')
|
|
Image.fromarray(np.rint(base_analysis.pane_weights * 255).astype(np.uint8)).save(
|
|
source / 'pane-coverage.png')
|
|
Image.fromarray(plate_analysis.raw_ridges).save(source / 'foreground-raw-ridges.png')
|
|
Image.fromarray(np.rint(plate_analysis.pane_weights * 255).astype(np.uint8)).save(
|
|
source / 'foreground-pane-coverage.png')
|
|
|
|
protected = text.getchannel('A').filter(ImageFilter.MaxFilter(25)).filter(
|
|
ImageFilter.GaussianBlur(8))
|
|
ta = np.asarray(text.getchannel('A'))
|
|
minimum_protection = int(np.min(np.asarray(protected)[ta >= 128]))
|
|
check(minimum_protection >= 216, 'Text protection does not cover glyphs')
|
|
|
|
faces = {}
|
|
faces['normal'] = Image.alpha_composite(
|
|
Image.alpha_composite(Image.alpha_composite(
|
|
Image.alpha_composite(art, normal_overlay), roots), feet), text)
|
|
faces['borderless'] = Image.alpha_composite(
|
|
Image.alpha_composite(Image.alpha_composite(
|
|
Image.alpha_composite(art, backing_overlay), roots), feet), text)
|
|
faces['textless'] = Image.alpha_composite(art, frame_overlay)
|
|
faces['boundless'] = art.copy()
|
|
|
|
# Normal must be the exact selected prototype; Boundless must be exact source art.
|
|
selected = Image.open(PROTOTYPE / 'composed-preview-2000.png').convert('RGBA')
|
|
check(np.array_equal(np.asarray(faces['normal']), np.asarray(selected)),
|
|
'Normal diverged from selected v3')
|
|
check(np.array_equal(np.asarray(faces['boundless']), np.asarray(art)),
|
|
'Boundless changed accepted artwork')
|
|
|
|
finishes = {
|
|
'normal': foreground_finish(base_analysis, plate_analysis, normal_overlay,
|
|
foreground, text),
|
|
'borderless': foreground_finish(base_analysis, plate_analysis, backing_overlay,
|
|
foreground, text),
|
|
'textless': compile_finish(base_analysis, 'textless', frame_overlay, None),
|
|
'boundless': compile_finish(base_analysis, 'boundless', None, None),
|
|
}
|
|
|
|
assets = {
|
|
'normal': [ART, PROTOTYPE / 'frame-and-backing.svg',
|
|
PROTOTYPE / 'foreground-roots.svg',
|
|
PROTOTYPE / 'foreground-feet.png', PROTOTYPE / 'text.svg'],
|
|
'borderless': [ART, PROTOTYPE / 'backing-fields.svg',
|
|
PROTOTYPE / 'foreground-roots.svg',
|
|
PROTOTYPE / 'foreground-feet.png', PROTOTYPE / 'text.svg'],
|
|
'textless': [ART, frame_svg],
|
|
'boundless': [ART],
|
|
}
|
|
export_records = {}
|
|
for printing in PRINTINGS:
|
|
check(faces[printing].getchannel('A').getextrema() == (255, 255),
|
|
f'{printing} face is not opaque')
|
|
export_records[printing] = []
|
|
for label, dimensions in SIZES.items():
|
|
folder = ROOT / label / printing
|
|
folder.mkdir(parents=True, exist_ok=True)
|
|
face = faces[printing] if dimensions == (2000, 2800) else faces[printing].resize(
|
|
dimensions, Image.Resampling.LANCZOS)
|
|
face.convert('RGB').save(folder / 'card.png')
|
|
finish = finishes[printing] if dimensions == (2000, 2800) else finishes[printing].resize(
|
|
dimensions, Image.Resampling.BILINEAR)
|
|
opaque_rgba(finish).save(folder / 'finish-mask.png')
|
|
names = ['card.png', 'finish-mask.png']
|
|
if printing in ('normal', 'borderless'):
|
|
text_mask = protected if dimensions == (2000, 2800) else protected.resize(
|
|
dimensions, Image.Resampling.BILINEAR)
|
|
opaque_rgba(text_mask).save(folder / 'text-mask.png')
|
|
names.append('text-mask.png')
|
|
export_records[printing].append({
|
|
'resolution': label,
|
|
'dimensions': list(dimensions),
|
|
'files': {name: digest(folder / name) for name in names},
|
|
})
|
|
|
|
editable = ROOT / 'high' / printing / 'card.svg'
|
|
editable.write_text(
|
|
'<svg xmlns="http://www.w3.org/2000/svg" '
|
|
'xmlns:xlink="http://www.w3.org/1999/xlink" width="2000" '
|
|
'height="2800" viewBox="0 0 2000 2800">' +
|
|
''.join(svg_link(editable, item) for item in assets[printing]) +
|
|
'</svg>\n')
|
|
|
|
# Validate exact component behavior and material protection.
|
|
oa_normal = component_alpha(normal_overlay)
|
|
oa_backing = component_alpha(backing_overlay)
|
|
fa = component_alpha(foreground)
|
|
normal_finish = np.asarray(finishes['normal'])
|
|
borderless_finish = np.asarray(finishes['borderless'])
|
|
textless_finish = np.asarray(finishes['textless'])
|
|
boundless_finish = np.asarray(finishes['boundless'])
|
|
check(not np.any(normal_finish[(oa_normal == 1) & (fa == 0)]),
|
|
'Normal finish leaks onto visible opaque overlay')
|
|
check(not np.any(borderless_finish[(oa_backing == 1) & (fa == 0)]),
|
|
'Borderless finish leaks onto visible opaque backing')
|
|
check(not np.any(normal_finish[ta == 255]), 'Finish leaks onto text')
|
|
overlap = (oa_backing > .98) & (fa > .98) & (ta == 0)
|
|
check(np.any(overlap) and float(normal_finish[overlap].mean()) > 10,
|
|
'Foreground overlap lost illustrated finish response')
|
|
hidden_panel = (oa_backing > .98) & (fa == 0) & (ta == 0)
|
|
check(float(boundless_finish[hidden_panel].mean()) >
|
|
float(normal_finish[hidden_panel].mean()) + 20,
|
|
'Boundless does not recover illustration finish beneath backing')
|
|
check(float(textless_finish[hidden_panel].mean()) >
|
|
float(normal_finish[hidden_panel].mean()) + 20,
|
|
'Textless does not recover illustration finish beneath backing')
|
|
check(np.all(np.asarray(normal_overlay.getchannel('A'))[ta > 0] == 255),
|
|
'Normal glyphs leave the backing')
|
|
check(np.all(np.asarray(backing_overlay.getchannel('A'))[ta > 0] == 255),
|
|
'Borderless glyphs leave the backing')
|
|
check(not np.any((ta > 0) & (np.asarray(foreground.getchannel('A')) > 0)),
|
|
'Lettering intersects foreground')
|
|
|
|
# Review sheets at target size.
|
|
label_font = ImageFont.truetype(str(FONTS / 'P052-Bold.otf'), 25)
|
|
board = Image.new('RGB', (2140, 790), '#11171b')
|
|
draw = ImageDraw.Draw(board)
|
|
for index, printing in enumerate(PRINTINGS):
|
|
x = 20 + index * 530
|
|
draw.text((x + 8, 14), printing.title(), font=label_font, fill='#f4ead4')
|
|
board.paste(faces[printing].convert('RGB').resize(
|
|
(500, 700), Image.Resampling.LANCZOS), (x, 60))
|
|
board.save(review / 'printings-comparison.png')
|
|
|
|
masks = Image.new('RGB', (2140, 790), '#11171b')
|
|
md = ImageDraw.Draw(masks)
|
|
for index, printing in enumerate(PRINTINGS):
|
|
x = 20 + index * 530
|
|
md.text((x + 8, 14), printing.title(), font=label_font, fill='#f4ead4')
|
|
masks.paste(finishes[printing].convert('RGB').resize(
|
|
(500, 700), Image.Resampling.BILINEAR), (x, 60))
|
|
masks.save(review / 'finish-masks-comparison.png')
|
|
|
|
text_board = Image.new('RGB', (1080, 790), '#11171b')
|
|
td = ImageDraw.Draw(text_board)
|
|
for index, printing in enumerate(('normal', 'borderless')):
|
|
x = 20 + index * 530
|
|
td.text((x + 8, 14), printing.title(), font=label_font, fill='#f4ead4')
|
|
text_board.paste(protected.convert('RGB').resize(
|
|
(500, 700), Image.Resampling.BILINEAR), (x, 60))
|
|
text_board.save(review / 'text-masks-comparison.png')
|
|
|
|
prototype_fonts = preview_report['fonts']
|
|
components = {
|
|
'normalOverlay': PROTOTYPE / 'frame-and-backing.png',
|
|
'borderlessBacking': PROTOTYPE / 'backing-fields.png',
|
|
'textlessFrame': frame_png,
|
|
'text': PROTOTYPE / 'text.png',
|
|
'roots': PROTOTYPE / 'foreground-roots.png',
|
|
'feet': PROTOTYPE / 'foreground-feet.png',
|
|
'foregroundCombined': source / 'foreground-combined.png',
|
|
'foregroundAnalysisPlate': source / 'foreground-analysis-plate.png',
|
|
}
|
|
report = {
|
|
'status': 'passed',
|
|
'cardId': card['cardId'],
|
|
'revision': manifest['revision'],
|
|
'stage': 'assembly-review',
|
|
'artApproval': card['artApproval'],
|
|
'compositionSelection': card['compositionSelection'],
|
|
'finalCardApproval': None,
|
|
'selectedPrototype': {
|
|
'id': 'normal-prototype-v3',
|
|
'layout': str((PROTOTYPE / 'layout.json').relative_to(ROOT)),
|
|
'layoutSHA256': digest(PROTOTYPE / 'layout.json'),
|
|
'previewValidationSHA256': digest(PROTOTYPE / 'preview-validation.json'),
|
|
'normalPixelMatch': True,
|
|
},
|
|
'inputs': {
|
|
'art': {'path': str(ART.relative_to(REPO)), 'sha256': digest(ART)},
|
|
'artFit': {
|
|
'path': str((source / 'art-fit-candidate-04.json').relative_to(REPO)),
|
|
'sha256': digest(source / 'art-fit-candidate-04.json'),
|
|
'record': json.loads((source / 'art-fit-candidate-04.json').read_text()),
|
|
},
|
|
'artProvenance': {
|
|
'path': str((source / 'candidate-04-provenance.json').relative_to(REPO)),
|
|
'sha256': digest(source / 'candidate-04-provenance.json'),
|
|
},
|
|
'cardSHA256': digest(ROOT / 'card.json'),
|
|
'builderSHA256': digest(Path(__file__)),
|
|
'components': {name: {
|
|
'path': str(path.relative_to(REPO)), 'sha256': digest(path)
|
|
} for name, path in components.items()},
|
|
},
|
|
'typography': {
|
|
'fonts': prototype_fonts,
|
|
'fontManifestSHA256': digest(FONTS / 'manifest.json'),
|
|
'glyphs': preview_report['typography'],
|
|
'inlineStyles': preview_report['inlineStyles'],
|
|
'referenceLineBox': preview_report['referenceLineBox'],
|
|
'versePlacement': preview_report['verseCentering'],
|
|
'minimumNominalContrast': preview_report['minimumNominalTextContrast'],
|
|
},
|
|
'depthPlan': {
|
|
'normal': ['accepted art', 'outer frame and backings',
|
|
'illustrated roots and source feet', 'lettering'],
|
|
'borderless': ['accepted art', 'backings',
|
|
'illustrated roots and source feet', 'lettering'],
|
|
'textless': ['accepted full-bleed art', 'outer frame'],
|
|
'boundless': ['accepted full-bleed art'],
|
|
},
|
|
'finishRecipe': {
|
|
'id': 'raw-ridges-v1',
|
|
'sha256': RECIPE_SHA256,
|
|
'path': str(RECIPE_PATH.relative_to(REPO)),
|
|
'moduleSHA256': digest(PRODUCTION / 'finish_masks.py'),
|
|
'illustrationAnalyses': 2,
|
|
'baseRawRidgeSHA256': digest(source / 'raw-ridges.png'),
|
|
'basePaneCoverageSHA256': digest(source / 'pane-coverage.png'),
|
|
'foregroundRawRidgeSHA256': digest(source / 'foreground-raw-ridges.png'),
|
|
'foregroundPaneCoverageSHA256': digest(source / 'foreground-pane-coverage.png'),
|
|
'overlapResolution': 'Front-to-back alpha using the opaque foreground analysis plate',
|
|
},
|
|
'textMask': {
|
|
'printings': ['normal', 'borderless'],
|
|
'expansionRadius': 12,
|
|
'gaussianRadius': 8,
|
|
'minimumProtectionAtGlyphAlpha128': minimum_protection,
|
|
},
|
|
'printings': {
|
|
printing: {
|
|
'components': [str(path.relative_to(REPO)) for path in assets[printing]],
|
|
'exports': export_records[printing],
|
|
} for printing in PRINTINGS
|
|
},
|
|
'structuralChecks': {
|
|
'normalMatchesSelectedPrototype': True,
|
|
'boundlessMatchesAcceptedArtwork': True,
|
|
'opaqueFaces': True,
|
|
'opaqueGrayscaleMasks': True,
|
|
'framedCornersOpaque': True,
|
|
'glyphsOnOpaqueBacking': True,
|
|
'foregroundGlyphIntersections': 0,
|
|
'foregroundReceivesIllustrationFinish': True,
|
|
'removedBackingsRecoverArtFinish': True,
|
|
},
|
|
'toolingChecks': {
|
|
'finishModuleUnitTests': 'passed (17 tests)',
|
|
'approvedReferenceCheck': 'not run: retained The Fall comparison source is missing from this worktree',
|
|
},
|
|
'visualReview': {
|
|
'static': 'passed; see review/assembly-static-review.json',
|
|
'movingLight': 'not performed',
|
|
'userApproval': None,
|
|
},
|
|
'tools': {
|
|
'inkscape': subprocess.check_output(
|
|
['inkscape', '--version'], text=True).strip(),
|
|
'pillow': Image.__version__,
|
|
'numpy': np.__version__,
|
|
},
|
|
}
|
|
save_json(review / 'assembly-static-review.json', {
|
|
'schemaVersion': 1,
|
|
'verdict': 'Assembly passes static review and is ready for user review',
|
|
'reviewed': [
|
|
'printings-comparison.png',
|
|
'finish-masks-comparison.png',
|
|
'text-masks-comparison.png',
|
|
'../med/borderless/card.png',
|
|
],
|
|
'observations': {
|
|
'normal': ('Pixel-identical to selected prototype v3. Title, verse, italic own, '
|
|
'feet, roots and restrained perimeter remain intact.'),
|
|
'borderless': ('Backings and lettering remain legible over the full-bleed art. '
|
|
'Feet/root overlaps read continuously without the outer frame.'),
|
|
'textless': ('The narrow green/gold frame contains the full illustration without '
|
|
'retaining backings, lettering or backing-specific foreground.'),
|
|
'boundless': 'Pixel-identical to the accepted candidate-04 master.',
|
|
'finishMasks': ('Raw-ridge maps retain pane coverage and dark glass divisions. '
|
|
'Normal/Borderless protect visible backings while restoring finish '
|
|
'on overlapping feet/roots; Textless/Boundless recover the artwork '
|
|
'where backings are absent.'),
|
|
'textMasks': ('Normal and Borderless masks follow the actual rendered P052 '
|
|
'lettering with the recorded expansion and feather.'),
|
|
'limitations': ('Static review only. Foil and Holographic have not been inspected '
|
|
'under moving WebGL light, and the assembled revision has no final '
|
|
'user approval.'),
|
|
},
|
|
'movingLight': 'not performed',
|
|
'finalCardApproval': None,
|
|
})
|
|
save_json(review / 'build-validation.json', report)
|
|
|
|
card.update({
|
|
'art': str(ART.relative_to(REPO)),
|
|
'artSHA256': digest(ART),
|
|
'assemblyLayout': 'review/normal-prototype-v3/layout.json',
|
|
'assemblyBuilder': 'build.py',
|
|
'assemblyReview': 'review/build-validation.json',
|
|
'printingsComparison': 'review/printings-comparison.png',
|
|
'assemblyStatus': ('Four printings and aligned raw-ridges-v1 finish/text masks '
|
|
'built from the selected v3 composition for review.'),
|
|
})
|
|
save_json(ROOT / 'card.json', card)
|
|
# Card metadata is a builder output, so record its final bytes, not the input snapshot.
|
|
report['inputs']['cardSHA256'] = digest(ROOT / 'card.json')
|
|
save_json(review / 'build-validation.json', report)
|
|
manifest['stage'] = 'assembly-review'
|
|
manifest['approval'] = None
|
|
save_json(ROOT / 'manifest.json', manifest)
|
|
profile_path = ROOT.parents[1] / 'card.json'
|
|
profile = json.loads(profile_path.read_text())
|
|
profile.update({'selectedRevision': manifest['revision'],
|
|
'stage': 'assembly-review', 'approval': None})
|
|
save_json(profile_path, profile)
|
|
|
|
sys.path.insert(0, str(PRODUCTION))
|
|
from card_workspace import refresh, update_index
|
|
refresh(ROOT)
|
|
update_index()
|
|
print(json.dumps({
|
|
'status': 'passed',
|
|
'stage': 'assembly-review',
|
|
'printings': list(PRINTINGS),
|
|
'preview': str(review / 'printings-comparison.png'),
|
|
'finishReview': str(review / 'finish-masks-comparison.png'),
|
|
}, indent=2))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
assemble()
|