Merge pull request #26354 from ksooo/pvr-fix-listitem-titleextrainfo
[xbmc.git] / lib / libUPnP / Platinum / Build / Tools / Scripts / GenSvnVersionHeader.py
blob9820b6da5ba729350a0a723a67496bac2158de98
1 #! /usr/bin/python
3 #############################################################
4 # This tool is used to generate the version info file #
5 #############################################################
6 import sys
7 import os
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'
12 sys.exit(1)
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'
18 sys.exit(1)
19 else :
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]
29 try:
30 version_int = int(version)+1 ## add one, because when we check it in, the rev will be incremented by one
31 except:
32 print 'ERROR: you cannot run this on a modified working copy'
33 sys.exit(1)
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')
40 output.close()
41 print 'upon check-in, version will be', str(version_int)