| OLD | NEW |
| 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 ConfigParser | 5 import ConfigParser |
| 6 import json | 6 import json |
| 7 import os | 7 import os |
| 8 import shutil | 8 import shutil |
| 9 import xml.etree.ElementTree as ET | 9 import xml.etree.ElementTree as ET |
| 10 import zipfile | 10 import zipfile |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 def text(elem): | 143 def text(elem): |
| 144 return elem.text | 144 return elem.text |
| 145 | 145 |
| 146 def attr(attr): | 146 def attr(attr): |
| 147 def wrapper(elem): | 147 def wrapper(elem): |
| 148 return elem.attrib[attr] | 148 return elem.attrib[attr] |
| 149 return wrapper | 149 return wrapper |
| 150 | 150 |
| 151 base = [ | 151 base = [ |
| 152 ('.//*', [len], 21.0), | 152 ('.//*', [len], 21.0), |
| 153 ('./ns:Identity', [first, attr('Name')], 'EyeoGmbH.AdblockPlus'), | |
| 154 ('./ns:Identity', [first, attr('Publisher')], | 153 ('./ns:Identity', [first, attr('Publisher')], |
| 155 'CN=4F066043-8AFE-41C9-B762-6C15E77E3F88'), | 154 'CN=4F066043-8AFE-41C9-B762-6C15E77E3F88'), |
| 156 ('./ns:Identity', [first, attr('Version')], '1.2.3.0'), | 155 ('./ns:Identity', [first, attr('Version')], '1.2.3.0'), |
| 157 ('./ns:Properties/ns:PublisherDisplayName', [first, text], | 156 ('./ns:Properties/ns:PublisherDisplayName', [first, text], |
| 158 'Eyeo GmbH'), | 157 'Eyeo GmbH'), |
| 159 ('./ns:Properties/ns:Logo', [first, text], 'Assets\\logo_50.png'), | 158 ('./ns:Properties/ns:Logo', [first, text], 'Assets\\logo_50.png'), |
| 160 ('./ns:Dependencies/ns:TargetDeviceFamily', | 159 ('./ns:Dependencies/ns:TargetDeviceFamily', |
| 161 [first, attr('MinVersion')], | 160 [first, attr('MinVersion')], |
| 162 '10.0.14332.0'), | 161 '10.0.14332.0'), |
| 163 ('./ns:Dependencies/ns:TargetDeviceFamily', | 162 ('./ns:Dependencies/ns:TargetDeviceFamily', |
| 164 [first, attr('MaxVersionTested')], | 163 [first, attr('MaxVersionTested')], |
| 165 '12.0.0.0'), | 164 '12.0.0.0'), |
| 166 ('./ns:Applications/ns:Application/uap:VisualElements', | 165 ('./ns:Applications/ns:Application/uap:VisualElements', |
| 167 [first, attr('Square150x150Logo')], | 166 [first, attr('Square150x150Logo')], |
| 168 'Assets\\logo_150.png'), | 167 'Assets\\logo_150.png'), |
| 169 ('./ns:Applications/ns:Application/uap:VisualElements', | 168 ('./ns:Applications/ns:Application/uap:VisualElements', |
| 170 [first, attr('Square44x44Logo')], | 169 [first, attr('Square44x44Logo')], |
| 171 'Assets\\logo_44.png'), | 170 'Assets\\logo_44.png'), |
| 172 ('./ns:Applications/ns:Application/uap:VisualElements', | 171 ('./ns:Applications/ns:Application/uap:VisualElements', |
| 173 [first, attr('Description')], | 172 [first, attr('Description')], |
| 174 'Adblock Plus is the most popular ad blocker ever, and also ' | 173 'Adblock Plus is the most popular ad blocker ever, and also ' |
| 175 'supports websites by not blocking unobstrusive ads by ' | 174 'supports websites by not blocking unobstrusive ads by ' |
| 176 'default (configurable).'), | 175 'default (configurable).'), |
| 177 ('./ns:Applications/ns:Application/uap:VisualElements', | 176 ('./ns:Applications/ns:Application/uap:VisualElements', |
| 178 [first, attr('BackgroundColor')], | 177 [first, attr('BackgroundColor')], |
| 179 'red'), | 178 'red'), |
| 180 ] | 179 ] |
| 181 | 180 |
| 182 devbuild = base + [ | 181 devbuild = base + [ |
| 182 ('./ns:Identity', [first, attr('Name')], |
| 183 'EyeoGmbH.AdblockPlusdevelopmentbuild'), |
| 183 ('./ns:Properties/ns:DisplayName', [first, text], 'devbuild-marker'), | 184 ('./ns:Properties/ns:DisplayName', [first, text], 'devbuild-marker'), |
| 184 ('./ns:Applications/ns:Application/uap:VisualElements', | 185 ('./ns:Applications/ns:Application/uap:VisualElements', |
| 185 [first, attr('DisplayName')], | 186 [first, attr('DisplayName')], |
| 186 'devbuild-marker'), | 187 'devbuild-marker'), |
| 187 ('./ns:Applications/ns:Application/ns:Extensions/uap3:Extension/' | 188 ('./ns:Applications/ns:Application/ns:Extensions/uap3:Extension/' |
| 188 'uap3:AppExtension', | 189 'uap3:AppExtension', |
| 189 [first, attr('Id')], | 190 [first, attr('Id')], |
| 190 'EdgeExtension'), | 191 'EdgeExtension'), |
| 191 ('./ns:Applications/ns:Application/ns:Extensions/uap3:Extension/' | 192 ('./ns:Applications/ns:Application/ns:Extensions/uap3:Extension/' |
| 192 'uap3:AppExtension', | 193 'uap3:AppExtension', |
| 193 [first, attr('DisplayName')], | 194 [first, attr('DisplayName')], |
| 194 'devbuild-marker'), | 195 'devbuild-marker'), |
| 195 ] | 196 ] |
| 196 | 197 |
| 197 release = base + [ | 198 release = base + [ |
| 199 ('./ns:Identity', [first, attr('Name')], 'EyeoGmbH.AdblockPlus'), |
| 198 ('./ns:Properties/ns:DisplayName', [first, text], 'Adblock Plus'), | 200 ('./ns:Properties/ns:DisplayName', [first, text], 'Adblock Plus'), |
| 199 ('./ns:Applications/ns:Application/uap:VisualElements', | 201 ('./ns:Applications/ns:Application/uap:VisualElements', |
| 200 [first, attr('DisplayName')], | 202 [first, attr('DisplayName')], |
| 201 'Adblock Plus'), | 203 'Adblock Plus'), |
| 202 ('./ns:Applications/ns:Application/ns:Extensions/uap3:Extension/' | 204 ('./ns:Applications/ns:Application/ns:Extensions/uap3:Extension/' |
| 203 'uap3:AppExtension', | 205 'uap3:AppExtension', |
| 204 [first, attr('Id')], | 206 [first, attr('Id')], |
| 205 '1.0'), | 207 '1.0'), |
| 206 ('./ns:Applications/ns:Application/ns:Extensions/uap3:Extension/' | 208 ('./ns:Applications/ns:Application/ns:Extensions/uap3:Extension/' |
| 207 'uap3:AppExtension', | 209 'uap3:AppExtension', |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 assert 'devbuild-marker' not in appx.read('AppxManifest.xml') | 251 assert 'devbuild-marker' not in appx.read('AppxManifest.xml') |
| 250 assert appx.read('Assets/logo_44.png') == '44' | 252 assert appx.read('Assets/logo_44.png') == '44' |
| 251 assert appx.read('Extension/icons/abp-44.png') == '44' | 253 assert appx.read('Extension/icons/abp-44.png') == '44' |
| 252 | 254 |
| 253 | 255 |
| 254 def test_create_devbuild(tmpdir, srcdir): | 256 def test_create_devbuild(tmpdir, srcdir): |
| 255 out_file = str(tmpdir.join('abp.appx')) | 257 out_file = str(tmpdir.join('abp.appx')) |
| 256 packagerEdge.createBuild(str(srcdir), outFile=out_file, releaseBuild=False) | 258 packagerEdge.createBuild(str(srcdir), outFile=out_file, releaseBuild=False) |
| 257 appx = zipfile.ZipFile(out_file) | 259 appx = zipfile.ZipFile(out_file) |
| 258 assert 'devbuild-marker' in appx.read('AppxManifest.xml') | 260 assert 'devbuild-marker' in appx.read('AppxManifest.xml') |
| OLD | NEW |