blob: ab2aade2cd90b07bd37bd8cb730b988aa228d52a [file] [log] [blame]
Marc-André Lureaue2c40122023-01-24 18:00:57 +00001#!/usr/bin/env python3
2#
3# Copyright (C) 2023 Red Hat, Inc.
4#
5# SPDX-License-Identifier: GPL-2.0-or-later
6
7import sys
8import os
9
10
11def main(args):
12 file_path = args[1]
13 basename = os.path.basename(file_path)
14 varname = basename.replace('-', '_').replace('.', '_')
15
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)
23
24
25if __name__ == '__main__':
26 sys.exit(main(sys.argv))