summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/installer/l10n-repack.py
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /toolkit/mozapps/installer/l10n-repack.py
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'toolkit/mozapps/installer/l10n-repack.py')
-rw-r--r--toolkit/mozapps/installer/l10n-repack.py60
1 files changed, 60 insertions, 0 deletions
diff --git a/toolkit/mozapps/installer/l10n-repack.py b/toolkit/mozapps/installer/l10n-repack.py
new file mode 100644
index 000000000..783c00b71
--- /dev/null
+++ b/toolkit/mozapps/installer/l10n-repack.py
@@ -0,0 +1,60 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+'''
+Replace localized parts of a packaged directory with data from a langpack
+directory.
+'''
+
+from mozpack.packager import l10n
+from argparse import ArgumentParser
+import buildconfig
+
+# Set of files or directories not listed in a chrome.manifest but that are
+# localized.
+NON_CHROME = set([
+ '**/crashreporter*.ini',
+ 'searchplugins',
+ 'dictionaries',
+ 'hyphenation',
+ 'defaults/profile',
+ 'defaults/pref*/*-l10n.js',
+ 'update.locale',
+ 'updater.ini',
+ 'extensions/langpack-*@*',
+ 'distribution/extensions/langpack-*@*',
+ 'chrome/**/searchplugins/*.xml',
+])
+
+
+def valid_extra_l10n(arg):
+ if '=' not in arg:
+ raise ValueError('Invalid value')
+ return tuple(arg.split('=', 1))
+
+
+def main():
+ parser = ArgumentParser()
+ parser.add_argument('build',
+ help='Directory containing the build to repack')
+ parser.add_argument('l10n',
+ help='Directory containing the staged langpack')
+ parser.add_argument('extra_l10n', nargs='*', metavar='BASE=PATH',
+ type=valid_extra_l10n,
+ help='Extra directories with staged localized files '
+ 'to be considered under the given base in the '
+ 'repacked build')
+ parser.add_argument('--non-resource', nargs='+', metavar='PATTERN',
+ default=[],
+ help='Extra files not to be considered as resources')
+ args = parser.parse_args()
+
+ buildconfig.substs['USE_ELF_HACK'] = False
+ buildconfig.substs['PKG_SKIP_STRIP'] = True
+ l10n.repack(args.build, args.l10n, extra_l10n=dict(args.extra_l10n),
+ non_resources=args.non_resource, non_chrome=NON_CHROME)
+
+
+if __name__ == "__main__":
+ main()