bug 1416891 - use LOCALIZED_GENERATED_FILES for update.locale. r=nalexander
This change moves update.locale generation to moz.build using
LOCALIZED_GENERATED_FILES. Since the existing Makefile rules were simply
putting the name of the locale into the output file, the input template
has been removed and the generation script just writes the name of the
locale to the output.
MozReview-Commit-ID: 8FT2tpHpaa2
--- a/toolkit/locales/Makefile.in
+++ b/toolkit/locales/Makefile.in
@@ -15,11 +15,8 @@ libs-%:
# target to be used by multi-locale l10n builds, just add this locale
# like regular chrome code
chrome-%: AB_CD=$*
chrome-%:
@$(MAKE) -C $(DEPTH)/netwerk/locales/ chrome AB_CD=$*
@$(MAKE) -C $(DEPTH)/dom/locales/ chrome AB_CD=$*
@$(MAKE) -C $(DEPTH)/security/manager/locales/ chrome AB_CD=$*
@$(MAKE) chrome AB_CD=$*
-
-libs:: update.locale
- sed -e 's/%AB_CD%/$(AB_CD)/' $< > $(FINAL_TARGET)/update.locale
new file mode 100644
--- /dev/null
+++ b/toolkit/locales/generate_update_locale.py
@@ -0,0 +1,13 @@
+# 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/.
+
+# Generate update.locale, which simply contains the name of the current locale.
+
+from __future__ import unicode_literals, print_function
+
+def main(output, locale=None):
+ assert(locale is not None)
+ # update.locale is a trivial file but let's be unicode aware anyway.
+ locale = unicode(locale, 'utf_8')
+ print(locale, file=output)
--- a/toolkit/locales/moz.build
+++ b/toolkit/locales/moz.build
@@ -29,8 +29,13 @@ if CONFIG['MOZ_CRASHREPORTER']:
# TODO: fixing bug 1223748 should let us remove this special case
LOCALIZED_FILES['crashreporter.app'].Contents.Resources += [
'en-US/crashreporter/crashreporter.ini'
]
else:
LOCALIZED_FILES += [
'en-US/crashreporter/crashreporter.ini'
]
+
+LOCALIZED_GENERATED_FILES += ['update.locale']
+update_locale = LOCALIZED_GENERATED_FILES['update.locale']
+update_locale.script = 'generate_update_locale.py'
+LOCALIZED_FILES += ['!update.locale']
deleted file mode 100644
--- a/toolkit/locales/update.locale
+++ /dev/null
@@ -1,1 +0,0 @@
-%AB_CD%