community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1868569 - /comdev/projects.apache.org/trunk/scripts/newtlp.py
Date Thu, 17 Oct 2019 23:59:00 GMT
Author: sebb
Date: Thu Oct 17 23:59:00 2019
New Revision: 1868569

URL: http://svn.apache.org/viewvc?rev=1868569&view=rev
Log:
Don't overwrite existing file

Modified:
    comdev/projects.apache.org/trunk/scripts/newtlp.py

Modified: comdev/projects.apache.org/trunk/scripts/newtlp.py
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/trunk/scripts/newtlp.py?rev=1868569&r1=1868568&r2=1868569&view=diff
==============================================================================
--- comdev/projects.apache.org/trunk/scripts/newtlp.py (original)
+++ comdev/projects.apache.org/trunk/scripts/newtlp.py Thu Oct 17 23:59:00 2019
@@ -50,7 +50,10 @@ def update_xml(pid):
                         w.write("%s<location>committees/%s.rdf</location>\n"
% (indent, pid))
                         notYetFound = False
                     elif mid == pid:
-                        print("ERROR: File already contains %s" % pid)
+                        print("ERROR: committees.xml already contains %s" % pid)
+                        w.close()
+                        os.remove(xmlfilet)
+                        return
                 else:
                     if l.startswith("</list"): # EOF
                         w.write("%s<location>committees/%s.rdf</location>\n"
% (indent, pid))
@@ -60,6 +63,10 @@ def update_xml(pid):
 
 for arg in sys.argv[1:]:
     print("Processing "+arg)
+    outfile = os.path.join(rdfdir,"%s.%s"%(arg,'rdf'))
+    if os.path.exists(outfile):
+        print("RDF file for %s already exists!" % arg)
+        continue
     try:
         cttee = committees[arg]
         data = {
@@ -69,7 +76,6 @@ for arg in sys.argv[1:]:
             "description": cttee['description'],
         }
         out = template.substitute(data)
-        outfile = os.path.join(rdfdir,"%s.%s"%(arg,'rdf'))
         print("Creating "+outfile)
         with open(outfile,'w') as o:
             o.write(out)



Mime
View raw message