diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2001-01-21 22:23:13 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2001-01-21 22:23:13 (GMT) |
commit | d6389956cb2eec713458a7447b121738b53a5244 (patch) | |
tree | 919ce01bd77570b4bb803840d46ecc7611772e17 /Mac/Lib/mkcwproject | |
parent | 0c94724cc77a004973fb0105417c084234c2da73 (diff) | |
download | cpython-d6389956cb2eec713458a7447b121738b53a5244.zip cpython-d6389956cb2eec713458a7447b121738b53a5244.tar.gz cpython-d6389956cb2eec713458a7447b121738b53a5244.tar.bz2 |
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().
Diffstat (limited to 'Mac/Lib/mkcwproject')
-rw-r--r-- | Mac/Lib/mkcwproject/__init__.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Mac/Lib/mkcwproject/__init__.py b/Mac/Lib/mkcwproject/__init__.py index ff5ddd9..387108d 100644 --- a/Mac/Lib/mkcwproject/__init__.py +++ b/Mac/Lib/mkcwproject/__init__.py @@ -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() |