import csv
import sys
+def isExistingProject(PMapFile, projectID) :
+ PMapReader = csv.reader(PMapFile)
+ for I in PMapReader:
+ if projectID == I[0]:
+ return True
+ return False
+
# Add a new project for testing: build it and add to the Project Map file.
# Params:
# Dir is the directory where the sources are.
print "Warning: Creating the Project Map file!!"
PMapFile = open(ProjectMapPath, "w+b")
try:
- PMapReader = csv.reader(PMapFile)
- for I in PMapReader:
- IID = I[0]
- if ID == IID:
- print >> sys.stderr, 'Warning: Project with ID \'', ID, \
- '\' already exists.'
- sys.exit(-1)
-
- PMapWriter = csv.writer(PMapFile)
- PMapWriter.writerow( (ID, int(IsScanBuild)) );
+ if (isExistingProject(PMapFile, ID)) :
+ print >> sys.stdout, 'Warning: Project with ID \'', ID, \
+ '\' already exists.'
+ print >> sys.stdout, "Reference output has been regenerated."
+ else:
+ PMapWriter = csv.writer(PMapFile)
+ PMapWriter.writerow( (ID, int(IsScanBuild)) );
+ print "The project map is updated: ", ProjectMapPath
finally:
PMapFile.close()
-
- print "The project map is updated: ", ProjectMapPath
# TODO: Add an option not to build.