@@ -211,30 +211,29 @@ def set_env_variables_from_result_log():
211211 pass
212212
213213 # FIND a NOTICE file and build out path
214+ pattern_notice = r'\[.*?\]\s*build\s+(([^\s]*?)/obj/NOTICE\.(?:xml(?:\.gz)?|html|txt))'
214215 for line in reversed (android_log_lines ):
215- line = line .strip ()
216- if line .endswith ("obj/NOTICE.xml" ) or line .endswith ("obj/NOTICE.html" ) or line .endswith ("obj/NOTICE.txt" ):
217- words = line .split ()
218- build_out_notice_file_path = words [- 1 ]
219- find_idx = build_out_notice_file_path .find ("obj/" )
220- build_out_path = build_out_notice_file_path [:find_idx ]
216+ match = re .search (pattern_notice , line )
217+ if match :
218+ build_out_notice_file_path = match .group (1 )
219+ build_out_path = match .group (2 )
221220 break
222221
223- if build_out_path == "" :
222+ if not build_out_path :
223+ pattern = re .compile (r'.*Installed file list:\s*([^\s]+)' )
224224 for line in reversed (android_log_lines ):
225225 try :
226- pattern = re .compile (r'.*Installed file list\s*(.*):\s*(.*)' )
227226 matched = pattern .match (line )
228227 if matched is not None :
229- build_out_path = os .path .dirname (matched .group (2 ))
228+ build_out_path = os .path .dirname (matched .group (1 ))
230229 break
231230 except Exception :
232231 pass
233- if build_out_path == "" :
232+ if not build_out_path :
234233 logger .error ("Can't find a build output path." )
235234 sys .exit (1 )
236235
237- if build_out_notice_file_path == "" :
236+ if not build_out_notice_file_path :
238237 build_out_notice_file_path = os .path .join (build_out_path , "obj" )
239238
240239 read_module_info_from_build_output_file ()
0 commit comments