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