community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1702526 - /comdev/reporter.apache.org/trunk/readjira.py
Date Fri, 11 Sep 2015 17:54:06 GMT
Author: sebb
Date: Fri Sep 11 17:54:06 2015
New Revision: 1702526

URL: http://svn.apache.org/r1702526
Log:
Extract parent directory as constant

Modified:
    comdev/reporter.apache.org/trunk/readjira.py

Modified: comdev/reporter.apache.org/trunk/readjira.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/readjira.py?rev=1702526&r1=1702525&r2=1702526&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/readjira.py (original)
+++ comdev/reporter.apache.org/trunk/readjira.py Fri Sep 11 17:54:06 2015
@@ -4,14 +4,16 @@ import re, os, json, urllib2, base64, ti
 from os import listdir
 from os.path import isfile, join
 
-mypath = "/var/www/reporter.apache.org/data/JIRA"
+MYHOME = "/var/www/reporter.apache.org"
+mypath = "%s/data/JIRA" % MYHOME
+print("Scanning mypath=%s" % mypath)
 myfiles = [ f for f in listdir(mypath) if isfile(join(mypath,f)) ]
 
 jirapass = ""
-with open("/var/www/reporter.apache.org/data/jirapass.txt", "r") as f:
+with open("%s/data/jirapass.txt" % MYHOME, "r") as f:
     jirapass = f.read().strip()
     f.close()
-    
+
 def getJIRAS(project):
     refresh = True
     if refresh:
@@ -24,12 +26,12 @@ def getJIRAS(project):
             req = urllib2.Request("""https://issues.apache.org/jira/rest/api/2/search?jql=project%20=%20"""
+ project + """%20AND%20resolved%20%3E=%20-91d""")
             req.add_header("Authorization", "Basic %s" % base64string)
             rdata = json.loads(urllib2.urlopen(req).read())
-            with open("/var/www/reporter.apache.org/data/JIRA/%s.json" % project, "w") as
f:
+            with open("%s/data/JIRA/%s.json" % (MYHOME, project), "w") as f:
                 f.write(json.dumps([cdata['total'], rdata['total'], project], indent=1))
                 f.close()
             return cdata['total'], rdata['total'], project
         except Exception as err:
-            with open("/var/www/reporter.apache.org/data/JIRA/%s.json" % project, "w") as
f:
+            with open("%s/data/JIRA/%s.json" % (MYHOME, project), "w") as f:
                 f.write(json.dumps([0,0,None], indent=1))
                 f.close()
             return 0,0, None
@@ -40,4 +42,5 @@ for project in myfiles:
         print("Refreshing JIRA stats for " + jiraname)
         getJIRAS(jiraname)
         time.sleep(2)
-    
\ No newline at end of file
+
+print("Done")
\ No newline at end of file



Mime
View raw message