summaryrefslogtreecommitdiff
blob: c83a7440e279786688f8f682020f6aa29ce9877c (plain)
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 python
# -*- coding: utf-8 -*-
# Written by Sebastian Pipping <sebastian@pipping.org>
# Licensed under GPL v2 or later

from __future__ import print_function
import xml.etree.ElementTree as ET  # Python 2.5
import sys


def main(args):
	if len(args) != 2:
		print('USAGE:  %s GENTOO/xml/htdocs/proj/en/devrel/roll-call/userinfo.xml' % args[0])
		return 1

	try:
		userlist = ET.parse(args[1])
	except IOError as e:
		print(str(e), file=sys.stderr)
		return 1

	for user in userlist.findall('user'):
		nick = user.attrib['username']
		location = user.find('location')
		realname = user.find('realname').attrib['fullname'].strip()

		line = '%s = %s <%s@gentoo.org>' % (nick, realname, nick)
		print(line.encode('utf-8'))

	return 0


if __name__ == '__main__':
	ret = main(sys.argv)
	sys.exit(ret)