PulseCanvas / app · pulsecanvas.ai / scripts / package-original-development.py
| 1 | #!/usr/bin/env python3 |
| 2 | """Package the current original-Metal working tree as an explicitly unreleased snapshot.""" |
| 3 | from pathlib import Path |
| 4 | import hashlib,json,shutil,subprocess,tarfile |
| 5 | root=Path(__file__).resolve().parent.parent |
| 6 | out=root/'.build/original188-development-package';out.mkdir(parents=True,exist_ok=True) |
| 7 | stage=out/'PulseCanvas-original188-source' |
| 8 | if stage.exists():shutil.rmtree(stage) |
| 9 | stage.mkdir() |
| 10 | def 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) |
| 14 | for 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) |
| 16 | for 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) |
| 18 | for 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. |
| 22 | 188 active visualizers: 88 retained + 100 original additions; 12 reserved retired IDs. |
| 23 | The version/build in macOS/Release.xcconfig is retained from the prior release setup. |
| 24 | This snapshot does NOT represent that uploaded App Store build. Sources are uncommitted. |
| 25 | No production app, user session or distribution channel was changed. |
| 26 | |
| 27 | Rebuild on macOS 14+ with Xcode and Python 3: |
| 28 | python3 scripts/generate-store-project.py |
| 29 | xcodebuild -project PulseCanvas.xcodeproj -scheme PulseCanvas -configuration Release -derivedDataPath .build/original-preview CODE_SIGNING_ALLOWED=NO build |
| 30 | python3 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 | |
| 33 | The app source includes an excluded historical engine adapter for file/API compatibility. |
| 34 | Current builds do not link the engine or bundle external presets/textures/recovered shaders. |
| 35 | Historical notices/manifests are retained separately and are not current app resources. |
| 36 | Engine-source/rebuild archives for historical distributions remain preserved in the checkout; |
| 37 | they are not dependencies of this original-Metal snapshot and are not included here. |
| 38 | The application code is open source and public domain (Unlicense). Read LICENSE and docs/licensing.md. |
| 39 | Only the current native checks in docs/ORIGINAL-VISUALS-EXPANSION.md apply to this edition. |
| 40 | Legacy external-engine and removed-geometry test scripts are historical and are not run. |
| 41 | ''') |
| 42 | manifest={str(p.relative_to(stage)):hashlib.sha256(p.read_bytes()).hexdigest() for p in sorted(stage.rglob('*')) if p.is_file()} |
| 43 | revision=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') |
| 45 | archive=out/'PulseCanvas-original188-development-source.tar.gz' |
| 46 | with tarfile.open(archive,'w:gz') as t:t.add(stage,arcname=stage.name) |
| 47 | with 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 |
| 50 | receipt={'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') |
| 52 | print(json.dumps(receipt,indent=2)) |