Skip to content

Commit 4803c75

Browse files
Merge pull request #313 from mkoeppe/devmap_better_trac_search
Developer map: Display Trac account name, improve search
2 parents b0acfa1 + 43fae19 commit 4803c75

File tree

2 files changed

+33
-13
lines changed

2 files changed

+33
-13
lines changed

conf/contributors.xml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2103,6 +2103,7 @@ Please keep the list in alphabetical order by last name!
21032103
trac="mkohlhase"/>
21042104
<contributor
21052105
name="Matthias Köppe"
2106+
altnames="Matthias Koeppe"
21062107
work="Professor, UC Davis"
21072108
location="Davis, CA, USA"
21082109
description="build system (2016-2022); continuous integration (2020-2022); modularization (2020-2022); polyhedral geometry and optimization (2015-2022); manifolds (2021-2022)"
@@ -2176,11 +2177,6 @@ Please keep the list in alphabetical order by last name!
21762177
url="https://jplab.github.io/"
21772178
trac="jipilab"
21782179
github="jplab"/>
2179-
<contributor
2180-
name="Jean-Philippe Labbé"
2181-
location="BMS-Freie Universitat, Berlin, Germany"
2182-
url="http://page.mi.fu-berlin.de/labbe"
2183-
trac="jipilab"/>
21842180
<contributor
21852181
name="Sébastien Labbé"
21862182
work="CNRS researcher, LaBRI, Université de Bordeaux"

scripts/geocode.py

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,14 @@
3333

3434
# google key for sagemath.org - no longer a free one available
3535
# this is an "api key" credential for GCP's "Geocode API"
36-
gkey = open(os.path.expanduser("~/geocode.key")).read().strip()
36+
try:
37+
gkey = open(os.path.expanduser("~/geocode.key")).read().strip()
38+
except FileNotFoundError:
39+
gkey = None
3740

3841
# allowed attributes in source xml, for checkXML
3942
goodKeys = [
40-
"name", "location", "work", "description", "url", "pix", "size", "jitter",
43+
"name", "altnames", "location", "work", "description", "url", "pix", "size", "jitter",
4144
"trac", "github", "gitlab"
4245
]
4346

@@ -95,11 +98,13 @@ def writeToDevmap():
9598
if c.tagName != "contributor":
9699
continue
97100
dev = c.getAttribute("name")
101+
altnames = c.getAttribute("altnames")
98102
loc = c.getAttribute("location")
99103
work = c.getAttribute("work")
100104
descr = c.getAttribute("description")
101105
url = c.getAttribute("url")
102106
trac = c.getAttribute("trac")
107+
github = c.getAttribute("github")
103108

104109
tr = devmap.createElement("tr")
105110
td = devmap.createElement("td")
@@ -134,14 +139,31 @@ def writeToDevmap():
134139
d_el = parseString("<span>%s</span>" % d)
135140
td.appendChild(d_el.firstChild)
136141

137-
if len(trac) == 0:
138-
trac = dev
139-
trac = trac.replace(" ", "%20")
140142
a = devmap.createElement("a")
141-
a.setAttribute("href", tracSearch + trac)
143+
tracQuery = f"https://trac.sagemath.org/query?"
144+
main_trac = None
145+
trac_list = [t.strip() for t in trac.split(',') if t.strip()]
146+
gh_trac_list = [f'gh-{gh.strip()}' for gh in github.split(',') if gh.strip()]
147+
for trac in trac_list + gh_trac_list:
148+
if not main_trac:
149+
main_trac = trac
150+
tracQuery += f"&or&cc=~{trac}"
151+
tracQuery += f"&or&reporter=~{trac}"
152+
tracQuery += f"&or&owner=~{trac}"
153+
for name in [dev] + altnames.split(','):
154+
name = name.strip()
155+
if not name:
156+
continue
157+
tracQuery += f"&or&author=~{name}"
158+
tracQuery += f"&or&reviewer=~{name}"
159+
tracQuery += "&max=500&col=id&col=summary&col=author&col=status&col=priority&col=milestone&col=reviewer&order=priority"
160+
tracQuery = tracQuery.replace(" ", "%20")
161+
a.setAttribute("href", tracQuery)
142162
a.setAttribute("class", "trac")
143-
#a.setAttribute("target", "_blank")
144-
a.appendChild(devmap.createTextNode("contributions"))
163+
if main_trac:
164+
a.appendChild(devmap.createTextNode(f"contributions (trac: {main_trac})"))
165+
else:
166+
a.appendChild(devmap.createTextNode(f"contributions (trac)"))
145167
td.appendChild(devmap.createElement("br"))
146168
td.appendChild(a)
147169

@@ -189,6 +211,8 @@ def getGeo(loc):
189211
CSV Geo returns: [200,6,42.730070,-73.690570]
190212
[retcode,accuracy,lng,lat]
191213
"""
214+
if not gkey:
215+
return None
192216
loc = loc.replace(" ", "+")
193217
loc = quote(loc.encode('UTF-8'))
194218
print(loc, ">>>", end="")

0 commit comments

Comments
 (0)