diff --git a/tools/get.py b/tools/get.py index baf31ebd876..68b92e05da7 100755 --- a/tools/get.py +++ b/tools/get.py @@ -107,14 +107,12 @@ def verify_files(filename, destination, rename_to): for i, zipped_file in enumerate(archive.namelist(), 1): local_path = os.path.join(extracted_dir_path, zipped_file.replace(first_dir, rename_to, 1)) if not os.path.exists(local_path): - if verbose: - print(f"\nMissing {zipped_file} on location: {extracted_dir_path}") - print(f"Verification failed; aborted in {format_time(time.time() - t1)}") + print(f"\nMissing {zipped_file} on location: {extracted_dir_path}") + print(f"Verification failed; aborted in {format_time(time.time() - t1)}") return False print_verification_progress(total_files, i, t1) except zipfile.BadZipFile: - if verbose: - print(f"Verification failed; aborted in {format_time(time.time() - t1)}") + print(f"Verification failed; aborted in {format_time(time.time() - t1)}") return False elif filename.endswith(".tar.gz"): try: @@ -124,14 +122,12 @@ def verify_files(filename, destination, rename_to): for i, zipped_file in enumerate(archive.getnames(), 1): local_path = os.path.join(extracted_dir_path, zipped_file.replace(first_dir, rename_to, 1)) if not os.path.exists(local_path): - if verbose: - print(f"\nMissing {zipped_file} on location: {extracted_dir_path}") - print(f"Verification failed; aborted in {format_time(time.time() - t1)}") + print(f"\nMissing {zipped_file} on location: {extracted_dir_path}") + print(f"Verification failed; aborted in {format_time(time.time() - t1)}") return False print_verification_progress(total_files, i, t1) except tarfile.ReadError: - if verbose: - print(f"Verification failed; aborted in {format_time(time.time() - t1)}") + print(f"Verification failed; aborted in {format_time(time.time() - t1)}") return False elif filename.endswith(".tar.xz"): try: @@ -141,14 +137,12 @@ def verify_files(filename, destination, rename_to): for i, zipped_file in enumerate(archive.getnames(), 1): local_path = os.path.join(extracted_dir_path, zipped_file.replace(first_dir, rename_to, 1)) if not os.path.exists(local_path): - if verbose: - print(f"\nMissing {zipped_file} on location: {extracted_dir_path}") - print(f"Verification failed; aborted in {format_time(time.time() - t1)}") + print(f"\nMissing {zipped_file} on location: {extracted_dir_path}") + print(f"Verification failed; aborted in {format_time(time.time() - t1)}") return False print_verification_progress(total_files, i, t1) except tarfile.ReadError: - if verbose: - print(f"Verification failed; aborted in {format_time(time.time() - t1)}") + print(f"Verification failed; aborted in {format_time(time.time() - t1)}") return False else: raise NotImplementedError("Unsupported archive type") @@ -237,12 +231,7 @@ def unpack(filename, destination, force_extract): # noqa: C901 shutil.rmtree(rename_to) shutil.move(dirname, rename_to) - if verify_files(filename, destination, rename_to): - print(" Files extracted successfully.") - return True - else: - print(" Failed to extract files.") - return False + return True def download_file_with_progress(url, filename, start_time): @@ -302,7 +291,6 @@ def get_tool(tool, force_download, force_extract): local_path = dist_dir + archive_name url = tool["url"] start_time = time.time() - print("") if not os.path.isfile(local_path) or force_download: if verbose: print("Downloading '" + archive_name + "' to '" + local_path + "'") @@ -433,9 +421,6 @@ def identify_platform(): current_dir + "/../package/package_esp32_index.template.json", identified_platform ) mkdir_p(dist_dir) - - print("\nDownloading and extracting tools...") - for tool in tools_to_download: if is_test: print("Would install: {0}".format(tool["archiveFileName"])) @@ -447,4 +432,4 @@ def identify_platform(): print(f"Tool {tool['archiveFileName']} was corrupted, but re-downloading did not help!\n") sys.exit(1) - print("\nPlatform Tools Installed") + print("Platform Tools Installed")