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

Unified Diff: packagerEdge.py

Issue 29947559: Issue 7114 - Remove az and untranslated resources from Windows packages (Closed)
Patch Set: Created Nov. 20, 2018, 1:50 a.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 | « no previous file | no next file » | 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
@@ -6,6 +6,7 @@
import shutil
import json
import re
+import errno
from StringIO import StringIO
from glob import glob
import subprocess
@@ -101,6 +102,23 @@
for attr, value in attributes:
element.set(attr, value)
+ # Windows rejects to install packages that contain localized resources
+ # for either 'az' or 'uz'. Both languages have dialects using different
+ # scripts. Using the script-sepcific language code instead seems to work.
+ resources_dir = os.path.join(os.path.dirname(manifest_path), 'Resources')
+ for element in root.findall('_d:Resources/_d:Resource', namespaces):
+ old_code = element.get('Language')
+ new_code = {'az': 'az-latn',
+ 'uz': 'uz-cyrl'}.get(old_code)
+ if new_code:
+ element.set('Language', new_code)
+ try:
+ os.rename(os.path.join(resources_dir, old_code),
+ os.path.join(resources_dir, new_code))
+ except OSError as e:
+ if e.errno != errno.ENOENT:
+ raise
+
tree.write(manifest_path, encoding='utf-8', xml_declaration=True)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld