2013-01-23 02:23:14 -08:00
|
|
|
# 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.
|
|
|
|
'''
|
|
|
|
|
2013-03-05 22:26:32 -08:00
|
|
|
from mozpack.packager import l10n
|
2013-01-24 15:38:47 -08:00
|
|
|
from argparse import ArgumentParser
|
2013-01-24 15:40:13 -08:00
|
|
|
import buildconfig
|
2013-01-23 02:23:14 -08:00
|
|
|
|
|
|
|
# Set of files or directories not listed in a chrome.manifest but that are
|
|
|
|
# localized.
|
|
|
|
NON_CHROME = set([
|
2013-01-24 15:38:19 -08:00
|
|
|
'**/crashreporter*.ini',
|
2013-01-23 02:23:14 -08:00
|
|
|
'searchplugins',
|
|
|
|
'dictionaries',
|
|
|
|
'hyphenation',
|
|
|
|
'defaults/profile',
|
|
|
|
'defaults/pref*/*-l10n.js',
|
|
|
|
'update.locale',
|
2013-08-13 08:15:42 -07:00
|
|
|
'updater.ini',
|
2013-01-23 02:23:14 -08:00
|
|
|
'extensions/langpack-*@*',
|
|
|
|
'distribution/extensions/langpack-*@*',
|
2013-03-05 22:28:41 -08:00
|
|
|
'chrome/**/searchplugins/*.xml',
|
2013-01-23 02:23:14 -08:00
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
2013-01-24 15:38:47 -08:00
|
|
|
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('--non-resource', nargs='+', metavar='PATTERN',
|
|
|
|
default=[],
|
|
|
|
help='Extra files not to be considered as resources')
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
2013-01-24 15:40:13 -08:00
|
|
|
buildconfig.substs['USE_ELF_HACK'] = False
|
|
|
|
buildconfig.substs['PKG_SKIP_STRIP'] = True
|
2013-03-05 22:26:32 -08:00
|
|
|
l10n.repack(args.build, args.l10n, args.non_resource, NON_CHROME)
|
|
|
|
|
2013-01-23 02:23:14 -08:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|