Commit a241ca04 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).

From: Marco Clemencic <marco.clemencic@cern.ch>


git-svn-id: svn+ssh://svn.cern.ch/reps/gaudi/Gaudi/trunk@6969 53ecefc3-a64d-0410-9bdf-b8581fa3287e
parent bd9d860a
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).
! 2012-06-29 - Marco Clemencic
- Fixed compilation problem with Boost 1.49 (foreseen for LCGCMT 65).
......
......@@ -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()
Markdown is supported
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