@@ -107,12 +107,14 @@ def verify_files(filename, destination, rename_to):
107
107
for i , zipped_file in enumerate (archive .namelist (), 1 ):
108
108
local_path = os .path .join (extracted_dir_path , zipped_file .replace (first_dir , rename_to , 1 ))
109
109
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 )} " )
112
113
return False
113
114
print_verification_progress (total_files , i , t1 )
114
115
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 )} " )
116
118
return False
117
119
elif filename .endswith (".tar.gz" ):
118
120
try :
@@ -122,12 +124,14 @@ def verify_files(filename, destination, rename_to):
122
124
for i , zipped_file in enumerate (archive .getnames (), 1 ):
123
125
local_path = os .path .join (extracted_dir_path , zipped_file .replace (first_dir , rename_to , 1 ))
124
126
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 )} " )
127
130
return False
128
131
print_verification_progress (total_files , i , t1 )
129
132
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 )} " )
131
135
return False
132
136
elif filename .endswith (".tar.xz" ):
133
137
try :
@@ -137,12 +141,14 @@ def verify_files(filename, destination, rename_to):
137
141
for i , zipped_file in enumerate (archive .getnames (), 1 ):
138
142
local_path = os .path .join (extracted_dir_path , zipped_file .replace (first_dir , rename_to , 1 ))
139
143
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 )} " )
142
147
return False
143
148
print_verification_progress (total_files , i , t1 )
144
149
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 )} " )
146
152
return False
147
153
else :
148
154
raise NotImplementedError ("Unsupported archive type" )
@@ -231,7 +237,12 @@ def unpack(filename, destination, force_extract): # noqa: C901
231
237
shutil .rmtree (rename_to )
232
238
shutil .move (dirname , rename_to )
233
239
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
235
246
236
247
237
248
def download_file_with_progress (url , filename , start_time ):
@@ -291,6 +302,7 @@ def get_tool(tool, force_download, force_extract):
291
302
local_path = dist_dir + archive_name
292
303
url = tool ["url" ]
293
304
start_time = time .time ()
305
+ print ("" )
294
306
if not os .path .isfile (local_path ) or force_download :
295
307
if verbose :
296
308
print ("Downloading '" + archive_name + "' to '" + local_path + "'" )
@@ -421,6 +433,9 @@ def identify_platform():
421
433
current_dir + "/../package/package_esp32_index.template.json" , identified_platform
422
434
)
423
435
mkdir_p (dist_dir )
436
+
437
+ print ("\n Downloading and extracting tools..." )
438
+
424
439
for tool in tools_to_download :
425
440
if is_test :
426
441
print ("Would install: {0}" .format (tool ["archiveFileName" ]))
@@ -432,4 +447,4 @@ def identify_platform():
432
447
print (f"Tool { tool ['archiveFileName' ]} was corrupted, but re-downloading did not help!\n " )
433
448
sys .exit (1 )
434
449
435
- print ("Platform Tools Installed" )
450
+ print ("\n Platform Tools Installed" )
0 commit comments