@@ -107,12 +107,14 @@ def verify_files(filename, destination, rename_to):
107107 for i , zipped_file in enumerate (archive .namelist (), 1 ):
108108 local_path = os .path .join (extracted_dir_path , zipped_file .replace (first_dir , rename_to , 1 ))
109109 if not os .path .exists (local_path ):
110- print (f"\n Missing { zipped_file } on location: { extracted_dir_path } " )
111- print (f"Verification failed; aborted in { format_time (time .time () - t1 )} " )
110+ if verbose :
111+ print (f"\n Missing { zipped_file } on location: { extracted_dir_path } " )
112+ print (f"Verification failed; aborted in { format_time (time .time () - t1 )} " )
112113 return False
113114 print_verification_progress (total_files , i , t1 )
114115 except zipfile .BadZipFile :
115- print (f"Verification failed; aborted in { format_time (time .time () - t1 )} " )
116+ if verbose :
117+ print (f"Verification failed; aborted in { format_time (time .time () - t1 )} " )
116118 return False
117119 elif filename .endswith (".tar.gz" ):
118120 try :
@@ -122,12 +124,14 @@ def verify_files(filename, destination, rename_to):
122124 for i , zipped_file in enumerate (archive .getnames (), 1 ):
123125 local_path = os .path .join (extracted_dir_path , zipped_file .replace (first_dir , rename_to , 1 ))
124126 if not os .path .exists (local_path ):
125- print (f"\n Missing { zipped_file } on location: { extracted_dir_path } " )
126- print (f"Verification failed; aborted in { format_time (time .time () - t1 )} " )
127+ if verbose :
128+ print (f"\n Missing { zipped_file } on location: { extracted_dir_path } " )
129+ print (f"Verification failed; aborted in { format_time (time .time () - t1 )} " )
127130 return False
128131 print_verification_progress (total_files , i , t1 )
129132 except tarfile .ReadError :
130- print (f"Verification failed; aborted in { format_time (time .time () - t1 )} " )
133+ if verbose :
134+ print (f"Verification failed; aborted in { format_time (time .time () - t1 )} " )
131135 return False
132136 elif filename .endswith (".tar.xz" ):
133137 try :
@@ -137,12 +141,14 @@ def verify_files(filename, destination, rename_to):
137141 for i , zipped_file in enumerate (archive .getnames (), 1 ):
138142 local_path = os .path .join (extracted_dir_path , zipped_file .replace (first_dir , rename_to , 1 ))
139143 if not os .path .exists (local_path ):
140- print (f"\n Missing { zipped_file } on location: { extracted_dir_path } " )
141- print (f"Verification failed; aborted in { format_time (time .time () - t1 )} " )
144+ if verbose :
145+ print (f"\n Missing { zipped_file } on location: { extracted_dir_path } " )
146+ print (f"Verification failed; aborted in { format_time (time .time () - t1 )} " )
142147 return False
143148 print_verification_progress (total_files , i , t1 )
144149 except tarfile .ReadError :
145- print (f"Verification failed; aborted in { format_time (time .time () - t1 )} " )
150+ if verbose :
151+ print (f"Verification failed; aborted in { format_time (time .time () - t1 )} " )
146152 return False
147153 else :
148154 raise NotImplementedError ("Unsupported archive type" )
@@ -231,7 +237,12 @@ def unpack(filename, destination, force_extract): # noqa: C901
231237 shutil .rmtree (rename_to )
232238 shutil .move (dirname , rename_to )
233239
234- return True
240+ if verify_files (filename , destination , rename_to ):
241+ print (" Files extracted successfully." )
242+ return True
243+ else :
244+ print (" Failed to extract files." )
245+ return False
235246
236247
237248def download_file_with_progress (url , filename , start_time ):
@@ -291,6 +302,7 @@ def get_tool(tool, force_download, force_extract):
291302 local_path = dist_dir + archive_name
292303 url = tool ["url" ]
293304 start_time = time .time ()
305+ print ("" )
294306 if not os .path .isfile (local_path ) or force_download :
295307 if verbose :
296308 print ("Downloading '" + archive_name + "' to '" + local_path + "'" )
@@ -421,6 +433,9 @@ def identify_platform():
421433 current_dir + "/../package/package_esp32_index.template.json" , identified_platform
422434 )
423435 mkdir_p (dist_dir )
436+
437+ print ("\n Downloading and extracting tools..." )
438+
424439 for tool in tools_to_download :
425440 if is_test :
426441 print ("Would install: {0}" .format (tool ["archiveFileName" ]))
@@ -432,4 +447,4 @@ def identify_platform():
432447 print (f"Tool { tool ['archiveFileName' ]} was corrupted, but re-downloading did not help!\n " )
433448 sys .exit (1 )
434449
435- print ("Platform Tools Installed" )
450+ print ("\n Platform Tools Installed" )
0 commit comments