Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: packagerEdge.py

Issue 29931564: Issue 7080 - Don't tranlsate product name in builds for Microsoft Edge (Closed)
Patch Set: Rebased Created Oct. 31, 2018, 6:31 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « package.json ('k') | tests/expecteddata/AppxManifest_edge_development_build.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packagerEdge.py
===================================================================
--- a/packagerEdge.py
+++ b/packagerEdge.py
@@ -4,7 +4,10 @@
import os
import shutil
+import json
+import re
from StringIO import StringIO
+from glob import glob
import subprocess
import tempfile
from xml.etree import ElementTree
@@ -140,15 +143,17 @@
if metadata.has_section('import_locales'):
packagerChrome.import_locales(params, files)
- # For some mysterious reasons manifoldjs fails with a server error
- # when building the development build and there is any translation
- # in az/messages.json for "name_devbuild", however, it works fine
- # if we use the more specific language code az-latn.
- az_translation = files.pop('_locales/az/messages.json', None)
- if az_translation is not None:
- files['_locales/az-latn/messages.json'] = az_translation
-
- files['manifest.json'] = packagerChrome.createManifest(params, files)
+ # The Windows Store will reject the build unless every translation of the
+ # product name has been reserved. This is hard till impossible to manage
+ # with community translations, so we don't translate the product name for
+ # Microsoft Edge. Furthermore, manifoldjs fails with a server error if the
+ # product name is tranlated into Azerbajani.
+ data = json.loads(files['_locales/{}/messages.json'.format(defaultLocale)])
+ files['manifest.json'] = re.sub(
+ r'__MSG_(name(?:_devbuild)?)__',
+ lambda m: data[m.group(1)]['message'],
+ packagerChrome.createManifest(params, files),
+ )
if devenv:
packagerChrome.add_devenv_requirements(files, metadata, params)
@@ -174,14 +179,14 @@
cmd_env['SRC_FOLDER'] = src_dir
cmd_env['EXT_FOLDER'] = ext_dir
- manifold_folder = os.path.join(ext_dir, 'MSGname', 'edgeextension')
- manifest_folder = os.path.join(manifold_folder, 'manifest')
- asset_folder = os.path.join(manifest_folder, ASSETS_DIR)
-
# prepare the extension with manifoldjs
cmd = ['npm', 'run', '--silent', 'build-edge']
subprocess.check_call(cmd, env=cmd_env, cwd=os.path.dirname(__file__))
+ manifold_folder = glob(os.path.join(ext_dir, '*', 'edgeextension'))[0]
+ manifest_folder = os.path.join(manifold_folder, 'manifest')
+ asset_folder = os.path.join(manifest_folder, ASSETS_DIR)
+
# update incomplete appxmanifest
intermediate_manifest = os.path.join(manifest_folder, MANIFEST)
update_appx_manifest(intermediate_manifest, baseDir, files, metadata,
« no previous file with comments | « package.json ('k') | tests/expecteddata/AppxManifest_edge_development_build.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld