OcConfigurationLib: Add python 2 compatibility in CheckSchema.py
-#!/usr/bin/env python3
+#!/usr/bin/env python
"""
Validates schema files (e.g. OcConfigurationLib.c) for being sorted.
@@ -16,12 +16,12 @@ with open(sys.argv[1], 'r') as f:
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]))
+ print('Checking schema {}'.format(re.match('^\w+', content[i+1]).group(0)))
prev = ''
continue
x = re.search('"([^"]+)"', l)
if x:
- if x[1] < prev:
- print('ERROR: {} succeeds {}'.format(prev, x[1]))
+ if x.group(1) < prev:
+ print('ERROR: {} succeeds {}'.format(prev, x.group(1)))
sys.exit(1)
- prev = x[1]
+ prev = x.group(1)
