| OLD | NEW |
| 1 # coding: utf-8 | 1 # coding: utf-8 |
| 2 | 2 |
| 3 # This file is part of the Adblock Plus web scripts, | 3 # This file is part of the Adblock Plus web scripts, |
| 4 # Copyright (C) 2006-2014 Eyeo GmbH | 4 # Copyright (C) 2006-2014 Eyeo GmbH |
| 5 # | 5 # |
| 6 # Adblock Plus is free software: you can redistribute it and/or modify | 6 # Adblock Plus is free software: you can redistribute it and/or modify |
| 7 # it under the terms of the GNU General Public License version 3 as | 7 # it under the terms of the GNU General Public License version 3 as |
| 8 # published by the Free Software Foundation. | 8 # published by the Free Software Foundation. |
| 9 # | 9 # |
| 10 # Adblock Plus is distributed in the hope that it will be useful, | 10 # Adblock Plus is distributed in the hope that it will be useful, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 """ | 23 """ |
| 24 | 24 |
| 25 import os | 25 import os |
| 26 import re | 26 import re |
| 27 import subprocess | 27 import subprocess |
| 28 from buildtools.packagerGecko import KNOWN_APPS | 28 from buildtools.packagerGecko import KNOWN_APPS |
| 29 from ConfigParser import SafeConfigParser | 29 from ConfigParser import SafeConfigParser |
| 30 from sitescripts.utils import get_config, get_template | 30 from sitescripts.utils import get_config, get_template |
| 31 from sitescripts.extensions.utils import ( | 31 from sitescripts.extensions.utils import ( |
| 32 Configuration, getDownloadLinks, getSafariCertificateID, | 32 Configuration, getDownloadLinks, getSafariCertificateID, |
| 33 writeIEUpdateManifest, writeLibabpUpdateManifest) | 33 writeIEUpdateManifest, writeAndroidUpdateManifest) |
| 34 from sitescripts.extensions.android import get_min_sdk_version | 34 from sitescripts.extensions.android import get_min_sdk_version |
| 35 | 35 |
| 36 def readMetadata(repo, version): | 36 def readMetadata(repo, version): |
| 37 """ | 37 """ |
| 38 reads extension ID and compatibility information from metadata file in the | 38 reads extension ID and compatibility information from metadata file in the |
| 39 extension's repository | 39 extension's repository |
| 40 """ | 40 """ |
| 41 if repo.type == 'android': | 41 if repo.type == 'android': |
| 42 command = ['hg', '-R', repo.repository, 'id', '-r', version, '-n'] | 42 command = ['hg', '-R', repo.repository, 'id', '-r', version, '-n'] |
| 43 result = subprocess.check_output(command) | 43 result = subprocess.check_output(command) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 manifestPath = get_config().get('extensions', '%sUpdateManifestPath' % repoT
ype) | 99 manifestPath = get_config().get('extensions', '%sUpdateManifestPath' % repoT
ype) |
| 100 if repoType == 'ie': | 100 if repoType == 'ie': |
| 101 writeIEUpdateManifest(manifestPath, extensions[repoType]) | 101 writeIEUpdateManifest(manifestPath, extensions[repoType]) |
| 102 else: | 102 else: |
| 103 # ABP for Android used to have its own update manifest format. We need to | 103 # ABP for Android used to have its own update manifest format. We need to |
| 104 # generate both that and the new one in the libadblockplus format as long | 104 # generate both that and the new one in the libadblockplus format as long |
| 105 # as a significant amount of users is on an old version. | 105 # as a significant amount of users is on an old version. |
| 106 if repoType == 'android': | 106 if repoType == 'android': |
| 107 newManifestPath = get_config().get("extensions", | 107 newManifestPath = get_config().get("extensions", |
| 108 "androidNewUpdateManifestPath") | 108 "androidNewUpdateManifestPath") |
| 109 updates = {} | 109 writeAndroidUpdateManifest(newManifestPath, extensions[repoType]) |
| 110 for extension in extensions[repoType]: | |
| 111 updates[extension['basename']] = { | |
| 112 'version': extension['version'], | |
| 113 'url': extension['updateURL'] | |
| 114 } | |
| 115 writeLibabpUpdateManifest(newManifestPath, updates) | |
| 116 template = get_template(get_config().get('extensions', '%sUpdateManifest'
% repoType)) | 110 template = get_template(get_config().get('extensions', '%sUpdateManifest'
% repoType)) |
| 117 template.stream({'extensions': extensions[repoType]}).dump(manifestPath) | 111 template.stream({'extensions': extensions[repoType]}).dump(manifestPath) |
| 118 | 112 |
| 119 def updateUpdateManifests(): | 113 def updateUpdateManifests(): |
| 120 """ | 114 """ |
| 121 updates all update manifests with the current versions | 115 updates all update manifests with the current versions |
| 122 """ | 116 """ |
| 123 | 117 |
| 124 parser = SafeConfigParser() | 118 parser = SafeConfigParser() |
| 125 getDownloadLinks(parser) | 119 getDownloadLinks(parser) |
| 126 writeUpdateManifest(parser) | 120 writeUpdateManifest(parser) |
| 127 | 121 |
| 128 if __name__ == "__main__": | 122 if __name__ == "__main__": |
| 129 updateUpdateManifests() | 123 updateUpdateManifests() |
| OLD | NEW |