| Left: | ||
| Right: |
| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 ('Square150x150Logo', assets[150]), | 71 ('Square150x150Logo', assets[150]), |
| 72 ('Square44x44Logo', assets[44]), | 72 ('Square44x44Logo', assets[44]), |
| 73 ]), | 73 ]), |
| 74 ] | 74 ] |
| 75 | 75 |
| 76 tree = ElementTree.parse(manifest_path) | 76 tree = ElementTree.parse(manifest_path) |
| 77 root = tree.getroot() | 77 root = tree.getroot() |
| 78 | 78 |
| 79 for xpath, text, attributes in overrides: | 79 for xpath, text, attributes in overrides: |
| 80 element = root.find(xpath, namespaces) | 80 element = root.find(xpath, namespaces) |
| 81 element.text = text | 81 if text: |
|
Sebastian Noack
2018/08/08 22:27:32
We should check if text is not None. It may not be
tlucas
2018/08/09 07:09:24
Done.
| |
| 82 element.text = text | |
| 82 for attr, value in attributes: | 83 for attr, value in attributes: |
| 83 element.set(attr, value) | 84 element.set(attr, value) |
| 84 | 85 |
| 85 tree.write(manifest_path, encoding='utf-8', xml_declaration=True) | 86 tree.write(manifest_path, encoding='utf-8', xml_declaration=True) |
| 86 | 87 |
| 87 | 88 |
| 88 def createBuild(baseDir, type='edge', outFile=None, # noqa: preserve API. | 89 def createBuild(baseDir, type='edge', outFile=None, # noqa: preserve API. |
| 89 buildNum=None, releaseBuild=False, keyFile=None, | 90 buildNum=None, releaseBuild=False, keyFile=None, |
| 90 devenv=False): | 91 devenv=False): |
| 91 | 92 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 cmd = ['npm', 'run', '--silent', 'package-edge'] | 177 cmd = ['npm', 'run', '--silent', 'package-edge'] |
| 177 | 178 |
| 178 subprocess.check_call(cmd, env=cmd_env, cwd=os.path.dirname(__file__)) | 179 subprocess.check_call(cmd, env=cmd_env, cwd=os.path.dirname(__file__)) |
| 179 | 180 |
| 180 package = os.path.join(manifold_folder, 'package', | 181 package = os.path.join(manifold_folder, 'package', |
| 181 'edgeExtension.appx') | 182 'edgeExtension.appx') |
| 182 | 183 |
| 183 shutil.copyfile(package, outfile) | 184 shutil.copyfile(package, outfile) |
| 184 finally: | 185 finally: |
| 185 shutil.rmtree(tmp_dir, ignore_errors=True) | 186 shutil.rmtree(tmp_dir, ignore_errors=True) |
| LEFT | RIGHT |