Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit af4c942

Browse files
committed
Better test for skipping project creation: the project file should also exist and be newer than the xml file, and the .exp should exist.
1 parent a120ffc commit af4c942

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

Mac/Lib/mkcwproject/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,20 @@ def mkproject(outputfile, modulename, settings, force=0):
3030
xmlbuilder = cwxmlgen.ProjectBuilder(dictcopy)
3131
xmlbuilder.generate()
3232
if not force:
33-
# check whether it is the same as it was
33+
# We do a number of checks and all must succeed before we decide to
34+
# skip the build-project step:
35+
# 1. the xml file must exist, and its content equal to what we've generated
36+
# 2. the project file must exist and be newer than the xml file
37+
# 3. the .exp file must exist
3438
if os.path.exists(dictcopy['mac_projectxmlname']):
3539
fp = open(dictcopy['mac_projectxmlname'])
3640
data = fp.read()
3741
fp.close()
3842
if data == dictcopy["tmp_projectxmldata"]:
39-
return
43+
if os.path.exists(outputfile) and \
44+
os.stat(outputfile)[os.path.ST_MTIME] > os.stat(dictcopy['mac_projectxmlname'])[os.path.ST_MTIME]:
45+
if os.path.exists(outputfile + '.exp'):
46+
return
4047
fp = open(dictcopy['mac_projectxmlname'], "w")
4148
fp.write(dictcopy["tmp_projectxmldata"])
4249
fp.close()

0 commit comments

Comments
 (0)