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

Side by Side Diff: packagerEdge.py

Issue 29983597: Noissue - Fixed: extension_id_* option was ignored in builds for MS Edge (Closed)
Patch Set: Created Jan. 17, 2019, 1:19 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « packager.py ('k') | tests/expecteddata/AppxManifest_edge_release_build.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # This Source Code Form is subject to the terms of the Mozilla Public 1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this 2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 4
5 import os 5 import os
6 import shutil 6 import shutil
7 import json 7 import json
8 import re 8 import re
9 from StringIO import StringIO 9 from StringIO import StringIO
10 from glob import glob 10 from glob import glob
11 import subprocess 11 import subprocess
12 import tempfile 12 import tempfile
13 from xml.etree import ElementTree 13 from xml.etree import ElementTree
14 from zipfile import ZipFile 14 from zipfile import ZipFile
15 import ConfigParser
15 16
16 import packager 17 import packager
17 import packagerChrome 18 import packagerChrome
18 19
19 MANIFEST = 'appxmanifest.xml' 20 MANIFEST = 'appxmanifest.xml'
20 ASSETS_DIR = 'Assets' 21 ASSETS_DIR = 'Assets'
21 22
22 defaultLocale = packagerChrome.defaultLocale 23 defaultLocale = packagerChrome.defaultLocale
23 24
24 25
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 filenames = [] 64 filenames = []
64 65
65 for name, path in metadata.items('appx_assets'): 66 for name, path in metadata.items('appx_assets'):
66 path = os.path.join(base_dir, path) 67 path = os.path.join(base_dir, path)
67 icon_path = '{}/{}'.format(ASSETS_DIR, name) 68 icon_path = '{}/{}'.format(ASSETS_DIR, name)
68 69
69 files.read(path, icon_path) 70 files.read(path, icon_path)
70 filenames.append(icon_path) 71 filenames.append(icon_path)
71 72
72 assets = packagerChrome.makeIcons(files, filenames) 73 assets = packagerChrome.makeIcons(files, filenames)
73
74 author = metadata.get('general', 'author') 74 author = metadata.get('general', 'author')
75 75
76 overrides = [ 76 overrides = [
77 ('_d:Identity', None, [ 77 ('_d:Identity', None, [
78 ('Name', packager.get_app_id(release_build, metadata)), 78 ('Name', packager.get_app_id(release_build, metadata)),
79 ('Publisher', metadata.get('general', 'publisher_id')), 79 ('Publisher', metadata.get('general', 'publisher_id')),
80 ('Version', get_appx_version(metadata, build_num)), 80 ('Version', get_appx_version(metadata, build_num)),
81 ]), 81 ]),
82 ('_d:Properties/_d:PublisherDisplayName', author, []), 82 ('_d:Properties/_d:PublisherDisplayName', author, []),
83 ('_d:Properties/_d:Logo', assets[50], []), 83 ('_d:Properties/_d:Logo', assets[50], []),
84 ('_d:Dependencies/_d:TargetDeviceFamily', None, [ 84 ('_d:Dependencies/_d:TargetDeviceFamily', None, [
85 ('MaxVersionTested', v_max), 85 ('MaxVersionTested', v_max),
86 ('MinVersion', v_min), 86 ('MinVersion', v_min),
87 ]), 87 ]),
88 ('_d:Applications/_d:Application/uap:VisualElements', None, [ 88 ('_d:Applications/_d:Application/uap:VisualElements', None, [
89 ('Square150x150Logo', assets[150]), 89 ('Square150x150Logo', assets[150]),
90 ('Square44x44Logo', assets[44]), 90 ('Square44x44Logo', assets[44]),
91 ]), 91 ]),
92 ] 92 ]
93 93
94 try:
95 overrides.append((
96 '_d:Applications/_d:Application/_d:Extensions/' +
97 'uap3:Extension/uap3:AppExtension',
98 None,
99 [('Id', packager.get_build_specific_option(release_build,
100 metadata,
101 'extension_id'))],
102 ))
103 except ConfigParser.NoOptionError:
104 pass
105
94 tree = ElementTree.parse(manifest_path) 106 tree = ElementTree.parse(manifest_path)
95 root = tree.getroot() 107 root = tree.getroot()
96 108
97 for xpath, text, attributes in overrides: 109 for xpath, text, attributes in overrides:
98 element = root.find(xpath, namespaces) 110 element = root.find(xpath, namespaces)
99 if text: 111 if text:
100 element.text = text 112 element.text = text
101 for attr, value in attributes: 113 for attr, value in attributes:
102 element.set(attr, value) 114 element.set(attr, value)
103 115
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 cmd = ['npm', 'run', '--silent', 'package-edge'] 231 cmd = ['npm', 'run', '--silent', 'package-edge']
220 232
221 subprocess.check_call(cmd, env=cmd_env, cwd=os.path.dirname(__file__)) 233 subprocess.check_call(cmd, env=cmd_env, cwd=os.path.dirname(__file__))
222 234
223 package = os.path.join(manifold_folder, 'package', 235 package = os.path.join(manifold_folder, 'package',
224 'edgeExtension.appx') 236 'edgeExtension.appx')
225 237
226 shutil.copyfile(package, outfile) 238 shutil.copyfile(package, outfile)
227 finally: 239 finally:
228 shutil.rmtree(tmp_dir, ignore_errors=True) 240 shutil.rmtree(tmp_dir, ignore_errors=True)
OLDNEW
« no previous file with comments | « packager.py ('k') | tests/expecteddata/AppxManifest_edge_release_build.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld