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

Side by Side Diff: sitescripts/extensions/android.py

Issue 5723465818570752: Issue 520 - Generate PAD files for download portals when updating download links (Closed)
Patch Set: Addressed comments Created June 4, 2014, 4:35 p.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 | « .sitescripts.example ('k') | sitescripts/extensions/bin/updateDownloadLinks.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-2014 Eyeo GmbH
3 #
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
6 # published by the Free Software Foundation.
7 #
8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
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/>.
15
16 import subprocess
17 import xml.dom.minidom as dom
18
19 ANDROID_VERSIONS = ['1.0', '1.1', '1.5', '1.6', '2.0', '2.0.1', '2.1',
20 '2.2', '2.3', '2.3.3', '3.0', '3.1', '3.2', '4.0',
21 '4.0.3', '4.1', '4.2', '4.3', '4.4']
22
23 def get_min_sdk_version(repo, version):
24 command = ['hg', 'cat', '-r', version, 'AndroidManifest.xml']
25 result = subprocess.check_output(command, cwd=repo.repository)
26
27 uses_sdk = dom.parseString(result).getElementsByTagName('uses-sdk')[0]
28 return uses_sdk.attributes["android:minSdkVersion"].value
29
30 def get_min_android_version(repo, version):
31 return ANDROID_VERSIONS[int(get_min_sdk_version(repo, version)) - 1]
OLDNEW
« no previous file with comments | « .sitescripts.example ('k') | sitescripts/extensions/bin/updateDownloadLinks.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld