Bug 833882 - Correctly handle non chrome directories when doing l10n-repack. r=gps

This commit is contained in:
Mike Hommey 2013-01-23 23:49:23 +01:00
Родитель 0b3b87c85f
Коммит 88d3c5df77
1 изменённых файлов: 15 добавлений и 16 удалений

Просмотреть файл

@ -109,8 +109,12 @@ def repack(source, l10n):
for e in entries if isinstance(e, ManifestEntryWithRelPath))
for path in NON_CHROME:
for p, f in l10n_finder.find(path):
left = set(p for p, f in finder.find(path))
right = set(p for p, f in l10n_finder.find(path))
for p in right:
paths[p] = p
for p in left - right:
paths[p] = None
# Create a new package, with non localized bits coming from the original
# package, and localized bits coming from the langpack.
@ -120,22 +124,17 @@ def repack(source, l10n):
# Remove localized manifest entries.
for e in [e for e in f if e.localized]:
f.remove(e)
base = mozpack.path.basedir(p, paths.keys())
if base:
# If the path is one that needs a locale replacement, use the
# corresponding file from the langpack.
subpath = mozpack.path.relpath(p, base)
path = mozpack.path.normpath(mozpack.path.join(paths[base],
subpath))
files = [f for p, f in l10n_finder.find(path)]
if len(files) == 0 and base in NON_CHROME:
path = path.replace(locale, l10n_locale)
if p in paths:
path = paths[p]
if path:
# If the path is one that needs a locale replacement, use the
# corresponding file from the langpack.
files = [f for p, f in l10n_finder.find(path)]
if len(files) == 0:
if not base in NON_CHROME:
errors.error("Missing file: %s" % os.path.join(l10n, path))
else:
packager.add(path, files[0])
if not len(files):
if base not in NON_CHROME:
errors.error("Missing file: %s" % os.path.join(l10n, path))
else:
packager.add(path, files[0])
else:
packager.add(p, f)