1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/mozapps/installer/l10n-repack.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,48 @@ 1.4 +# This Source Code Form is subject to the terms of the Mozilla Public 1.5 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + 1.8 +''' 1.9 +Replace localized parts of a packaged directory with data from a langpack 1.10 +directory. 1.11 +''' 1.12 + 1.13 +from mozpack.packager import l10n 1.14 +from argparse import ArgumentParser 1.15 +import buildconfig 1.16 + 1.17 +# Set of files or directories not listed in a chrome.manifest but that are 1.18 +# localized. 1.19 +NON_CHROME = set([ 1.20 + '**/crashreporter*.ini', 1.21 + 'searchplugins', 1.22 + 'dictionaries', 1.23 + 'hyphenation', 1.24 + 'defaults/profile', 1.25 + 'defaults/pref*/*-l10n.js', 1.26 + 'update.locale', 1.27 + 'updater.ini', 1.28 + 'extensions/langpack-*@*', 1.29 + 'distribution/extensions/langpack-*@*', 1.30 + 'chrome/**/searchplugins/*.xml', 1.31 +]) 1.32 + 1.33 + 1.34 +def main(): 1.35 + parser = ArgumentParser() 1.36 + parser.add_argument('build', 1.37 + help='Directory containing the build to repack') 1.38 + parser.add_argument('l10n', 1.39 + help='Directory containing the staged langpack') 1.40 + parser.add_argument('--non-resource', nargs='+', metavar='PATTERN', 1.41 + default=[], 1.42 + help='Extra files not to be considered as resources') 1.43 + args = parser.parse_args() 1.44 + 1.45 + buildconfig.substs['USE_ELF_HACK'] = False 1.46 + buildconfig.substs['PKG_SKIP_STRIP'] = True 1.47 + l10n.repack(args.build, args.l10n, args.non_resource, NON_CHROME) 1.48 + 1.49 + 1.50 +if __name__ == "__main__": 1.51 + main()