Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: sitescripts/extensions/bin/updateUpdateManifests.py

Issue 29354340: Issue 4452 - updateUpdateManifests script errors out failing to import get_certificates_and_key (Closed) Base URL: https://hg.adblockplus.org/sitescripts
Patch Set: Created Sept. 21, 2016, 11:32 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-2016 Eyeo GmbH 2 # Copyright (C) 2006-2016 Eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details. 11 # GNU General Public License for more details.
12 # 12 #
13 # You should have received a copy of the GNU General Public License 13 # You should have received a copy of the GNU General Public License
14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
15 15
16 """ 16 """
17 Generate update manifests 17 Generate update manifests
18 ========================= 18 =========================
19 19
20 This script generates update manifests for all extensions and apps 20 This script generates update manifests for all extensions and apps
21 """ 21 """
22 22
23 import os 23 import os
24 import re 24 import re
25 import sys 25 import sys
26 import subprocess 26 import subprocess
27 from ConfigParser import SafeConfigParser 27 from ConfigParser import SafeConfigParser
28 28
29 from buildtools.packagerGecko import KNOWN_APPS 29 from buildtools.packagerGecko import KNOWN_APPS
30 from buildtools.packagerSafari import (get_developer_identifier, 30 from buildtools.packagerSafari import get_developer_identifier
31 get_certificates_and_key) 31 from buildtools.xarfile import read_certificates_and_key
32 32
33 from sitescripts.utils import get_config, get_template 33 from sitescripts.utils import get_config, get_template
34 from sitescripts.extensions.utils import ( 34 from sitescripts.extensions.utils import (
35 Configuration, getDownloadLinks, 35 Configuration, getDownloadLinks,
36 writeIEUpdateManifest, writeAndroidUpdateManifest) 36 writeIEUpdateManifest, writeAndroidUpdateManifest)
37 from sitescripts.extensions.android import get_min_sdk_version 37 from sitescripts.extensions.android import get_min_sdk_version
38 38
39 39
40 def readMetadata(repo, version): 40 def readMetadata(repo, version):
41 """ 41 """
42 reads extension ID and compatibility information from metadata file in the 42 reads extension ID and compatibility information from metadata file in the
43 extension's repository 43 extension's repository
44 """ 44 """
45 if repo.type == 'android': 45 if repo.type == 'android':
46 command = ['hg', '-R', repo.repository, 'id', '-r', version, '-n'] 46 command = ['hg', '-R', repo.repository, 'id', '-r', version, '-n']
47 result = subprocess.check_output(command) 47 result = subprocess.check_output(command)
48 revision = re.sub(r'\D', '', result) 48 revision = re.sub(r'\D', '', result)
49 49
50 return { 50 return {
51 'revision': revision, 51 'revision': revision,
52 'version': version, 52 'version': version,
53 'minSdkVersion': get_min_sdk_version(repo, version), 53 'minSdkVersion': get_min_sdk_version(repo, version),
54 'basename': os.path.basename(repo.repository) 54 'basename': os.path.basename(repo.repository)
55 } 55 }
56 elif repo.type == 'safari': 56 elif repo.type == 'safari':
57 metadata = repo.readMetadata(version) 57 metadata = repo.readMetadata(version)
58 certs = get_certificates_and_key(repo.keyFile)[0] 58 certs = read_certificates_and_key(repo.keyFile)[0]
59 59
60 return { 60 return {
61 'certificateID': get_developer_identifier(certs), 61 'certificateID': get_developer_identifier(certs),
62 'version': version, 62 'version': version,
63 'shortVersion': version, 63 'shortVersion': version,
64 'basename': metadata.get('general', 'basename'), 64 'basename': metadata.get('general', 'basename'),
65 'updatedFromGallery': True 65 'updatedFromGallery': True
66 } 66 }
67 elif repo.type == 'gecko': 67 elif repo.type == 'gecko':
68 metadata = repo.readMetadata(version) 68 metadata = repo.readMetadata(version)
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 """ 123 """
124 updates all update manifests with the current versions 124 updates all update manifests with the current versions
125 """ 125 """
126 126
127 parser = SafeConfigParser() 127 parser = SafeConfigParser()
128 getDownloadLinks(parser) 128 getDownloadLinks(parser)
129 writeUpdateManifest(parser) 129 writeUpdateManifest(parser)
130 130
131 if __name__ == '__main__': 131 if __name__ == '__main__':
132 updateUpdateManifests() 132 updateUpdateManifests()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld