mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 1621696 - Generalize generate_updater_ini.py for more use cases r=Pike,froydnj
The Default Browser Agent needs localization, but is external from Firefox. The best option is to do localization the same way the updater does, since it is also external from Firefox. This requires making the tools surrounding updater.ini a bit more generic so they can be reused for the Default Browser Agent. Differential Revision: https://phabricator.services.mozilla.com/D73954
This commit is contained in:
parent
2752ee0112
commit
0367d87ff2
@ -13,17 +13,16 @@ import re
|
||||
import shutil
|
||||
|
||||
|
||||
def main(output, updater_ini, updater_ini_append, locale=None):
|
||||
assert(locale is not None)
|
||||
def main(output, ini, ini_append=None, locale=None):
|
||||
fixup_re = re.compile('^(Info|Title)Text=')
|
||||
# updater.ini is always utf-8.
|
||||
with codecs.open(updater_ini, 'rb', 'utf_8') as f:
|
||||
# Input INI is always utf-8.
|
||||
with codecs.open(ini, 'rb', 'utf_8') as f:
|
||||
for line in f:
|
||||
line = fixup_re.sub(r'\1=', line)
|
||||
line = line.replace('%MOZ_APP_DISPLAYNAME%',
|
||||
buildconfig.substs['MOZ_APP_DISPLAYNAME'])
|
||||
output.write(line)
|
||||
if buildconfig.substs['OS_TARGET'] == 'WINNT':
|
||||
# Also append the contents of `updater_ini_append`.
|
||||
with codecs.open(updater_ini_append, 'rb', 'utf_8') as f:
|
||||
if ini_append and buildconfig.substs['OS_TARGET'] == 'WINNT':
|
||||
# Also append the contents of `ini_append`.
|
||||
with codecs.open(ini_append, 'rb', 'utf_8') as f:
|
||||
shutil.copyfileobj(f, output)
|
@ -15,7 +15,7 @@ if CONFIG['MOZ_CRASHREPORTER']:
|
||||
if CONFIG['MOZ_UPDATER']:
|
||||
LOCALIZED_GENERATED_FILES += ['updater.ini']
|
||||
updater = LOCALIZED_GENERATED_FILES['updater.ini']
|
||||
updater.script = 'generate_updater_ini.py'
|
||||
updater.script = 'generate_ini.py'
|
||||
updater.inputs = [
|
||||
'en-US/updater/updater.ini',
|
||||
'../installer/windows/nsis/updater_append.ini',
|
||||
|
Loading…
Reference in New Issue
Block a user