INNER CODE UNIT · Python
main
witchan/ios-mcp · scripts/check_paddle_binaries.py:15
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--worker', default='mcp-ocr-worker/.theos/obj/mcp-ocr-worker')
parser.add_argument('--out', default='.codex-session-data/paddle-build/binary-audit.json')
args = parser.parse_args()
paths = [ROOT / args.worker, ROOT / 'third_party/paddleocr/runtime/ios/lib/libonnxruntime.a']
paths += sorted((ROOT / 'third_party/paddleocr/runtime/ios/opencv/lib').glob('*.a'))
assert len(paths) == 4, paths
report = []
for path in paths:
architectures = output('lipo', '-archs', str(path)).strip()
assert architectures == 'arm64', (path, architectures)
commands = output('otool', '-l', str(path))
minimums = re.findall(r'\bminos\s+(\S+)', commands)
minimums += re.findall(r'LC_VERSION_MIN_IPHONEOS\s+cmdsize \d+\s+version (\S+)', commands)
assert minimums, 'no OS version commands: ' + str(path)
assert all(tuple(map(int, v.split('.'))) <= (13, 0, 0) for v in minimums), set(minimums)
platforms = set(re.findall(r'\bplatform\s+(\S+)', commands))