return True
+def get_android_tools_versions(sdk_path, ndk_path=None):
+ '''get a list of the versions of all installed Android SDK/NDK components'''
+
+ if sdk_path[-1] != '/':
+ sdk_path += '/'
+ components = []
+ if ndk_path:
+ ndk_release_txt = os.path.join(ndk_path, 'RELEASE.TXT')
+ if os.path.isfile(ndk_release_txt):
+ with open(ndk_release_txt, 'r') as fp:
+ components.append((os.path.basename(ndk_path), fp.read()[:-1]))
+
+ pattern = re.compile('^Pkg.Revision=(.+)', re.MULTILINE)
+ for root, dirs, files in os.walk(sdk_path):
+ if 'source.properties' in files:
+ source_properties = os.path.join(root, 'source.properties')
+ with open(source_properties, 'r') as fp:
+ m = pattern.search(fp.read())
+ if m:
+ components.append((root[len(sdk_path):], m.group(1)))
+
+ return components
+
+
+def get_android_tools_version_log(sdk_path, ndk_path):
+ '''get a list of the versions of all installed Android SDK/NDK components'''
+ log = ''
+ components = get_android_tools_versions(sdk_path, ndk_path)
+ for name, version in sorted(components):
+ log += '* ' + name + ' (' + version + ')\n'
+
+ return log
+
+
def parse_commandline():
"""Parse the command line. Returns options, parser."""
for build in app.builds:
wikilog = None
+ tools_version_log = '== Installed Android Tools ==\n\n'
+ tools_version_log += get_android_tools_version_log(config['sdk_path'], build.ndk_path())
try:
# For the first build of a particular app, we need to set up
failed_apps[appid] = e
wikilog = str(e)
+ if wikilog:
+ wikilog = tools_version_log + '\n\n' + wikilog
+
if options.wiki and wikilog:
try:
# Write a page with the last build log for this version code