[commit] r1983 - trunk/Install/Build

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Mon Jul 30 13:17:18 CDT 2012


Author: ksmyth
Date: Mon Jul 30 13:17:18 2012
New Revision: 1983

Log:
Dont update GMEVersion.h if it hasnt changed

Modified:
   trunk/Install/Build/build.py

Modified: trunk/Install/Build/build.py
==============================================================================
--- trunk/Install/Build/build.py	Mon Jul 30 13:17:07 2012	(r1982)
+++ trunk/Install/Build/build.py	Mon Jul 30 13:17:18 2012	(r1983)
@@ -82,10 +82,18 @@
 
 def update_version_str():
     "Update version strings in source files"
-    with file(os.path.join(GME_ROOT, 'GME/Gme/GMEVersion.h.tmpl')) as template:
-        template_text = "".join(file.readlines(template))
-    with file(os.path.join(GME_ROOT, 'GME/Gme/GMEVersion.h'), 'w') as header:
-        header.write(template_text % (prefs["version_major"], prefs["version_minor"], prefs["version_patch"], prefs["version_build"]))
+    with open(os.path.join(GME_ROOT, 'GME/Gme/GMEVersion.h.tmpl')) as template:
+        template_text = "".join(template.readlines())
+    old_text = None
+    try:
+        with open(os.path.join(GME_ROOT, 'GME/Gme/GMEVersion.h')) as header:
+            old_text = "".join(header.readlines())
+    except:
+        pass
+    text = template_text % (prefs["version_major"], prefs["version_minor"], prefs["version_patch"], prefs["version_build"])
+    if text != old_text:
+        with open(os.path.join(GME_ROOT, 'GME/Gme/GMEVersion.h'), 'w') as header:
+            header.write(text)
 
 def compile_GME():
     "Compile GME core components"


More information about the gme-commit mailing list