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

Delta Between Two Patch Sets: packagerEdge.py

Issue 29540555: Issue 5649 - Include full version number in AppxManifest.xml (Closed)
Left Patch Set: Created Sept. 11, 2017, 1:51 a.m.
Right Patch Set: Re-add blank lines Created Sept. 11, 2017, 3:21 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | templates/edge/AppxManifest.xml.tmpl » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 base64 5 import base64
6 import hashlib 6 import hashlib
7 import json 7 import json
8 import mimetypes 8 import mimetypes
9 import os 9 import os
10 import zipfile 10 import zipfile
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 template = _get_template_for(BLOCKMAP) 62 template = _get_template_for(BLOCKMAP)
63 files = [_make_blockmap_entry(n, d) for n, d in files.items()] 63 files = [_make_blockmap_entry(n, d) for n, d in files.items()]
64 return template.render(files=files).encode('utf-8') 64 return template.render(files=files).encode('utf-8')
65 65
66 66
67 def load_translation(files, locale): 67 def load_translation(files, locale):
68 """Load translation strings for locale from files.""" 68 """Load translation strings for locale from files."""
69 path = '{}/_locales/{}/messages.json'.format(EXTENSION_DIR, locale) 69 path = '{}/_locales/{}/messages.json'.format(EXTENSION_DIR, locale)
70 return json.loads(files[path]) 70 return json.loads(files[path])
71 71
72
72 def pad_version(version): 73 def pad_version(version):
73 """Make sure version number has 4 groups of digits.""" 74 """Make sure version number has 4 groups of digits."""
74 groups = (version.split('.') + ['0', '0', '0'])[:4] 75 groups = (version.split('.') + ['0', '0', '0'])[:4]
75 return '.'.join(groups) 76 return '.'.join(groups)
77
76 78
77 def create_appx_manifest(params, files, release_build=False): 79 def create_appx_manifest(params, files, release_build=False):
78 """Create AppxManifest.xml.""" 80 """Create AppxManifest.xml."""
79 params = dict(params) 81 params = dict(params)
80 metadata = params['metadata'] 82 metadata = params['metadata']
81 w = params['windows_version'] = {} 83 w = params['windows_version'] = {}
82 w['min'], w['max'] = metadata.get('compat', 'windows').split('/') 84 w['min'], w['max'] = metadata.get('compat', 'windows').split('/')
83 params['version'] = pad_version(params['version']) 85 params['version'] = pad_version(params['version'])
84 86
85 metadata_suffix = 'release' if release_build else 'devbuild' 87 metadata_suffix = 'release' if release_build else 'devbuild'
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 if metadata.has_section('appx_assets'): 185 if metadata.has_section('appx_assets'):
184 for name, path in metadata.items('appx_assets'): 186 for name, path in metadata.items('appx_assets'):
185 path = os.path.join(baseDir, path) 187 path = os.path.join(baseDir, path)
186 files.read(path, '{}/{}'.format(ASSETS_DIR, name)) 188 files.read(path, '{}/{}'.format(ASSETS_DIR, name))
187 189
188 files[MANIFEST] = create_appx_manifest(params, files, releaseBuild) 190 files[MANIFEST] = create_appx_manifest(params, files, releaseBuild)
189 files[BLOCKMAP] = create_appx_blockmap(files) 191 files[BLOCKMAP] = create_appx_blockmap(files)
190 files[CONTENT_TYPES] = create_content_types_map(files.keys() + [BLOCKMAP]) 192 files[CONTENT_TYPES] = create_content_types_map(files.keys() + [BLOCKMAP])
191 193
192 files.zip(outfile, compression=zipfile.ZIP_STORED) 194 files.zip(outfile, compression=zipfile.ZIP_STORED)
LEFTRIGHT

Powered by Google App Engine
This is Rietveld