Tools: strip python2 support from size_compare_branches.py

This commit is contained in:
Peter Barker 2024-11-08 13:34:05 +11:00 committed by Peter Barker
parent 0d74bb1a76
commit 02b0578a6a
1 changed files with 6 additions and 17 deletions

View File

@ -21,25 +21,15 @@ import fnmatch
import optparse import optparse
import os import os
import pathlib import pathlib
import queue
import shutil import shutil
import string import string
import subprocess import subprocess
import sys
import tempfile import tempfile
import threading import threading
import time import time
import board_list 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): class SizeCompareBranchesResult(object):
'''object to return results from a comparison''' '''object to return results from a comparison'''
@ -250,10 +240,9 @@ class SizeCompareBranches(object):
# select not available on Windows... probably... # select not available on Windows... probably...
time.sleep(0.1) time.sleep(0.1)
continue continue
if running_python3: x = bytearray(x)
x = bytearray(x) x = filter(lambda x : chr(x) in string.printable, x)
x = filter(lambda x : chr(x) in string.printable, x) x = "".join([chr(c) for c in x])
x = "".join([chr(c) for c in x])
output += x output += x
x = x.rstrip() x = x.rstrip()
some_output = "%s: %s" % (prefix, x) some_output = "%s: %s" % (prefix, x)
@ -437,7 +426,7 @@ class SizeCompareBranches(object):
while True: while True:
try: try:
result = self.thread_exit_result_queue.get_nowait() result = self.thread_exit_result_queue.get_nowait()
except Queue.Empty: except queue.Empty:
break break
if result is None: if result is None:
continue continue
@ -449,7 +438,7 @@ class SizeCompareBranches(object):
# shared list for the threads: # shared list for the threads:
self.parallel_tasks = copy.copy(tasks) # make this an argument instead?! self.parallel_tasks = copy.copy(tasks) # make this an argument instead?!
threads = [] threads = []
self.thread_exit_result_queue = Queue.Queue() self.thread_exit_result_queue = queue.Queue()
tstart = time.time() tstart = time.time()
self.failure_exceptions = [] self.failure_exceptions = []