Compatibility with Python 3.7.

This commit is contained in:
Julien Palard 2021-01-19 16:02:33 +01:00
parent 2a27070928
commit ad27b7ce70
2 changed files with 10 additions and 3 deletions

View File

@ -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":

View File

@ -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