Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / solenv / bin / version.py
blob3193b3fa39f10ec1b3f8e04bd7ea6076937d70c8
1 #!/usr/bin/env python3
3 from optparse import OptionParser
4 import os.path
5 import re
6 import sys
8 M = {
9 'juh': 'javaunohelper',
10 'jurt': 'jurt',
11 'officebean': 'bean',
12 'ridl': 'ridljar',
13 'unoil': 'unoil',
14 'unoloader': 'ridljar',
15 'libreoffice': 'ridljar',
18 parser = OptionParser()
19 _, args = parser.parse_args()
21 if not len(args):
22 parser.error('not enough arguments')
23 elif len(args) > 1:
24 parser.error('too many arguments')
26 DEST = r'\g<1>%s\g<3>' % args[0]
29 def replace_in_file(filename, src_pattern):
30 try:
31 f = open(filename, "r")
32 s = f.read()
33 f.close()
34 s = re.sub(src_pattern, DEST, s)
35 f = open(filename, "w")
36 f.write(s)
37 f.close()
38 except IOError as err:
39 print('error updating %s: %s' % (filename, err), file=sys.stderr)
41 src_pattern = re.compile(r'^(\s*<version>)([-.@\w]+)(</version>\s*)$',
42 re.MULTILINE)
44 for a in ['juh', 'jurt', 'libreoffice', 'officebean', 'ridl', 'unoil', 'unoloader']:
45 replace_in_file(os.path.join(M[a], 'pom.%s.xml' % a), src_pattern)
47 src_pattern = re.compile(r"^(LIBREOFFICE_VERSION = ')([-.@\w]+)(')$",
48 re.MULTILINE)
49 replace_in_file('solenv/maven/VERSION', src_pattern)