Read the NDK version from the NDK dir, if possible
(ndk_dir)
| 110 | |
| 111 | |
| 112 | def read_ndk_version(ndk_dir): |
| 113 | """Read the NDK version from the NDK dir, if possible""" |
| 114 | try: |
| 115 | with open(join(ndk_dir, 'source.properties')) as fileh: |
| 116 | ndk_data = fileh.read() |
| 117 | except IOError: |
| 118 | info(UNKNOWN_NDK_MESSAGE) |
| 119 | return |
| 120 | |
| 121 | for line in ndk_data.split('\n'): |
| 122 | if line.startswith('Pkg.Revision'): |
| 123 | break |
| 124 | else: |
| 125 | info(PARSE_ERROR_NDK_MESSAGE) |
| 126 | return |
| 127 | |
| 128 | # Line should have the form "Pkg.Revision = ..." |
| 129 | unparsed_ndk_version = line.split('=')[-1].strip() |
| 130 | |
| 131 | return packaging.version.parse(unparsed_ndk_version) |
| 132 | |
| 133 | |
| 134 | MIN_TARGET_API = 30 |
no outgoing calls