summaryrefslogtreecommitdiffstats
path: root/solenv/bin/version.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
commit940b4d1848e8c70ab7642901a68594e8016caffc (patch)
treeeb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /solenv/bin/version.py
parentInitial commit. (diff)
downloadlibreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz
libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'solenv/bin/version.py')
-rwxr-xr-xsolenv/bin/version.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/solenv/bin/version.py b/solenv/bin/version.py
new file mode 100755
index 000000000..b1164483f
--- /dev/null
+++ b/solenv/bin/version.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python3
+
+from optparse import OptionParser
+import os.path
+import re
+import sys
+
+M = {
+ 'juh': 'javaunohelper',
+ 'jurt': 'jurt',
+ 'officebean': 'bean',
+ 'ridl': 'ridljar',
+ 'unoil': 'unoil',
+ 'unoloader': 'ridljar',
+}
+
+parser = OptionParser()
+_, args = parser.parse_args()
+
+if not len(args):
+ parser.error('not enough arguments')
+elif len(args) > 1:
+ parser.error('too many arguments')
+
+DEST = r'\g<1>%s\g<3>' % args[0]
+
+
+def replace_in_file(filename, src_pattern):
+ try:
+ f = open(filename, "r")
+ s = f.read()
+ f.close()
+ s = re.sub(src_pattern, DEST, s)
+ f = open(filename, "w")
+ f.write(s)
+ f.close()
+ except IOError as err:
+ print('error updating %s: %s' % (filename, err), file=sys.stderr)
+
+src_pattern = re.compile(r'^(\s*<version>)([-.@\w]+)(</version>\s*)$',
+ re.MULTILINE)
+
+for a in ['juh', 'jurt', 'officebean', 'ridl', 'unoil', 'unoloader']:
+ replace_in_file(os.path.join(M[a], 'pom.%s.xml' % a), src_pattern)
+
+src_pattern = re.compile(r"^(LIBREOFFICE_VERSION = ')([-.@\w]+)(')$",
+ re.MULTILINE)
+replace_in_file('solenv/maven/VERSION', src_pattern)