3 # ***** BEGIN GPL LICENSE BLOCK *****
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 # ***** END GPL LICENSE BLOCK *****
23 # Update all branches:
24 # * Generate a temp messages.txt file.
25 # * Use it to generate a temp .pot file.
26 # * Use it to update all .po’s in /branches.
35 PY3 = settings.PYTHON3_EXEC
39 parser = argparse.ArgumentParser(description="" \
40 "Update all branches:\n" \
41 "* Generate a temp messages.txt file.\n" \
42 "* Use it to generate a temp .pot file.\n" \
43 "* Use it to update all .po’s in /branches.")
44 parser.add_argument('--pproc-contexts', action="store_true",
45 help="Pre-process po’s to avoid having plenty of "
46 "fuzzy msgids just because a context was "
48 parser.add_argument('-c', '--no_checks', default=True,
50 help="No checks over UI messages.")
51 parser.add_argument('-a', '--add', action="store_true",
52 help="Add missing po’s (useful only when one or " \
53 "more languages are given!).")
54 parser.add_argument('langs', metavar='ISO_code', nargs='*',
55 help="Restrict processed languages to those.")
56 args = parser.parse_args()
61 # Generate a temp messages file.
62 dummy, msgfile = tempfile.mkstemp(suffix=".txt",
63 prefix="blender_messages_")
65 cmd = (PY3, "./update_msg.py", "-o", msgfile)
66 t = subprocess.call(cmd)
70 # Regenerate POTFILES.in.
71 # cmd = (PY3, "./update_potinput.py")
72 # t = subprocess.call(cmd)
76 # Generate a temp pot file.
77 dummy, potfile = tempfile.mkstemp(suffix=".pot",
78 prefix="blender_pot_")
80 cmd = [PY3, "./update_pot.py", "-i", msgfile, "-o", potfile]
81 if not args.no_checks:
83 t = subprocess.call(cmd)
87 # Update branches’ po files.
88 cmd = [PY3, "./update_po.py", "-i", potfile]
93 if args.pproc_contexts:
94 cmd.append("--pproc-contexts")
95 t = subprocess.call(cmd)
102 if __name__ == "__main__":
103 print("\n\n *** Running {} *** \n".format(__file__))