233ac6ac94
Originally committed to SVN as r250.
27 lines
902 B
Python
27 lines
902 B
Python
#!/usr/bin/env python
|
|
# This file is used to automatically extract the SVN revision number and
|
|
# create a C include file.
|
|
|
|
# In MSVS, you can add the following Pre-Build Step to use this script:
|
|
# cd $(InputDir)core\build
|
|
# c:\Python24\python.exe make-svn-rev-header.py
|
|
|
|
# This is intended for use with a custom version.cpp,
|
|
# as described in version.cpp
|
|
|
|
from xml.dom.minidom import parse
|
|
|
|
entries_file = parse('../.svn/entries')
|
|
|
|
def getRevision(entries):
|
|
for entry in entries:
|
|
if entry.getAttribute("name") == "":
|
|
return entry.getAttribute("revision")
|
|
|
|
revision = getRevision(entries_file.getElementsByTagName("entry"))
|
|
|
|
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.close()
|