Branchwell

PulseCanvas / app · pulsecanvas.ai / scripts / verify-mobile-artifact.py

Raw 2.1 KB on 15681b389943bdb82ce0ee35ea3df6538f046361
1#!/usr/bin/env python3
2"""Check the actual native-only iOS app bundle against this checkout."""
3import hashlib
4import json
5from pathlib import Path
6import plistlib
7import subprocess
8import sys
9
10app = Path(sys.argv[1]).resolve()
11info = plistlib.loads((app / 'Info.plist').read_bytes())
12assert set(info['UIDeviceFamily']) == {1, 2}, 'Both iPhone and iPad must be supported'
13assert info['MinimumOSVersion'] == '18.0'
14assert info.get('UIBackgroundModes') == ['audio'], 'Background playback mode is missing or overbroad'
15root = app / 'NativeAssets'
16catalog = json.loads((root / 'NativeVisualizers.json').read_text())
17expected = json.loads(subprocess.check_output([sys.executable, 'scripts/native-visualizer-catalog.py'], text=True))
18assert catalog == expected, 'Native catalog does not match source'
19for name, digest in catalog['shaders'].items():
20 assert hashlib.sha256((root / name).read_bytes()).hexdigest() == digest, name
21assert hashlib.sha256((root / 'Audio/PulseCanvas.mp3').read_bytes()).digest() == hashlib.sha256(Path('Sources/PulseCanvas/Resources/Audio/PulseCanvas.mp3').read_bytes()).digest()
22assert (app / 'Legal/PulseCanvas-LICENSE.txt').read_bytes() == Path('LICENSE').read_bytes()
23assert (app / 'PrivacyInfo.xcprivacy').read_bytes() == Path('macOS/PrivacyInfo.xcprivacy').read_bytes()
24assert not list(app.rglob('*.milk'))
25assert not any('sparkle' in p.name.lower() or 'projectm' in p.name.lower() for p in app.rglob('*'))
26binary = app / info['CFBundleExecutable']
27release_bytes = binary.read_bytes()
28assert all(marker not in release_bytes for marker in (b'PCMobileQA', b'PCMobileRadioQA')), 'Debug fixture leaked into Release'
29linked = subprocess.check_output(['otool', '-L', str(binary)], text=True)
30assert 'OpenGL' not in linked and 'projectM' not in linked
31print(json.dumps({'app': str(app), 'version': info['CFBundleShortVersionString'], 'build': info['CFBundleVersion'],
32 'deviceFamilies': info['UIDeviceFamily'], 'activeEffects': catalog['activeCount'], 'resourcesMatchSource': True,
33 'externalEffectsAbsent': True, 'debugFixtureAbsent': True, 'signing': 'not assessed'}, indent=2))