Don't generate project if the XML file already exists and is identical to what we've generated. Overridable with a "force" argument to mkproject().

This commit is contained in:
Jack Jansen 2001-01-21 22:23:13 +00:00
parent 0c94724cc7
commit d6389956cb
1 changed files with 9 additions and 1 deletions

View File

@ -4,7 +4,7 @@ import os
import AppleEvents import AppleEvents
import macfs import macfs
def mkproject(outputfile, modulename, settings): def mkproject(outputfile, modulename, settings, force=0):
# #
# Copy the dictionary # Copy the dictionary
# #
@ -29,6 +29,14 @@ def mkproject(outputfile, modulename, settings):
# #
xmlbuilder = cwxmlgen.ProjectBuilder(dictcopy) xmlbuilder = cwxmlgen.ProjectBuilder(dictcopy)
xmlbuilder.generate() 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 = open(dictcopy['mac_projectxmlname'], "w")
fp.write(dictcopy["tmp_projectxmldata"]) fp.write(dictcopy["tmp_projectxmldata"])
fp.close() fp.close()