3 #############################################################
4 # This tool is used to generate the version info file #
5 #############################################################
9 # ensure that PLATINUM_HOME has been set and exists
10 if not os
.environ
.has_key('PLATINUM_KIT_HOME'):
11 print 'ERROR: PLATINUM_KIT_HOME not set'
13 PLATINUM_KIT_HOME
= os
.environ
['PLATINUM_KIT_HOME']
15 # ensure that PLATINUM_KIT_HOME has been set and exists
16 if not os
.path
.exists(PLATINUM_KIT_HOME
) :
17 print 'ERROR: PLATINUM_KIT_HOME ('+PLATINUM_KIT_HOME
+') does not exist'
20 print 'PLATINUM_KIT_HOME = ' + PLATINUM_KIT_HOME
22 # get the SVN repo version
23 version
= os
.popen('svnversion -n').readlines()[0]
24 print 'current VERSION =',version
25 if version
.endswith('P'):
26 version
= version
[0:-1]
27 if version
.endswith('MP'):
28 version
= version
[0:-2]
30 version_int
= int(version
)+1 ## add one, because when we check it in, the rev will be incremented by one
32 print 'ERROR: you cannot run this on a modified working copy'
36 output
= open(PLATINUM_KIT_HOME
+'/Platinum/Source/Platinum/PltSvnVersion.h', 'w+')
37 output
.write('/* DO NOT EDIT. This file was automatically generated by GenSvnVersionHeader.py */\n')
38 output
.write('#define PLT_SVN_VERSION '+str(version_int
)+'\n')
39 output
.write('#define PLT_SVN_VERSION_STRING "'+str(version_int
)+'"\n')
41 print 'upon check-in, version will be', str(version_int
)