From 02b0578a6a975ddccd808326171b0c243c4cddc7 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 8 Nov 2024 13:34:05 +1100 Subject: [PATCH] Tools: strip python2 support from size_compare_branches.py --- Tools/scripts/size_compare_branches.py | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/Tools/scripts/size_compare_branches.py b/Tools/scripts/size_compare_branches.py index 6ff77c1295..b57333a8ff 100755 --- a/Tools/scripts/size_compare_branches.py +++ b/Tools/scripts/size_compare_branches.py @@ -21,25 +21,15 @@ import fnmatch import optparse import os import pathlib +import queue import shutil import string import subprocess -import sys import tempfile import threading import time import board_list -try: - import queue as Queue -except ImportError: - import Queue - -if sys.version_info[0] < 3: - running_python3 = False -else: - running_python3 = True - class SizeCompareBranchesResult(object): '''object to return results from a comparison''' @@ -250,10 +240,9 @@ class SizeCompareBranches(object): # select not available on Windows... probably... time.sleep(0.1) continue - if running_python3: - x = bytearray(x) - x = filter(lambda x : chr(x) in string.printable, x) - x = "".join([chr(c) for c in x]) + x = bytearray(x) + x = filter(lambda x : chr(x) in string.printable, x) + x = "".join([chr(c) for c in x]) output += x x = x.rstrip() some_output = "%s: %s" % (prefix, x) @@ -437,7 +426,7 @@ class SizeCompareBranches(object): while True: try: result = self.thread_exit_result_queue.get_nowait() - except Queue.Empty: + except queue.Empty: break if result is None: continue @@ -449,7 +438,7 @@ class SizeCompareBranches(object): # shared list for the threads: self.parallel_tasks = copy.copy(tasks) # make this an argument instead?! threads = [] - self.thread_exit_result_queue = Queue.Queue() + self.thread_exit_result_queue = queue.Queue() tstart = time.time() self.failure_exceptions = []