Warning, file /office/calligra/windows/calligra_installer/getcalligraversion.py was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 import sys
0002 import os
0003 import re
0004 
0005 fname = os.getenv('WORKSPACE')
0006 if fname:
0007     fname = fname + '/source/libs/main/calligraversion.h'
0008     os.path.normpath(fname)
0009 else:
0010     fname = os.getenv('CALLIGRA_SRC')
0011     if fname:
0012         fname = fname + '/libs/main/calligraversion.h'
0013         os.path.normpath(fname)
0014 
0015 if fname == None:
0016     print(':: Could not find Calligra sources')
0017     print(':: Please set CALLIGRA_SRC to point to the root of the sources,')
0018     print(':: or set WORKSPACE, where WORKSPACE/source/ is the root of the sources.')
0019     print(':: ')
0020     print(':: These lines are commented, to cause the installer-build to fail')
0021     print(':: set C2WINSTALL_VERSIONSTRING=(Unknown Version)')
0022     print(':: set C2WINSTALL_HEADERVERSIONSEP=0.0.0')
0023     print(':: set C2WINSTALL_HEADERVERSION=000')
0024     sys.exit()
0025     
0026 print(':: reading version from: ' + fname )
0027 f = open(fname,'r')
0028 
0029 versionString = []
0030 majorVer = []
0031 minorVer = []
0032 releaseVer = []
0033 success = 0
0034 
0035 for line in f:
0036         if versionString == []:
0037                 versionString = re.findall(r'\bCALLIGRA_VERSION_STRING  *"([^"]*)"', line) 
0038                 if versionString != []:
0039                     print(':: C2WINSTALL_VERSIONSTRING=' + versionString[0])
0040         if majorVer == []:
0041                 majorVer = re.findall(r'\bCALLIGRA_VERSION_MAJOR ([0-9]*)', line)     
0042                 if majorVer != []:
0043                     print(':: MAJORVER=' + majorVer[0])                
0044         if minorVer == []:
0045                 minorVer = re.findall(r'\bCALLIGRA_STABLE_VERSION_MINOR ([0-9]*)', line)     
0046                 if minorVer != []:
0047                     print(':: MINORVER=' + minorVer[0])    
0048         if releaseVer == []:
0049                 releaseVer = re.findall(r'\bCALLIGRA_VERSION_RELEASE ([0-9]*)', line)     
0050                 if releaseVer != []:
0051                     print(':: releaseVer=' + releaseVer[0])    
0052         if versionString != [] and majorVer != [] and minorVer != [] and releaseVer != []:
0053                 success = 1
0054                 break
0055     
0056 if success:
0057         print('set C2WINSTALL_VERSIONSTRING=' + versionString[0])
0058         print('set C2WINSTALL_HEADERVERSIONSEP=' + majorVer[0] + '.' + minorVer[0] + '.' + releaseVer[0])
0059         print('set C2WINSTALL_HEADERVERSION=' + majorVer[0] + minorVer[0] + releaseVer[0])
0060 else:
0061         print(':: Error collecting version info')
0062         print(':: These lines are commented, to cause the installer-build to fail')
0063         print(':: set C2WINSTALL_VERSIONSTRING=(Unknown Version)')
0064         print(':: set C2WINSTALL_HEADERVERSIONSEP=0.0.0')
0065         print(':: set C2WINSTALL_HEADERVERSION=000')