michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: ''' michael@0: Replace localized parts of a packaged directory with data from a langpack michael@0: directory. michael@0: ''' michael@0: michael@0: from mozpack.packager import l10n michael@0: from argparse import ArgumentParser michael@0: import buildconfig michael@0: michael@0: # Set of files or directories not listed in a chrome.manifest but that are michael@0: # localized. michael@0: NON_CHROME = set([ michael@0: '**/crashreporter*.ini', michael@0: 'searchplugins', michael@0: 'dictionaries', michael@0: 'hyphenation', michael@0: 'defaults/profile', michael@0: 'defaults/pref*/*-l10n.js', michael@0: 'update.locale', michael@0: 'updater.ini', michael@0: 'extensions/langpack-*@*', michael@0: 'distribution/extensions/langpack-*@*', michael@0: 'chrome/**/searchplugins/*.xml', michael@0: ]) michael@0: michael@0: michael@0: def main(): michael@0: parser = ArgumentParser() michael@0: parser.add_argument('build', michael@0: help='Directory containing the build to repack') michael@0: parser.add_argument('l10n', michael@0: help='Directory containing the staged langpack') michael@0: parser.add_argument('--non-resource', nargs='+', metavar='PATTERN', michael@0: default=[], michael@0: help='Extra files not to be considered as resources') michael@0: args = parser.parse_args() michael@0: michael@0: buildconfig.substs['USE_ELF_HACK'] = False michael@0: buildconfig.substs['PKG_SKIP_STRIP'] = True michael@0: l10n.repack(args.build, args.l10n, args.non_resource, NON_CHROME) michael@0: michael@0: michael@0: if __name__ == "__main__": michael@0: main()