-
Notifications
You must be signed in to change notification settings - Fork 1
/
make_komauxitems
28 lines (22 loc) · 856 Bytes
/
make_komauxitems
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
#!/usr/bin/env python
# -*- coding: latin-1 -*-
# $Id: make_komauxitems,v 1.2 2007/12/01 13:16:25 kent Exp $
# (C) 2002 Kent Engström. Released under GPL.
# Run this program after updating aux-items.txt to update
# komauxitems.py
import re
inf = open("aux-items.txt")
outf = open("./pylyskom/komauxitems.py", "w")
dictlist = []
outf.write("# AUTOGENERATED by make_komauxitems from aux-items.py\n\n")
for line in inf.readlines():
m = re.match(r"@item (.*) \[([0-9]+)\] (.*)", line)
if m:
(name, no, comment) = m.group(1,2,3)
komname = "AI_" + name.replace("-","_").upper()
outf.write("%s = %s # %s\n" % (komname, no, comment))
dictlist.append((komname, name))
outf.write("\naux_item_number_to_name = {\n")
for (komname, name) in dictlist:
outf.write(' %s: "%s",\n' % (komname, name))
outf.write("}\n")