community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1690546 - /comdev/projects.apache.org/scripts/cronjobs/podlings.py
Date Sun, 12 Jul 2015 22:57:12 GMT
Author: sebb
Date: Sun Jul 12 22:57:12 2015
New Revision: 1690546

URL: http://svn.apache.org/r1690546
Log:
EOL

Modified:
    comdev/projects.apache.org/scripts/cronjobs/podlings.py   (contents, props changed)

Modified: comdev/projects.apache.org/scripts/cronjobs/podlings.py
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/scripts/cronjobs/podlings.py?rev=1690546&r1=1690545&r2=1690546&view=diff
==============================================================================
--- comdev/projects.apache.org/scripts/cronjobs/podlings.py (original)
+++ comdev/projects.apache.org/scripts/cronjobs/podlings.py Sun Jul 12 22:57:12 2015
@@ -1,123 +1,123 @@
-from xml.dom import minidom
-import re, urllib.request
-import json
-from datetime import datetime
-
-"""
-Reads http://incubator.apache.org/podlings.xml
-Creates:
-../../site/json/foundation/podlings.json
-../../site/json/foundation/podlings-history.json
-
-"""
-
-data = urllib.request.urlopen("http://incubator.apache.org/podlings.xml").read()
-xmldoc = minidom.parseString(data)
-itemlist = xmldoc.getElementsByTagName('podling') 
-
-new = {}
-grads = {}
-ret = {}
-current  = 0
-cpods = {}
-cpodsHistory = {}
-
-fieldnames = ['month', 'new', 'graduated', 'retired']
-for year in range(2003,2016):
-    for month in range(1,13):
-        m = "%u-%02u" % (year, month)
-        grads[m] = 0
-        new[m] = 0
-        ret[m] = 0
-
-for s in itemlist :
-        name = s.attributes['name'].value
-        uname = s.attributes['resource'].value
-        status = s.attributes['status'].value
-        sd = s.attributes['startdate'].value
-        ed = s.attributes['enddate'].value if 'enddate' in s.attributes else None
-        desc = "No description"
-        for c in s.childNodes:
-            if c.__class__.__name__ != 'Text' and c.tagName == 'description':
-                desc = c.childNodes[0].data
-                break
-        #print(name, status, sd, ed)
-        if sd and re.match(r"(\d{4}-\d+)", sd):
-            sd = re.match(r"(\d{4}-\d+)", sd).group(1)
-        if ed and re.match(r"(\d{4}-\d+)", ed):
-            ed = re.match(r"(\d{4}-\d+)", ed).group(1)
-
-        new[sd] += 1
-        if status == "graduated":
-            if not ed:
-                ed = sd
-                print("%s did not specify a graduation date, assuming %s!" % (name,ed))
-            grads[ed] += 1
-            cpodsHistory[uname] = {
-                'started': sd,
-                'status': status,
-                'ended': ed,
-                'name': "Apache %s (Incubating)" % name,
-                'description': desc,
-                'homepage': "http://%s.incubator.apache.org/" % uname
-            }
-        elif status == "retired":
-            if not ed:
-                ed = sd
-                print("%s did not specify a retirement date, assuming %s!" % (name,ed))
-            ret[ed] += 1
-            cpodsHistory[uname] = {
-                'started': sd,
-                'status': status,
-                'ended': ed,
-                'name': "Apache %s (Incubating)" % name,
-                'description': desc,
-                'homepage': "http://%s.incubator.apache.org/" % uname
-            }
-        elif status == "current":
-            current += 1
-            cpods[uname] = {
-                'started': sd,
-                'name': "Apache %s (Incubating)" % name,
-                'pmc': 'incubator',
-                'description': desc,
-                'homepage': "http://%s.incubator.apache.org/" % uname,
-                'podling': True
-            }
-
-currentMonth = datetime.now().month
-currentYear = datetime.now().year
-
-js = []
-for year in range(2003,2016):
-    for month in range(1,13):
-        m = "%u-%02u" % (year, month)
-        mjs = {
-            'month': m,
-            'new': new[m],
-            'graduated': grads[m],
-            'retired': ret[m],
-            'current': 0
-        }
-        if currentYear > year or (currentYear == year and currentMonth >= month):
-            js.append(mjs)
-
-js.reverse()
-
-for i in js:
-    i['current'] = current
-    current -= i['new']
-    current += i['graduated']
-    current += i['retired']
-    
-print("Writing podlings.json")
-with open('../../site/json/foundation/podlings.json', 'w') as f:
-    f.write(json.dumps(cpods, sort_keys=True, indent=0))
-    f.close()
-
-print("Writing podlings-history.json")
-with open('../../site/json/foundation/podlings-history.json', 'w') as f:
-    f.write(json.dumps(cpodsHistory, sort_keys=True, indent=0))
-    f.close()
-
-print("All done!")
+from xml.dom import minidom
+import re, urllib.request
+import json
+from datetime import datetime
+
+"""
+Reads http://incubator.apache.org/podlings.xml
+Creates:
+../../site/json/foundation/podlings.json
+../../site/json/foundation/podlings-history.json
+
+"""
+
+data = urllib.request.urlopen("http://incubator.apache.org/podlings.xml").read()
+xmldoc = minidom.parseString(data)
+itemlist = xmldoc.getElementsByTagName('podling') 
+
+new = {}
+grads = {}
+ret = {}
+current  = 0
+cpods = {}
+cpodsHistory = {}
+
+fieldnames = ['month', 'new', 'graduated', 'retired']
+for year in range(2003,2016):
+    for month in range(1,13):
+        m = "%u-%02u" % (year, month)
+        grads[m] = 0
+        new[m] = 0
+        ret[m] = 0
+
+for s in itemlist :
+        name = s.attributes['name'].value
+        uname = s.attributes['resource'].value
+        status = s.attributes['status'].value
+        sd = s.attributes['startdate'].value
+        ed = s.attributes['enddate'].value if 'enddate' in s.attributes else None
+        desc = "No description"
+        for c in s.childNodes:
+            if c.__class__.__name__ != 'Text' and c.tagName == 'description':
+                desc = c.childNodes[0].data
+                break
+        #print(name, status, sd, ed)
+        if sd and re.match(r"(\d{4}-\d+)", sd):
+            sd = re.match(r"(\d{4}-\d+)", sd).group(1)
+        if ed and re.match(r"(\d{4}-\d+)", ed):
+            ed = re.match(r"(\d{4}-\d+)", ed).group(1)
+
+        new[sd] += 1
+        if status == "graduated":
+            if not ed:
+                ed = sd
+                print("%s did not specify a graduation date, assuming %s!" % (name,ed))
+            grads[ed] += 1
+            cpodsHistory[uname] = {
+                'started': sd,
+                'status': status,
+                'ended': ed,
+                'name': "Apache %s (Incubating)" % name,
+                'description': desc,
+                'homepage': "http://%s.incubator.apache.org/" % uname
+            }
+        elif status == "retired":
+            if not ed:
+                ed = sd
+                print("%s did not specify a retirement date, assuming %s!" % (name,ed))
+            ret[ed] += 1
+            cpodsHistory[uname] = {
+                'started': sd,
+                'status': status,
+                'ended': ed,
+                'name': "Apache %s (Incubating)" % name,
+                'description': desc,
+                'homepage': "http://%s.incubator.apache.org/" % uname
+            }
+        elif status == "current":
+            current += 1
+            cpods[uname] = {
+                'started': sd,
+                'name': "Apache %s (Incubating)" % name,
+                'pmc': 'incubator',
+                'description': desc,
+                'homepage': "http://%s.incubator.apache.org/" % uname,
+                'podling': True
+            }
+
+currentMonth = datetime.now().month
+currentYear = datetime.now().year
+
+js = []
+for year in range(2003,2016):
+    for month in range(1,13):
+        m = "%u-%02u" % (year, month)
+        mjs = {
+            'month': m,
+            'new': new[m],
+            'graduated': grads[m],
+            'retired': ret[m],
+            'current': 0
+        }
+        if currentYear > year or (currentYear == year and currentMonth >= month):
+            js.append(mjs)
+
+js.reverse()
+
+for i in js:
+    i['current'] = current
+    current -= i['new']
+    current += i['graduated']
+    current += i['retired']
+    
+print("Writing podlings.json")
+with open('../../site/json/foundation/podlings.json', 'w') as f:
+    f.write(json.dumps(cpods, sort_keys=True, indent=0))
+    f.close()
+
+print("Writing podlings-history.json")
+with open('../../site/json/foundation/podlings-history.json', 'w') as f:
+    f.write(json.dumps(cpodsHistory, sort_keys=True, indent=0))
+    f.close()
+
+print("All done!")

Propchange: comdev/projects.apache.org/scripts/cronjobs/podlings.py
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message