LEFT | RIGHT |
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-2015 Eyeo GmbH | 4 # Copyright (C) 2006-2015 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 10 matching lines...) Expand all Loading... |
21 | 21 |
22 This script generates update manifests for all extensions and apps | 22 This script generates update manifests for all extensions and apps |
23 """ | 23 """ |
24 | 24 |
25 import os | 25 import os |
26 import re | 26 import re |
27 import subprocess | 27 import subprocess |
28 from ConfigParser import SafeConfigParser | 28 from ConfigParser import SafeConfigParser |
29 | 29 |
30 from buildtools.packagerGecko import KNOWN_APPS | 30 from buildtools.packagerGecko import KNOWN_APPS |
31 from buildtools.packagerSafari import get_developer_identifier, get_certificates
_and_key | 31 from buildtools.packagerSafari import (get_developer_identifier, |
| 32 get_certificates_and_key) |
32 | 33 |
33 from sitescripts.utils import get_config, get_template | 34 from sitescripts.utils import get_config, get_template |
34 from sitescripts.extensions.utils import ( | 35 from sitescripts.extensions.utils import ( |
35 Configuration, getDownloadLinks, getSafariCertificateID, | 36 Configuration, getDownloadLinks, |
36 writeIEUpdateManifest, writeAndroidUpdateManifest) | 37 writeIEUpdateManifest, writeAndroidUpdateManifest) |
37 from sitescripts.extensions.android import get_min_sdk_version | 38 from sitescripts.extensions.android import get_min_sdk_version |
38 | 39 |
39 def readMetadata(repo, version): | 40 def readMetadata(repo, version): |
40 """ | 41 """ |
41 reads extension ID and compatibility information from metadata file in the | 42 reads extension ID and compatibility information from metadata file in the |
42 extension's repository | 43 extension's repository |
43 """ | 44 """ |
44 if repo.type == 'android': | 45 if repo.type == 'android': |
45 command = ['hg', '-R', repo.repository, 'id', '-r', version, '-n'] | 46 command = ['hg', '-R', repo.repository, 'id', '-r', version, '-n'] |
46 result = subprocess.check_output(command) | 47 result = subprocess.check_output(command) |
47 revision = re.sub(r'\D', '', result) | 48 revision = re.sub(r'\D', '', result) |
48 | 49 |
49 return { | 50 return { |
50 'revision': revision, | 51 'revision': revision, |
51 'version': version, | 52 'version': version, |
52 'minSdkVersion': get_min_sdk_version(repo, version), | 53 'minSdkVersion': get_min_sdk_version(repo, version), |
53 'basename': os.path.basename(repo.repository) | 54 'basename': os.path.basename(repo.repository) |
54 } | 55 } |
55 elif repo.type == 'safari': | 56 elif repo.type == 'safari': |
56 metadata = repo.readMetadata(version) | 57 metadata = repo.readMetadata(version) |
| 58 certs = get_certificates_and_key(repo.keyFile)[0] |
| 59 |
57 return { | 60 return { |
58 'certificateID': get_developer_identifier(get_certificates_and_key(repo.ke
yFile)[0]), | 61 'certificateID': get_developer_identifier(certs), |
59 'version': version, | 62 'version': version, |
60 'shortVersion': version, | 63 'shortVersion': version, |
61 'basename': metadata.get('general', 'basename'), | 64 'basename': metadata.get('general', 'basename'), |
62 } | 65 } |
63 elif repo.type == 'gecko': | 66 elif repo.type == 'gecko': |
64 metadata = repo.readMetadata(version) | 67 metadata = repo.readMetadata(version) |
65 result = { | 68 result = { |
66 'extensionID': metadata.get('general', 'id'), | 69 'extensionID': metadata.get('general', 'id'), |
67 'version': version, | 70 'version': version, |
68 'compat': [] | 71 'compat': [] |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 """ | 120 """ |
118 updates all update manifests with the current versions | 121 updates all update manifests with the current versions |
119 """ | 122 """ |
120 | 123 |
121 parser = SafeConfigParser() | 124 parser = SafeConfigParser() |
122 getDownloadLinks(parser) | 125 getDownloadLinks(parser) |
123 writeUpdateManifest(parser) | 126 writeUpdateManifest(parser) |
124 | 127 |
125 if __name__ == "__main__": | 128 if __name__ == "__main__": |
126 updateUpdateManifests() | 129 updateUpdateManifests() |
LEFT | RIGHT |