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 2015/07/13 00:45:48 UTC
svn commit: r1690543 -
/comdev/projects.apache.org/scripts/cronjobs/countaccounts.py
Author: sebb
Date: Sun Jul 12 22:45:48 2015
New Revision: 1690543
URL: http://svn.apache.org/r1690543
Log:
Set EOL
Modified:
comdev/projects.apache.org/scripts/cronjobs/countaccounts.py (contents, props changed)
Modified: comdev/projects.apache.org/scripts/cronjobs/countaccounts.py
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/scripts/cronjobs/countaccounts.py?rev=1690543&r1=1690542&r2=1690543&view=diff
==============================================================================
--- comdev/projects.apache.org/scripts/cronjobs/countaccounts.py (original)
+++ comdev/projects.apache.org/scripts/cronjobs/countaccounts.py Sun Jul 12 22:45:48 2015
@@ -1,59 +1,59 @@
-#!/usr/bin/env python
-
-"""
-Extracts data showing the number of accounts created each month.
-
-Updates:
-../../site/json/foundation/accounts-evolution.json
-
-using the output from
-ldapsearch -x -LLL -b ou=people,dc=apache,dc=org createTimestamp
-
-The output file consists of lines of the form:
-{
-"1999-02": 22,
-"1999-03": 0,
-}
-
-N.B. The script currently only updates the entry for the current month.
-
-"""
-
-import json;
-import re
-from datetime import datetime
-import subprocess
-
-js = {}
-with open("../../site/json/foundation/accounts-evolution.json") as f:
- js = json.loads(f.read())
- f.close()
-
-now = datetime.now() # fetch time once
-currentMonth = now.month
-currentYear = now.year
-ym = "%04u-%02u" % (currentYear, currentMonth)
-tym = "%04u%02u" % (currentYear, currentMonth)
-print("Looking for entries for %s" % tym)
-js[ym] = 0
-
-proc = subprocess.Popen(['ldapsearch','-x', '-LLL', '-b', 'ou=people,dc=apache,dc=org', 'createTimestamp'],stdout=subprocess.PIPE)
-
-while True:
- line = proc.stdout.readline()
- if not line or line == "":
- break
- line = line.decode('utf-8')
- # Sample output:
- # createTimestamp: 20150330152151Z
- m = re.search(r"createTimestamp: (\d\d\d\d\d\d)", line)
- if m:
- if m.group(1) == tym:
- js[ym] += 1
-
-
-with open("../../site/json/foundation/accounts-evolution.json", "w") as f:
- f.write(json.dumps(js, sort_keys=True, indent=0))
- f.close()
-
+#!/usr/bin/env python
+
+"""
+Extracts data showing the number of accounts created each month.
+
+Updates:
+../../site/json/foundation/accounts-evolution.json
+
+using the output from
+ldapsearch -x -LLL -b ou=people,dc=apache,dc=org createTimestamp
+
+The output file consists of lines of the form:
+{
+"1999-02": 22,
+"1999-03": 0,
+}
+
+N.B. The script currently only updates the entry for the current month.
+
+"""
+
+import json;
+import re
+from datetime import datetime
+import subprocess
+
+js = {}
+with open("../../site/json/foundation/accounts-evolution.json") as f:
+ js = json.loads(f.read())
+ f.close()
+
+now = datetime.now() # fetch time once
+currentMonth = now.month
+currentYear = now.year
+ym = "%04u-%02u" % (currentYear, currentMonth)
+tym = "%04u%02u" % (currentYear, currentMonth)
+print("Looking for entries for %s" % tym)
+js[ym] = 0
+
+proc = subprocess.Popen(['ldapsearch','-x', '-LLL', '-b', 'ou=people,dc=apache,dc=org', 'createTimestamp'],stdout=subprocess.PIPE)
+
+while True:
+ line = proc.stdout.readline()
+ if not line or line == "":
+ break
+ line = line.decode('utf-8')
+ # Sample output:
+ # createTimestamp: 20150330152151Z
+ m = re.search(r"createTimestamp: (\d\d\d\d\d\d)", line)
+ if m:
+ if m.group(1) == tym:
+ js[ym] += 1
+
+
+with open("../../site/json/foundation/accounts-evolution.json", "w") as f:
+ f.write(json.dumps(js, sort_keys=True, indent=0))
+ f.close()
+
print("Done, found %u entries for this month" % js[ym])
\ No newline at end of file
Propchange: comdev/projects.apache.org/scripts/cronjobs/countaccounts.py
------------------------------------------------------------------------------
svn:eol-style = native