diff options
-rw-r--r-- | cerbero/build/oven.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/cerbero/build/oven.py b/cerbero/build/oven.py index b55e3093..99046630 100644 --- a/cerbero/build/oven.py +++ b/cerbero/build/oven.py @@ -316,8 +316,13 @@ class Oven (object): all_steps = ["init"] + [s[1] for s in next(iter(recipes)).steps] # async queues used for each step - loop = asyncio.get_event_loop() - default_queue = asyncio.PriorityQueue(loop=loop) + asyncio_queue_args = {} + # Loop param has been implicitly fetched since 3.7 and has been removed + # in 3.10, so we only need it for Python 3.6 + # https://docs.python.org/3/whatsnew/3.10.html#whatsnew310-removed + if sys.version_info < (3, 7, 0): + asyncio_queue_args = {'loop': asyncio.get_event_loop()} + default_queue = asyncio.PriorityQueue(*asyncio_queue_args) queues = {step : default_queue for step in all_steps} # find the install steps for ensuring consistency between all of them @@ -330,21 +335,21 @@ class Oven (object): # allocate jobs job_allocation = collections.defaultdict(lambda : 0) if self.jobs > 4: - queues[BuildSteps.COMPILE[1]] = asyncio.PriorityQueue(loop=loop) + queues[BuildSteps.COMPILE[1]] = asyncio.PriorityQueue(*asyncio_queue_args) job_allocation[BuildSteps.COMPILE[1]] = 2 if self.jobs > 5: job_allocation[BuildSteps.COMPILE[1]] = 3 if self.jobs > 7: - install_queue = asyncio.PriorityQueue(loop=loop) + install_queue = asyncio.PriorityQueue(*asyncio_queue_args) for step in install_steps: queues[step] = install_queue job_allocation[BuildSteps.INSTALL[1]] = 1 if self.jobs > 8: job_allocation[BuildSteps.EXTRACT[1]] = 1 - queues[BuildSteps.EXTRACT[1]] = asyncio.PriorityQueue(loop=loop) + queues[BuildSteps.EXTRACT[1]] = asyncio.PriorityQueue(*asyncio_queue_args) if self.jobs > 9: job_allocation[BuildSteps.FETCH[1]] = 1 - queues[BuildSteps.FETCH[1]] = asyncio.PriorityQueue(loop=loop) + queues[BuildSteps.FETCH[1]] = asyncio.PriorityQueue(*asyncio_queue_args) # async locks used to synchronize step execution locks = collections.defaultdict(lambda : None) |