diff --git a/core/build/make-svn-rev-header.py b/core/build/make-svn-rev-header.py index 705382f8b..7876d9ff4 100644 --- a/core/build/make-svn-rev-header.py +++ b/core/build/make-svn-rev-header.py @@ -11,19 +11,27 @@ from xml.dom.minidom import parse from time import gmtime, strftime +from os.path import isfile +from sys import exit entries_file = parse('../.svn/entries') def getRevision(entries): - for entry in entries: - if entry.getAttribute("name") == "": - return entry.getAttribute("revision") + for entry in entries: + if entry.getAttribute("name") == "": + return entry.getAttribute("revision") revision = getRevision(entries_file.getElementsByTagName("entry")) +if isfile("svn-revision.h"): + infile = file("svn-revision.h", "r") + for ln in infile: + if ln == "#define BUILD_SVN_REVISION " + revision + "\n": + infile.close() + exit() + outfile = file("svn-revision.h", "w+") outfile.write("// This file is automatically generated by make-svn-rev-header.py\n") outfile.write("// Do not modify or add to revision control\n\n") outfile.write("#define BUILD_SVN_REVISION " + revision + "\n") -outfile.write("#define BUILD_TIMESTAMP \"" + strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()) + "\"\n") outfile.close() diff --git a/core/version.cpp b/core/version.cpp index 026132f94..5789762f7 100644 --- a/core/version.cpp +++ b/core/version.cpp @@ -49,13 +49,14 @@ #endif #else -#define BUILD_TIMESTAMP __DATE__ " " __TIME__ #ifndef BUILD_SVN_REVISION #define BUILD_SVN_REVISION 0 #endif #endif +#define BUILD_TIMESTAMP _T(__DATE__) _T(" ") _T(__TIME__) + // If the BUILD_SVN_REVISION happens to be negative, the build is assumed to be a public-release build (ie. not prerel) // So manually edit build/svn-revision.h to match that, when doing such a build, or add some other magic to do that. @@ -84,7 +85,7 @@ struct VersionInfoStruct { IsDebug = false; #endif SvnRev = BUILD_SVN_REVISION; - BuildTime = _T(BUILD_TIMESTAMP); + BuildTime = BUILD_TIMESTAMP; BuildCredit = _T(BUILD_CREDIT); if (SvnRev > 0)