Always generate meta-default-modes.h

This adds a hard requirement on having cvt installed, which in the past
was soft, where the generated file was added to the repository.
This commit is contained in:
Jonas Ådahl
2018-07-07 15:28:41 +02:00
parent e0727aba5f
commit 8a03f1ad02
6 changed files with 26 additions and 65 deletions

19
src/backends/native/gen-default-modes.py Normal file → Executable file
View File

@ -1,3 +1,5 @@
#!/usr/bin/python3
# Copyright (C) 2016 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or
@ -18,6 +20,10 @@
import os
import sys
if len(sys.argv) != 2:
print("Usage: %s [output file]"%sys.argv[0])
exit(1)
common_resolutions = [
# 4:3
(800, 600),
@ -109,6 +115,13 @@ for resolution in common_resolutions:
cvt.close()
output_lines.append("};")
for line in output_lines:
sys.stdout.write(line + "\n")
sys.stdout.flush()
try:
output_file = open(sys.argv[1], 'w')
for line in output_lines:
output_file.write(line + "\n")
output_file.flush()
output_file.close()
except:
print("Failed to generate modelines:", sys.exc_info()[0])
exit(1)