pcie_sriov: Ensure VF function number does not overflow
[qemu/ar7.git] / scripts / shaderinclude.py
blobab2aade2cd90b07bd37bd8cb730b988aa228d52a
1 #!/usr/bin/env python3
3 # Copyright (C) 2023 Red Hat, Inc.
5 # SPDX-License-Identifier: GPL-2.0-or-later
7 import sys
8 import os
11 def main(args):
12 file_path = args[1]
13 basename = os.path.basename(file_path)
14 varname = basename.replace('-', '_').replace('.', '_')
16 with os.fdopen(sys.stdout.fileno(), "wt", closefd=False, newline='\n') as stdout:
17 with open(file_path, "r", encoding='utf-8') as file:
18 print(f'static GLchar {varname}_src[] =', file=stdout)
19 for line in file:
20 line = line.rstrip()
21 print(f' "{line}\\n"', file=stdout)
22 print(' "\\n";', file=stdout)
25 if __name__ == '__main__':
26 sys.exit(main(sys.argv))