blob: 0cbc9d228727f90334735be1285af578f35d2e84 [file] [log] [blame]
Sébastien Blin1f915762020-08-03 13:27:42 -04001#!/usr/bin/python
2
3##
4## Copyright (C) 2016-2017 Savoir-faire Linux Inc.
5##
6## Author: Edric Milaret <edric.ladent-milaret@savoirfairelinux.com>
7## Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
8##
9## This program is free software; you can redistribute it and/or modify
10## it under the terms of the GNU General Public License as published by
11## the Free Software Foundation; either version 3 of the License, or
12## (at your option) any later version.
13##
14## This program is distributed in the hope that it will be useful,
15## but WITHOUT ANY WARRANTY; without even the implied warranty of
16## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17## GNU General Public License for more details.
18##
19## You should have received a copy of the GNU General Public License
20## along with this program; if not, write to the Free Software
21## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22##
23
24import os
25import shutil
26
27print("== Updating from sources")
28if os.system("lupdate jami-qt.pro -no-obsolete"):
29 print("trying with 'lupdate-qt5'")
30 if os.system("lupdate-qt5 jami-qt.pro -no-obsolete"):
31 raise RuntimeError("unable to find any suitable lupdate Qt tool on this system. Stopping")
32
33print("== Pushing sources")
34os.system("tx push -s")
35
36print("== Pulling translations")
37os.system("tx pull -af --minimum-perc=1")
38
39print("Updating .pro file")
40
41translationFiles = []
42
43for filename in os.listdir('./translations'):
44 translationFiles.append("translations/{0}".format(filename))
45
46proFile = "jami-qt.pro"
47shutil.move(proFile, proFile + "~")
48
49destination = open(proFile, "w")
50source = open(proFile + "~", "r")
51for line in source:
52 if not ".ts" in line:
53 destination.write(line)
54 if "TRANSLATIONS = " in line:
55 for filename in translationFiles:
56 destination.write(" {0} \\\n".format(filename))
57
58source.close()
59destination.close()
60os.remove(proFile + "~")
61
62print("== All done you can commit now")