bug 1416891 - use LOCALIZED_GENERATED_FILES for update.locale. r=nalexander draft
authorTed Mielczarek <ted@mielczarek.org>
Fri, 17 Nov 2017 15:41:56 -0500
changeset 705777 4de0da803df5d2dc92c04217b245a1327a922dbe
parent 705776 86b7f45f92e2ca615eb5fba2ad9985e6d3ce429b
child 705778 693c8932e202f297763143b0d7f64d4e4ab9b0dd
push id91576
push userbmo:ted@mielczarek.org
push dateThu, 30 Nov 2017 16:56:58 +0000
reviewersnalexander
bugs1416891
milestone59.0a1
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
toolkit/locales/Makefile.in
toolkit/locales/generate_update_locale.py
toolkit/locales/moz.build
toolkit/locales/update.locale
--- 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%