Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 4 | |
michael@0 | 5 | ''' |
michael@0 | 6 | Replace localized parts of a packaged directory with data from a langpack |
michael@0 | 7 | directory. |
michael@0 | 8 | ''' |
michael@0 | 9 | |
michael@0 | 10 | from mozpack.packager import l10n |
michael@0 | 11 | from argparse import ArgumentParser |
michael@0 | 12 | import buildconfig |
michael@0 | 13 | |
michael@0 | 14 | # Set of files or directories not listed in a chrome.manifest but that are |
michael@0 | 15 | # localized. |
michael@0 | 16 | NON_CHROME = set([ |
michael@0 | 17 | '**/crashreporter*.ini', |
michael@0 | 18 | 'searchplugins', |
michael@0 | 19 | 'dictionaries', |
michael@0 | 20 | 'hyphenation', |
michael@0 | 21 | 'defaults/profile', |
michael@0 | 22 | 'defaults/pref*/*-l10n.js', |
michael@0 | 23 | 'update.locale', |
michael@0 | 24 | 'updater.ini', |
michael@0 | 25 | 'extensions/langpack-*@*', |
michael@0 | 26 | 'distribution/extensions/langpack-*@*', |
michael@0 | 27 | 'chrome/**/searchplugins/*.xml', |
michael@0 | 28 | ]) |
michael@0 | 29 | |
michael@0 | 30 | |
michael@0 | 31 | def main(): |
michael@0 | 32 | parser = ArgumentParser() |
michael@0 | 33 | parser.add_argument('build', |
michael@0 | 34 | help='Directory containing the build to repack') |
michael@0 | 35 | parser.add_argument('l10n', |
michael@0 | 36 | help='Directory containing the staged langpack') |
michael@0 | 37 | parser.add_argument('--non-resource', nargs='+', metavar='PATTERN', |
michael@0 | 38 | default=[], |
michael@0 | 39 | help='Extra files not to be considered as resources') |
michael@0 | 40 | args = parser.parse_args() |
michael@0 | 41 | |
michael@0 | 42 | buildconfig.substs['USE_ELF_HACK'] = False |
michael@0 | 43 | buildconfig.substs['PKG_SKIP_STRIP'] = True |
michael@0 | 44 | l10n.repack(args.build, args.l10n, args.non_resource, NON_CHROME) |
michael@0 | 45 | |
michael@0 | 46 | |
michael@0 | 47 | if __name__ == "__main__": |
michael@0 | 48 | main() |