File tree 1 file changed +18
-7
lines changed
1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -284,18 +284,29 @@ def check_environment_variable(var):
284
284
285
285
286
286
def select_default_android_platform (min_api_level ):
287
- ''' selec a default android platform in SDK_ROOT, support platforms 10-19
287
+ ''' select a default android platform in SDK_ROOT
288
288
'''
289
289
290
290
sdk_root = check_environment_variable ('ANDROID_SDK_ROOT' )
291
291
platforms_dir = os .path .join (sdk_root , "platforms" )
292
+ ret_num = - 1
292
293
if os .path .isdir (platforms_dir ):
293
- for num in range (min_api_level , 21 ):
294
- android_platform = 'android-%s' % num
295
- if os .path .isdir (os .path .join (platforms_dir , android_platform )):
296
- Logging .info ('%s is found' % android_platform )
297
- return num
298
- return None
294
+ for dir_name in os .listdir (platforms_dir ):
295
+ if not os .path .isdir (os .path .join (platforms_dir , dir_name )):
296
+ continue
297
+
298
+ import re
299
+ match = re .match (r"android-(\d+)" , dir_name )
300
+ if match is not None :
301
+ num = int (match .group (1 ))
302
+ if num >= min_api_level :
303
+ if ret_num == - 1 or ret_num > num :
304
+ ret_num = num
305
+
306
+ if ret_num != - 1 :
307
+ return ret_num
308
+ else :
309
+ return None
299
310
300
311
301
312
def copy_files_in_dir (src , dst ):
You can’t perform that action at this time.
0 commit comments