-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathregenerate-qrc.py
More file actions
executable file
·35 lines (24 loc) · 953 Bytes
/
Copy pathregenerate-qrc.py
File metadata and controls
executable file
·35 lines (24 loc) · 953 Bytes
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
32
33
34
35
#!/usr/bin/env python3
import os
import argparse
HEADER = """<!-- Do not edit this file. It is generated with regenerate-qrc.py -->
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource prefix="/qutepart">"""
FOOTER = """ </qresource>
</RCC>"""
def parse_args():
parser = argparse.ArgumentParser(description='Regenerate .qrc Qt resource file with list of syntax files')
parser.add_argument('--xml_path', default='./syntax')
parser.add_argument('--out_file', default='syntax-files.qrc')
return parser.parse_args()
def main():
args = parse_args()
with open(args.out_file, 'w') as out_file:
print(HEADER, file=out_file)
for file_name in os.listdir(args.xml_path):
if file_name.endswith('.xml'):
print(' <file>{}/{}</file>'.format(args.xml_path, file_name), file=out_file)
print(FOOTER, file=out_file)
print("Done. Do not forget to commit the changes")
main()