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

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

Issue 6291923287408640: Issue 1093 - Separate update manifest generation (Closed)
Patch Set: Created July 22, 2014, 8:03 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
OLDNEW
(Empty)
1 # coding: utf-8
2
3 # This file is part of the Adblock Plus web scripts,
4 # Copyright (C) 2006-2014 Eyeo GmbH
5 #
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
8 # published by the Free Software Foundation.
9 #
10 # Adblock Plus is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
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/>.
17
18 """
19 Update update manifests
Wladimir Palant 2014/07/22 11:24:26 Generate update manifests?
Felix Dahlke 2014/07/22 12:01:11 Done.
20 =======================
21
22 This script generates update manifests for all extensions and apps
23 """
24
25 from ConfigParser import SafeConfigParser
26 from sitescripts.extensions.utils import (Configuration, getDownloadLinks,
27 readMetadata)
28 from sitescripts.utils import get_config, get_template
29
30 def writeUpdateManifest(links):
Felix Dahlke 2014/07/22 08:11:11 This hasn't been changed, just moved. Since I kep
Wladimir Palant 2014/07/22 11:24:26 Quite a few more actually: elemhidehelper, abpcust
Felix Dahlke 2014/07/22 12:01:11 It doesn't look to me like we're generating update
Wladimir Palant 2014/07/22 18:41:22 We do, see https://adblockplus.org/update.rdf. Ext
31 """
32 writes an update manifest for all extensions and Android apps
33 """
34
35 extensions = {'gecko': [], 'android': [], 'safari': []}
36 for repo in Configuration.getRepositoryConfigurations():
37 if repo.type not in extensions or not links.has_section(repo.repositoryName) :
38 continue
39 data = readMetadata(repo, links.get(repo.repositoryName, 'version'))
40 data['updateURL'] = links.get(repo.repositoryName, 'downloadURL')
41 if data['updateURL'].startswith(repo.downloadsURL):
42 data['updateURL'] += "?update"
43 extensions[repo.type].append(data)
44
45 if len(extensions['android']) > 1:
46 print >>sys.stderr, 'Warning: more than one Android app defined, update mani fest only works for one'
47
48 for repoType in extensions.iterkeys():
49 manifestPath = get_config().get('extensions', '%sUpdateManifestPath' % repoT ype)
50 template = get_template(get_config().get('extensions', '%sUpdateManifest' % repoType))
51 print extensions[repoType]
Wladimir Palant 2014/07/22 11:24:26 Debug code?
Felix Dahlke 2014/07/22 12:01:11 Ouch, done.
52 template.stream({'extensions': extensions[repoType]}).dump(manifestPath)
53
54 def updateUpdateManifests():
55 """
56 updates all update manifests with the current versions
57 """
58
59 parser = SafeConfigParser()
60 getDownloadLinks(parser)
61 writeUpdateManifest(parser)
62
63 if __name__ == "__main__":
64 updateUpdateManifests()
OLDNEW

Powered by Google App Engine
This is Rietveld