Backed out changeset 68ed52f7e45d (bug 1899241) for causing sccache misses (bug 19048...
[gecko.git] / browser / locales / generate_ini.py
blobed936d8428a4b3a41a7d7a22a8d0a8efb6aa0b06
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 # Generate updater.ini by doing some light substitution on the localized updater.ini input,
6 # and appending the contents of updater_ini_append on Windows.
8 import codecs
9 import re
10 import shutil
12 import buildconfig
15 def main(output, ini, ini_append=None, locale=None):
16 fixup_re = re.compile("^(Info|Title)Text=")
17 # Input INI is always utf-8.
18 with codecs.open(ini, "rb", "utf_8") as f:
19 for line in f:
20 line = fixup_re.sub(r"\1=", line)
21 line = line.replace(
22 "%MOZ_APP_DISPLAYNAME%", buildconfig.substs["MOZ_APP_DISPLAYNAME"]
24 output.write(line)
25 if ini_append and buildconfig.substs["OS_TARGET"] == "WINNT":
26 # Also append the contents of `ini_append`.
27 with codecs.open(ini_append, "rb", "utf_8") as f:
28 shutil.copyfileobj(f, output)