diff --git a/ansible_parallel.py b/ansible_parallel.py index ab9f94b..e584e8d 100644 --- a/ansible_parallel.py +++ b/ansible_parallel.py @@ -58,7 +58,10 @@ async def run_playbook(playbook, args, results): env={**os.environ, "ANSIBLE_FORCE_COLOR": "1"}, ) task = [] - while line := (await process.stdout.readline()).decode(): + while True: + line = (await process.stdout.readline()).decode() + if not line: + break if line == "\n": chunk = "".join(task) + line await results.put(prepare_chunk(playbook, chunk)) @@ -93,7 +96,10 @@ async def show_progression(results): frameno = 0 print(DISABLE_CURSOR, end="") try: - while result := await results.get(): + while True: + result = await results.get() + if not result: + break frameno += 1 msgtype, playbook, msg = result if msgtype == "START": diff --git a/setup.cfg b/setup.cfg index c5fffeb..8705a9b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -15,12 +15,13 @@ classifiers = License :: OSI Approved :: MIT License Natural Language :: English Programming Language :: Python :: 3 + Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 [options] py_modules = ansible_parallel -python_requires = >= 3.8 +python_requires = >= 3.7 [options.entry_points] console_scripts = ansible-parallel=ansible_parallel:main