chiark / gitweb /
sysusers: fix uninitialized warning
[elogind.git] / src / locale / generate-kbd-model-map
1 import sys
2 import system_config_keyboard.keyboard_models
3
4 def strdash(s):
5         return s.strip() or '-'
6
7 def tab_extend(s, n=1):
8         s = strdash(s)
9         k = len(s) // 8
10
11         if k >= n:
12                 f = 1
13         else:
14                 f = n - k
15
16         return s + '\t'*f
17
18
19 models = system_config_keyboard.keyboard_models.KeyboardModels().get_models()
20
21 print "# Generated from system-config-keyboard's model list"
22 print "# consolelayout\t\txlayout\txmodel\t\txvariant\txoptions"
23
24 for key, value in reversed(models.items()):
25         options = "terminate:ctrl_alt_bksp"
26         if value[4]:
27                 options += ',' + value[4]
28
29         print ''.join((tab_extend(key, 3), tab_extend(value[1]),
30                        tab_extend(value[2], 2), tab_extend(value[3], 2),
31                        options))