Left: | ||
Right: |
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-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, |
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 # GNU General Public License for more details. | 13 # GNU General Public License for more details. |
14 # | 14 # |
15 # You should have received a copy of the GNU General Public License | 15 # You should have received a copy of the GNU General Public License |
16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 |
18 """ | 18 """ |
19 Generate update manifests | 19 Generate update manifests |
20 ========================= | 20 ========================= |
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 | |
29 | |
28 from buildtools.packagerGecko import KNOWN_APPS | 30 from buildtools.packagerGecko import KNOWN_APPS |
29 from ConfigParser import SafeConfigParser | 31 from buildtools.packagerSafari import get_developer_identifier, get_certificates _and_key |
Wladimir Palant
2015/07/16 20:47:08
Nit: This line is too long.
Sebastian Noack
2015/07/17 11:10:59
Done.
| |
32 | |
30 from sitescripts.utils import get_config, get_template | 33 from sitescripts.utils import get_config, get_template |
31 from sitescripts.extensions.utils import ( | 34 from sitescripts.extensions.utils import ( |
32 Configuration, getDownloadLinks, getSafariCertificateID, | 35 Configuration, getDownloadLinks, |
33 writeIEUpdateManifest, writeAndroidUpdateManifest) | 36 writeIEUpdateManifest, writeAndroidUpdateManifest) |
34 from sitescripts.extensions.android import get_min_sdk_version | 37 from sitescripts.extensions.android import get_min_sdk_version |
35 | 38 |
36 def readMetadata(repo, version): | 39 def readMetadata(repo, version): |
37 """ | 40 """ |
38 reads extension ID and compatibility information from metadata file in the | 41 reads extension ID and compatibility information from metadata file in the |
39 extension's repository | 42 extension's repository |
40 """ | 43 """ |
41 if repo.type == 'android': | 44 if repo.type == 'android': |
42 command = ['hg', '-R', repo.repository, 'id', '-r', version, '-n'] | 45 command = ['hg', '-R', repo.repository, 'id', '-r', version, '-n'] |
43 result = subprocess.check_output(command) | 46 result = subprocess.check_output(command) |
44 revision = re.sub(r'\D', '', result) | 47 revision = re.sub(r'\D', '', result) |
45 | 48 |
46 return { | 49 return { |
47 'revision': revision, | 50 'revision': revision, |
48 'version': version, | 51 'version': version, |
49 'minSdkVersion': get_min_sdk_version(repo, version), | 52 'minSdkVersion': get_min_sdk_version(repo, version), |
50 'basename': os.path.basename(repo.repository) | 53 'basename': os.path.basename(repo.repository) |
51 } | 54 } |
52 elif repo.type == 'safari': | 55 elif repo.type == 'safari': |
53 metadata = repo.readMetadata(version) | 56 metadata = repo.readMetadata(version) |
54 return { | 57 return { |
55 'certificateID': getSafariCertificateID(repo.keyFile), | 58 'certificateID': get_developer_identifier(get_certificates_and_key(repo.ke yFile)[0]), |
Wladimir Palant
2015/07/16 20:47:08
Nit: This line is too long.
Sebastian Noack
2015/07/17 11:10:59
Done.
| |
56 'version': version, | 59 'version': version, |
57 'shortVersion': version, | 60 'shortVersion': version, |
58 'basename': metadata.get('general', 'basename'), | 61 'basename': metadata.get('general', 'basename'), |
59 } | 62 } |
60 elif repo.type == 'gecko': | 63 elif repo.type == 'gecko': |
61 metadata = repo.readMetadata(version) | 64 metadata = repo.readMetadata(version) |
62 result = { | 65 result = { |
63 'extensionID': metadata.get('general', 'id'), | 66 'extensionID': metadata.get('general', 'id'), |
64 'version': version, | 67 'version': version, |
65 'compat': [] | 68 'compat': [] |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 """ | 117 """ |
115 updates all update manifests with the current versions | 118 updates all update manifests with the current versions |
116 """ | 119 """ |
117 | 120 |
118 parser = SafeConfigParser() | 121 parser = SafeConfigParser() |
119 getDownloadLinks(parser) | 122 getDownloadLinks(parser) |
120 writeUpdateManifest(parser) | 123 writeUpdateManifest(parser) |
121 | 124 |
122 if __name__ == "__main__": | 125 if __name__ == "__main__": |
123 updateUpdateManifests() | 126 updateUpdateManifests() |
OLD | NEW |