summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2022-01-25 13:47:50 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2022-01-25 13:47:50 +0530
commitd8afc8b5ee5d08144fb314a247a238f07abab2a4 (patch)
tree21e4be1344f0c4e105c3cace3ad19a90356945bd
parentf7fb40564858bed0ed892599d928b16aaae8da6e (diff)
cerbero: Backport fix for removed loop param of PriorityQueue()
Backport to 1.18 of: https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/756 1.18 needs to maintain support for Python 3.6, so we need to add the argument conditionally. Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/783>
-rw-r--r--cerbero/build/oven.py17
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)