Branchwell

PulseCanvas / app · pulsecanvas.ai / scripts / package-original-development.py

Raw 4.0 KB on f7455f5645a899a3879cf752f3536fe6de471c90
1#!/usr/bin/env python3
2"""Package the current original-Metal working tree as an explicitly unreleased snapshot."""
3from pathlib import Path
4import hashlib,json,shutil,subprocess,tarfile
5root=Path(__file__).resolve().parent.parent
6out=root/'.build/original188-development-package';out.mkdir(parents=True,exist_ok=True)
7stage=out/'PulseCanvas-original188-source'
8if stage.exists():shutil.rmtree(stage)
9stage.mkdir()
10def copy(path):
11 source=root/path;target=stage/path;target.parent.mkdir(parents=True,exist_ok=True)
12 if source.is_dir():shutil.copytree(source,target,ignore=shutil.ignore_patterns('__pycache__','.DS_Store'))
13 else:shutil.copy2(source,target)
14for path in ['Sources','scripts','macOS','PulseCanvas.xcodeproj','Package.swift','LICENSE','README.md','assets/app-icon','assets/readme','assets/marketing','assets/app-store/screenshots','third_party/historical-projectm-notices']:
15 copy(path)
16for path in ['docs/ORIGINAL-VISUALS-EXPANSION.md','docs/original-additions.json','docs/RENDERING.md','docs/USER_GUIDE.md','docs/DISTRIBUTION.md','docs/licensing.md','docs/shader-provenance.json','docs/app-store/RIGHTS-RESOLUTION.md','third_party/PROJECTM.md']:
17 copy(path)
18for p in stage.rglob('*'):
19 assert p.suffix.lower() not in ('.milk','.ll'),p
20 assert p.name!='VisualShaders.metallib',p
21(stage/'BUILD.txt').write_text('''PulseCanvas Studio ORIGINAL METAL DEVELOPMENT SNAPSHOT — not a signed release.
22188 active visualizers: 88 retained + 100 original additions; 12 reserved retired IDs.
23The version/build in macOS/Release.xcconfig is retained from the prior release setup.
24This snapshot does NOT represent that uploaded App Store build. Sources are uncommitted.
25No production app, user session or distribution channel was changed.
26
27Rebuild on macOS 14+ with Xcode and Python 3:
28python3 scripts/generate-store-project.py
29xcodebuild -project PulseCanvas.xcodeproj -scheme PulseCanvas -configuration Release -derivedDataPath .build/original-preview CODE_SIGNING_ALLOWED=NO build
30python3 scripts/verify-original-resources.py ".build/original-preview/Build/Products/Release/PulseCanvas Studio.app"
31./scripts/test-original-bundle.sh ".build/original-preview/Build/Products/Release/PulseCanvas Studio.app"
32
33The app source includes an excluded historical engine adapter for file/API compatibility.
34Current builds do not link the engine or bundle external presets/textures/recovered shaders.
35Historical notices/manifests are retained separately and are not current app resources.
36Engine-source/rebuild archives for historical distributions remain preserved in the checkout;
37they are not dependencies of this original-Metal snapshot and are not included here.
38The application code is open source and public domain (Unlicense). Read LICENSE and docs/licensing.md.
39Only the current native checks in docs/ORIGINAL-VISUALS-EXPANSION.md apply to this edition.
40Legacy external-engine and removed-geometry test scripts are historical and are not run.
41''')
42manifest={str(p.relative_to(stage)):hashlib.sha256(p.read_bytes()).hexdigest() for p in sorted(stage.rglob('*')) if p.is_file()}
43revision=subprocess.check_output(['git','rev-parse','HEAD'],cwd=root,text=True).strip()
44(stage/'SNAPSHOT.json').write_text(json.dumps({'schema':1,'revisionBeforeChanges':revision,'uncommitted':True,'activeEffects':188,'newEffects':100,'retiredNativeIDs':[0,1,2,3,5,6,7,8,9,11,13,14],'files':manifest},indent=2)+'\n')
45archive=out/'PulseCanvas-original188-development-source.tar.gz'
46with tarfile.open(archive,'w:gz') as t:t.add(stage,arcname=stage.name)
47with tarfile.open(archive,'r:gz') as t:
48 for name,digest in manifest.items():
49 data=t.extractfile(stage.name+'/'+name).read();assert hashlib.sha256(data).hexdigest()==digest,name
50receipt={'archive':str(archive),'sha256':hashlib.sha256(archive.read_bytes()).hexdigest(),'filesVerified':len(manifest),'activeEffects':188,'newEffects':100,'recoveredShaders':0,'externalPresetFiles':0,'uncommittedDevelopmentSnapshot':True,'rebuiltFromArchive':False}
51(out/'source-package-receipt.json').write_text(json.dumps(receipt,indent=2)+'\n')
52print(json.dumps(receipt,indent=2))