diff options
author | Brad King <brad.king@kitware.com> | 2007-11-12 22:34:14 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2007-11-12 22:34:14 (GMT) |
commit | f8a5d485a064820b62f8a853d107cb23c114efb0 (patch) | |
tree | ee0497f84f348a151a503443a9eb86bd39c3f430 /Source/kwsys/kwsysDateStamp.py | |
parent | a546ba7ed496312137202cdb356ebf739350cf5e (diff) | |
download | CMake-f8a5d485a064820b62f8a853d107cb23c114efb0.zip CMake-f8a5d485a064820b62f8a853d107cb23c114efb0.tar.gz CMake-f8a5d485a064820b62f8a853d107cb23c114efb0.tar.bz2 |
ENH: Adding DateStamp feature to KWSys. This provides a header file giving preprocessor access to a dated version. The 'datestamp' will be updated automatically every day by a script.
Diffstat (limited to 'Source/kwsys/kwsysDateStamp.py')
-rwxr-xr-x | Source/kwsys/kwsysDateStamp.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Source/kwsys/kwsysDateStamp.py b/Source/kwsys/kwsysDateStamp.py new file mode 100755 index 0000000..4370c8a --- /dev/null +++ b/Source/kwsys/kwsysDateStamp.py @@ -0,0 +1,32 @@ +#!/usr/bin/python + +import sys,os +import time + +# Get the path to the directory containing this script. +if __name__ == '__main__': + selfdir = os.path.abspath(sys.path[0] or os.curdir) +else: + selfdir = os.path.abspath(os.path.dirname(__file__)) + +# Open the CMake code file. +fname = os.path.join(selfdir, 'kwsysDateStamp.cmake') +fout = open(fname, 'w'); + +# Get the current time. +ct = time.localtime() + +# Write the CMake code describing the date. +fout.write("""# Do not edit! Generated by kwsysDateStamp.py + +# KWSys version date year component. Format is CCYY. +SET(KWSYS_VERSION_DATE_YEAR %04u) + +# KWSys version date month component. Format is MM. +SET(KWSYS_VERSION_DATE_MONTH %02u) + +# KWSys version date day component. Format is DD. +SET(KWSYS_VERSION_DATE_DAY %02u) +""" % (ct.tm_year, ct.tm_mon, ct.tm_mday)) + +fout.close() |