toolkit/mozapps/installer/l10n-repack.py

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:b81785f489f4
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/.
4
5 '''
6 Replace localized parts of a packaged directory with data from a langpack
7 directory.
8 '''
9
10 from mozpack.packager import l10n
11 from argparse import ArgumentParser
12 import buildconfig
13
14 # Set of files or directories not listed in a chrome.manifest but that are
15 # localized.
16 NON_CHROME = set([
17 '**/crashreporter*.ini',
18 'searchplugins',
19 'dictionaries',
20 'hyphenation',
21 'defaults/profile',
22 'defaults/pref*/*-l10n.js',
23 'update.locale',
24 'updater.ini',
25 'extensions/langpack-*@*',
26 'distribution/extensions/langpack-*@*',
27 'chrome/**/searchplugins/*.xml',
28 ])
29
30
31 def main():
32 parser = ArgumentParser()
33 parser.add_argument('build',
34 help='Directory containing the build to repack')
35 parser.add_argument('l10n',
36 help='Directory containing the staged langpack')
37 parser.add_argument('--non-resource', nargs='+', metavar='PATTERN',
38 default=[],
39 help='Extra files not to be considered as resources')
40 args = parser.parse_args()
41
42 buildconfig.substs['USE_ELF_HACK'] = False
43 buildconfig.substs['PKG_SKIP_STRIP'] = True
44 l10n.repack(args.build, args.l10n, args.non_resource, NON_CHROME)
45
46
47 if __name__ == "__main__":
48 main()

mercurial