]> granicus.if.org Git - python/commitdiff
Don't generate project if the XML file already exists and is identical to what we...
authorJack Jansen <jack.jansen@cwi.nl>
Sun, 21 Jan 2001 22:23:13 +0000 (22:23 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Sun, 21 Jan 2001 22:23:13 +0000 (22:23 +0000)
Mac/Lib/mkcwproject/__init__.py

index ff5ddd98122c9f9c19449a0edef508328e332dc0..387108dec29ea5688fa7600d8dcb4003668793c6 100644 (file)
@@ -4,7 +4,7 @@ import os
 import AppleEvents
 import macfs
 
-def mkproject(outputfile, modulename, settings):
+def mkproject(outputfile, modulename, settings, force=0):
        #
        # Copy the dictionary
        #
@@ -29,6 +29,14 @@ def mkproject(outputfile, modulename, settings):
        #
        xmlbuilder = cwxmlgen.ProjectBuilder(dictcopy)
        xmlbuilder.generate()
+       if not force:
+               # check whether it is the same as it was
+               if os.path.exists(dictcopy['mac_projectxmlname']):
+                       fp = open(dictcopy['mac_projectxmlname'])
+                       data = fp.read()
+                       fp.close()
+                       if data == dictcopy["tmp_projectxmldata"]:
+                               return
        fp = open(dictcopy['mac_projectxmlname'], "w")
        fp.write(dictcopy["tmp_projectxmldata"])
        fp.close()