You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by se...@apache.org on 2016/02/07 02:03:13 UTC

svn commit: r1728906 - /comdev/reporter.apache.org/trunk/scripts/committee_info.py

Author: sebb
Date: Sun Feb  7 01:03:13 2016
New Revision: 1728906

URL: http://svn.apache.org/viewvc?rev=1728906&view=rev
Log:
Update for getjson.py

Modified:
    comdev/reporter.apache.org/trunk/scripts/committee_info.py

Modified: comdev/reporter.apache.org/trunk/scripts/committee_info.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/scripts/committee_info.py?rev=1728906&r1=1728905&r2=1728906&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/scripts/committee_info.py (original)
+++ comdev/reporter.apache.org/trunk/scripts/committee_info.py Sun Feb  7 01:03:13 2016
@@ -65,120 +65,55 @@ def PMCnames():
 
     return namejson
 
-def cycles():
+def PMCsummary():
 
+    """
+        Returns output of the form:
+        {
+         "ace": {
+           "name": "Apache ACE",
+           "chair": "Chair 1",
+           "report": [
+             "February",
+             "May",
+             "August",
+             "November"
+             ]
+           },
+         "abdera": {
+           "name": "Apache Abdera",
+           "chair": "Chair 2",
+           "report: [...]
+           },
+         ...
+        }
+        Only includes actual PMCs
+        Returns 'webservices' rather than 'ws'
+    """
     committees = cidata['committees']
 
-    cycles={}
+    namejson={}
     for ctte in committees:
         c = committees[ctte]
         if not c['pmc']:
             continue
-        cycles[ctte] = c['report']
-        # Duplicate some entries for now so the code can find them (the existing json has the duplicates)
-        if ctte == 'ws': # Special processing
-            cycles['webservices'] = cycles[ctte]
-        if ctte == 'httpd': # Special processing
-            cycles['http server'] = cycles[ctte]
-    return cycles
-
-"""
-Returns an array of entries of the form:
-
-    "abdera": {
-      "fullname": "Apache Abdera",
-      "mail_list": "abdera",
-      "established": "2008-11",
-      "report": [
-        "February",
-        "May",
-        "August",
-        "November"
-      ],
-       "reporting": 2,
-      "chair": {
-        "nick": "antelder",
-        "name": "Ant Elder"
-        },
-      "pmc": true
-      },
-
-"""
-def committees():
-
-    committees = {}
-    cttes = cidata['committees']
-    for ent in cttes:
-        ctte = cttes[ent]
-        c = {}
-        for key in ctte:
-            # some keys need special processing
-            if key == 'display_name':
-                basename = ctte['display_name']
-                c['fullname'] = "Apache %s" % ('mod_perl' if basename == 'Perl' else basename)
-            elif key == 'chair':
-                c['chair'] = None
-                for ch in ctte['chair']:
-                    c['chair'] = {
-                    'nick': ch,
-                    'name': ctte['chair'][ch]['name']}
-            elif key == 'established':
-                value = ctte[key]
-                if value:
-                    value = "%s-%s" % (value[3:7], value[0:2]) # extract year and month
-                c[key] = value
-            elif key == 'report':
-                c[key] = ctte[key] # save original values
-                value = ctte[key]
-                if 'January' in value:
-                    c['reporting'] = 1
-                elif 'February' in value:
-                    c['reporting'] = 2
-                elif 'March' in value:
-                    c['reporting'] = 3
-                elif 'Every month' in value:
-                    c['reporting'] = 0
-            else:
-                c[key] = ctte[key]
-        committees[ent]=c
-    return committees
-
-def pmcdates():
-    dates = {}
-    
-    cttes = cidata['committees']
-    for ent in cttes:
-        ctte = cttes[ent]
-        if not ctte['pmc']:
-            continue
-        roster = ctte['roster']
-        est = ctte['established']
-        date = 0
-        if not est == None:
-            # convert mm/yyyy to date (drop any subsequent text)
-            try:
-                date = calendar.timegm(time.strptime(est[0:7], '%m/%Y'))
-            except Exception as e:
-                print("Date parse error for %s: %s %s" % (ent, est, e))
-                pass
-        dates[ent] = {'pmc': [est, date], 'roster': {} }
-        ids = {}
-        for id in roster:
-            rid = roster[id]
-            try:
-                date = calendar.timegm(time.strptime(rid['date'], '%Y-%m-%d'))
-            except:
-                date = 0
-            ids[id] = [rid['name'], date]
-        dates[ent]['roster'] = ids
-        # The 'CI' internal name for Web Services is 'ws' but reporter code originally used 'webservices'
-        if ent == 'ws':
-            dates['webservices'] = dates[ent]
-    return dates
+        name = 'Apache %s' % c['display_name']
+        if ctte == 'ws': ctte = 'webservices'
+        chair = 'Unknown'
+        chs = c['chair']
+        for ch in chs: # allow for multiple chairs
+            chair = chs[ch]['name']
+            break
+        namejson[ctte] = {
+                      'name': name,
+                      'report': c['report'],
+                      'chair': chair
+                      }
+
+    return namejson
+
 
 if __name__ == '__main__':
     import sys
     json.dump(PMCnames(), sys.stdout, indent=1, sort_keys=True)
-    json.dump(cycles(), sys.stdout, indent=1, sort_keys=True)
-    json.dump(pmcdates(), sys.stdout, indent=1, sort_keys=True)
-    json.dump(committees(), sys.stdout, indent=1, sort_keys=True)
+    json.dump(PMCsummary(), sys.stdout, indent=1, sort_keys=True)