mirror of
https://github.com/acidanthera/OpenCorePkg.git
synced 2025-12-08 19:25:01 +00:00
28 lines
613 B
Python
Executable File
28 lines
613 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
"""
|
|
Validates schema files (e.g. OcConfigurationLib.c) for being sorted.
|
|
"""
|
|
|
|
import re
|
|
import sys
|
|
|
|
if len(sys.argv) < 2:
|
|
print('Pass file to check')
|
|
sys.exit(-1)
|
|
|
|
with open(sys.argv[1], 'r') as f:
|
|
prev = ''
|
|
content = [l.strip() for l in f.readlines()]
|
|
for i, l in enumerate(content):
|
|
if l == 'OC_SCHEMA':
|
|
print('Checking schema {}'.format(re.match('^\w+', content[i+1])[0]))
|
|
prev = ''
|
|
continue
|
|
x = re.search('"([^"]+)"', l)
|
|
if x:
|
|
if x[1] < prev:
|
|
print('ERROR: {} succeeds {}'.format(prev, x[1]))
|
|
sys.exit(1)
|
|
prev = x[1]
|