Commit 1de10739 authored by Marco Clemencic's avatar Marco Clemencic
Browse files

modified createProjVersHeader.py write only if there are changes

Modified the script createProjVersHeader.py to modify the destination
file only if there are changes (prevents useless recompilation).
parent 8529e55d
package GaudiPolicy
package manager: Marco Clemencic
! 2012-07-20 - Marco Clemencic
- Modified the script createProjVersHeader.py to modify the destination file
only if there are changes (prevents useless recompilation).
============================= GaudiPolicy v12r1 ==============================
! 2012-06-19 - Marco Clemencic
- Small hack in GaudiTest.py to prevent spurious escape sequences in teh output
......
......@@ -27,8 +27,8 @@ def main():
print "Creating directory", outdir
os.makedirs(outdir)
open(outputfile, "w").write(
"""#ifndef %(proj)s_VERSION
# Prepare data to be written
outputdata = """#ifndef %(proj)s_VERSION
/* Automatically generated file: do not modify! */
#ifndef CALC_GAUDI_VERSION
#define CALC_GAUDI_VERSION(maj,min) (((maj) << 16) + (min))
......@@ -38,7 +38,19 @@ def main():
#define %(proj)s_PATCH_VERSION %(pat)d
#define %(proj)s_VERSION CALC_GAUDI_VERSION(%(proj)s_MAJOR_VERSION,%(proj)s_MINOR_VERSION)
#endif
"""%{ 'proj': project.upper(), 'min': minver, 'maj': majver, 'pat': patver })
""" % { 'proj': project.upper(), 'min': minver, 'maj': majver, 'pat': patver }
# Get the current content of the destination file (if any)
try:
f = open(outputfile, "r")
olddata = f.read()
f.close()
except IOError:
olddata = None
# Overwrite the file only if there are changes
if outputdata != olddata:
open(outputfile, "w").write(outputdata)
if __name__ == "__main__":
main()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment