LEFT | RIGHT |
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 from StringIO import StringIO | 7 from StringIO import StringIO |
8 import subprocess | 8 import subprocess |
9 import tempfile | 9 import tempfile |
10 from xml.etree import ElementTree | 10 from xml.etree import ElementTree |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 if metadata.has_section('preprocess'): | 122 if metadata.has_section('preprocess'): |
123 files.preprocess(metadata.options('preprocess'), {'needsExt': True}) | 123 files.preprocess(metadata.options('preprocess'), {'needsExt': True}) |
124 | 124 |
125 if metadata.has_section('import_locales'): | 125 if metadata.has_section('import_locales'): |
126 packagerChrome.import_locales(params, files) | 126 packagerChrome.import_locales(params, files) |
127 | 127 |
128 # For some mysterious reasons manifoldjs fails with a server error | 128 # For some mysterious reasons manifoldjs fails with a server error |
129 # when building the development build and there is any translation | 129 # when building the development build and there is any translation |
130 # in az/messages.json for "name_devbuild", however, it works fine | 130 # in az/messages.json for "name_devbuild", however, it works fine |
131 # if we use the more specific language code az-latn. | 131 # if we use the more specific language code az-latn. |
132 az_translation = files.pop('_locales/az/messages.json') | 132 az_translation = files.pop('_locales/az/messages.json', None) |
133 if az_translation: | 133 if az_translation is not None: |
134 files['_locales/az-latn/messages.json'] = az_translation | 134 files['_locales/az-latn/messages.json'] = az_translation |
135 | 135 |
136 files['manifest.json'] = packagerChrome.createManifest(params, files) | 136 files['manifest.json'] = packagerChrome.createManifest(params, files) |
137 | 137 |
138 if devenv: | 138 if devenv: |
139 packagerChrome.add_devenv_requirements(files, metadata, params) | 139 packagerChrome.add_devenv_requirements(files, metadata, params) |
140 | 140 |
141 zipped = StringIO() | 141 zipped = StringIO() |
142 files.zip(zipped) | 142 files.zip(zipped) |
143 | 143 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 cmd = ['npm', 'run', '--silent', 'package-edge'] | 185 cmd = ['npm', 'run', '--silent', 'package-edge'] |
186 | 186 |
187 subprocess.check_call(cmd, env=cmd_env, cwd=os.path.dirname(__file__)) | 187 subprocess.check_call(cmd, env=cmd_env, cwd=os.path.dirname(__file__)) |
188 | 188 |
189 package = os.path.join(manifold_folder, 'package', | 189 package = os.path.join(manifold_folder, 'package', |
190 'edgeExtension.appx') | 190 'edgeExtension.appx') |
191 | 191 |
192 shutil.copyfile(package, outfile) | 192 shutil.copyfile(package, outfile) |
193 finally: | 193 finally: |
194 shutil.rmtree(tmp_dir, ignore_errors=True) | 194 shutil.rmtree(tmp_dir, ignore_errors=True) |
LEFT | RIGHT |