summaryrefslogtreecommitdiff
path: root/abook-to-clab
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-04-17 14:06:10 +0300
committerLars Wirzenius <liw@liw.fi>2021-04-17 15:53:21 +0300
commitf236aef565c1f9c99dcf24979830b232ab6749bc (patch)
tree0d1053ad8ef0b6f7de9a74485b641b81dd85c0c4 /abook-to-clab
parente325fc5e47e5ef34969a30fc6568a58a6026f39b (diff)
downloadclab-f236aef565c1f9c99dcf24979830b232ab6749bc.tar.gz
rewrite in rust
Diffstat (limited to 'abook-to-clab')
-rwxr-xr-xabook-to-clab47
1 files changed, 0 insertions, 47 deletions
diff --git a/abook-to-clab b/abook-to-clab
deleted file mode 100755
index f182972..0000000
--- a/abook-to-clab
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/python
-
-
-import ConfigParser
-import os
-import yaml
-import sys
-
-
-records = {}
-
-for filename in sys.argv[1:]:
- cp = ConfigParser.ConfigParser()
- cp.read([filename])
- for section in cp.sections():
- if section == 'format':
- continue
- obj = {}
- for option in cp.options(section):
- assert option not in obj
- v = cp.get(section, option, raw=True)
- if ',' in v:
- vs = v.split(',')
- obj[option] = dict((str(i), x) for i, x in enumerate(vs))
- else:
- obj[option] = v
-
- assert type(obj['name']) is str
- uid = ''.join(obj['name'].split()).lower()
- if uid in records:
- r = records[uid]
- for key in obj:
- if key in r:
- v = r[key]
- if type(v) is dict:
- v[str(len(v) + 1)] = obj[key]
- else:
- r[key] = { '0': v, '1': obj[key] }
- else:
- r[key] = obj[key]
- else:
- records[uid] = obj
-
-for uid, r in records.iteritems():
- with open(os.path.join('db', uid + '.yaml'), 'w') as f:
- yaml.safe_dump(r, stream=f, default_flow_style=False)
-