+# Return NDK version as [<major>,<minor>] or None if cannot be figured out.
+def getNdkVersion (path):
+ if path == None:
+ return None
+
+ propFilePath = os.path.join(path, "source.properties")
+ try:
+ with open(propFilePath) as propFile:
+ for line in propFile:
+ keyValue = map(lambda x: string.strip(x), line.split("="))
+ if keyValue[0] == "Pkg.Revision":
+ versionParts = keyValue[1].split(".")
+ return tuple(map(int, versionParts[0:2]))
+ except:
+ print("Could not read source prop file '%s'" % propFilePath)
+
+ return None
+
+def checkConfig ():
+ HOST_OS_TO_DOWNLOAD_STRING = {
+ "linux-x86_64" : "linux-x86_64",
+ "windows" : "windows-x86",
+ "windows-x86_64" : "windows-x86_64"
+ }
+
+ version = getNdkVersion(common.ANDROID_NDK_PATH)
+ # Note: NDK currently maintains compatibility between minor
+ # versions. Error out only on major version mismatch.
+ if version == None or version[0] != common.ANDROID_NDK_VERSION[0]:
+ print("**** WARNING! Deqp requires NDK version %s" % common.ANDROID_NDK_VERSION_STRING)
+ print("**** NDK Path %s does not appear to have that version." % common.ANDROID_NDK_PATH)
+
+ # Download hint will use the version encored in common.py, not
+ # the latest minor version available
+ versionString = common.ANDROID_NDK_VERSION_STRING
+ if common.ANDROID_NDK_HOST_OS in HOST_OS_TO_DOWNLOAD_STRING:
+ osString = HOST_OS_TO_DOWNLOAD_STRING[common.ANDROID_NDK_HOST_OS]
+ print("**** Please install from https://dl.google.com/android/repository/android-ndk-%s-%s.zip" % (versionString, osString))
+ else:
+ print("**** Please download version", versionString, "from https://developer.android.com/ndk/downloads/index.html")
+
+ return False
+
+ return True
+