aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Øyvind Karlsen <proyvind@moondrake.org>2016-06-01 06:26:37 +0200
committerPer Øyvind Karlsen <proyvind@moondrake.org>2016-06-01 06:26:37 +0200
commit12db22b6c9de3e9ea4ca2b6246f6abfd1b66818b (patch)
treebf7c8fbf3bcdcfb8677963b1f0ff6b6a399e7bda
parentbe52a32e4719d86251c9c651e0e09510e183e7e9 (diff)
downloadmgarepo-12db22b6c9de3e9ea4ca2b6246f6abfd1b66818b.tar
mgarepo-12db22b6c9de3e9ea4ca2b6246f6abfd1b66818b.tar.gz
mgarepo-12db22b6c9de3e9ea4ca2b6246f6abfd1b66818b.tar.bz2
mgarepo-12db22b6c9de3e9ea4ca2b6246f6abfd1b66818b.tar.xz
mgarepo-12db22b6c9de3e9ea4ca2b6246f6abfd1b66818b.zip
rather get more up to date list of users from https://people.mageia.org/u/
-rw-r--r--MgaRepo/log.py35
1 files changed, 30 insertions, 5 deletions
diff --git a/MgaRepo/log.py b/MgaRepo/log.py
index 980429b..126e8c0 100644
--- a/MgaRepo/log.py
+++ b/MgaRepo/log.py
@@ -561,15 +561,40 @@ def get_old_log(pkgdirurl):
chlog.seek(0)
return chlog
+from html.parser import HTMLParser
+class TagParser(HTMLParser):
+ li = False
+ ahref = False
+ namepat = re.compile("(?P<name>.*?)\s*\((?P<user>.*?)\)")
+
+ def handle_starttag(self, tag, attrs):
+ if tag == "li":
+ self.li = True
+ if self.li and tag == "a":
+ for att in attrs:
+ if att[0] == "href":
+ self.ahref = True
+
+ def handle_endtag(self, tag):
+ if self.li and tag == "a":
+ self.ahref = False
+ if tag == "li":
+ self.li = False
+
+ def handle_data(self, data):
+ if self.li and self.ahref:
+ found = self.namepat.match(data)
+ if found and found.group("user") and found.group("name"):
+ usermap[found.group("user")] = "%s <%s@mageia.org>" % (found.group("name"), found.group("user"))
+
def _map_user_names():
import urllib.request
if not usermap:
- # This user map is from 2013-08-24, so it's rather dated, but sufficing for those listed...
- f = urllib.request.urlopen("http://gitweb.mageia.org/software/infrastructure/svn-git-migration/plain/metadata/mageia-user-map.txt")
- for user in f.read().decode("UTF-8").splitlines():
- username, namemail = user.split(" = ")
- usermap[username] = namemail
+ f = urllib.request.urlopen("https://people.mageia.org/u/")
+ users = f.read().decode("UTF-8")
f.close()
+ parser = TagParser()
+ parser.feed(users)
def get_changelog(pkgdirurl, another=None, svn=True, rev=None, size=None,
submit=False, sort=False, template=None, macros=[], exported=None,