File: generate_loader_rc.py

package info (click to toggle)
vulkan-loader 1.4.321.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 40,684 kB
  • sloc: cpp: 314,322; ansic: 44,950; xml: 33,310; python: 5,826; asm: 3,515; makefile: 71; sh: 53
file content (31 lines) | stat: -rw-r--r-- 1,115 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3
# Copyright 2023 The Khronos Group Inc.
# Copyright 2023 Valve Corporation
# Copyright 2023 LunarG, Inc.
#
# SPDX-License-Identifier: Apache-2.0

import argparse
import sys

def main(argv):
    parser = argparse.ArgumentParser(description='Update Loader.rc for official builds')
    parser.add_argument('src')
    parser.add_argument('dst')
    parser.add_argument('--is_official', action='store_true')
    parser.set_defaults(is_official=False)
    args = parser.parse_args(argv)
    with open(args.src, 'r') as src:
        with open(args.dst, 'w') as dst:
            for line in src:
                if args.is_official:
                    if line.startswith('#define VER_FILE_DESCRIPTION_STR'):
                        dst.write(line.replace('Dev Build', '0'))
                    elif line.startswith('#define VER_FILE_VERSION_STR'):
                        dst.write(line.replace(' - Dev Build', ''))
                    else:
                        dst.write(line)
                else:
                    dst.write(line)
if __name__ == '__main__':
    sys.exit(main(sys.argv[1:]))