forked from notaz/mesa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Part of the effort to replace shell scripts with portable python scripts. I could've used a trivial `assert lines == sorted(lines)`, but this way the caller is shown which entrypoint is out of order. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by Dylan Baker <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
- Loading branch information
Showing
3 changed files
with
38 additions
and
13 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env python | ||
|
||
import argparse | ||
|
||
PREFIX = 'EGL_ENTRYPOINT(' | ||
SUFFIX = ')' | ||
|
||
def main(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('header') | ||
args = parser.parse_args() | ||
|
||
with open(args.header) as header: | ||
lines = header.readlines() | ||
|
||
entrypoints = [] | ||
for line in lines: | ||
line = line.strip() | ||
if line.startswith(PREFIX): | ||
assert line.endswith(SUFFIX) | ||
entrypoints.append(line[len(PREFIX):-len(SUFFIX)]) | ||
|
||
print('Checking EGL API entrypoints are sorted') | ||
|
||
for i, _ in enumerate(entrypoints): | ||
# Can't compare the first one with the previous | ||
if i == 0: | ||
continue | ||
if entrypoints[i - 1] > entrypoints[i]: | ||
print('ERROR: ' + entrypoints[i] + ' should come before ' + entrypoints[i - 1]) | ||
exit(1) | ||
|
||
print('All good :)') | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters