Closed hANSIc99 closed 5 years ago
Does this help? I don't have 3.7 around to test.
diff --git a/kas/libkas.py b/kas/libkas.py
index 2706796..2cf74f5 100644
--- a/kas/libkas.py
+++ b/kas/libkas.py
@@ -157,18 +157,22 @@ def find_program(paths, name):
return None
+def _create_task(routine):
+ try:
+ creation_func = asyncio.ensure_future
+ except AttributeError:
+ # for Python < 3.5, avoiding the keyword 'async' introduced in 3.7
+ creation_func = getattr(asyncio, 'async')
+
+ return creation_func(routine)
+
def repos_fetch(repos):
"""
Fetches the list of repositories to the kas_work_dir.
"""
tasks = []
for repo in repos:
- if not hasattr(asyncio, 'ensure_future'):
- # pylint: disable=no-member,deprecated-method
- task = asyncio.async(repo.fetch_async())
- else:
- task = asyncio.ensure_future(repo.fetch_async())
- tasks.append(task)
+ tasks.append(_create_task(repo.fetch_async()))
loop = asyncio.get_event_loop()
loop.run_until_complete(asyncio.wait(tasks))
@@ -184,12 +188,7 @@ def repos_apply_patches(repos):
"""
tasks = []
for repo in repos:
- if not hasattr(asyncio, 'ensure_future'):
- # pylint: disable=no-member,deprecated-method
- task = asyncio.async(repo.apply_patches_async())
- else:
- task = asyncio.ensure_future(repo.apply_patches_async())
- tasks.append(task)
+ tasks.append(_create_task(repo.apply_patches_async()))
loop = asyncio.get_event_loop()
loop.run_until_complete(asyncio.wait(tasks))
But please use the mailing list for follow-ups. We consolidate all communication there, and I'll also propose this patch properly only on that channel.
Patch sent, https://groups.google.com/forum/#!topic/kas-devel/YO17JUxCBQg, we still need feedback regarding 3.7, though.
When I try to execute kas with python3.7, the following error message appears:
However, when I execute kas with python3.5 it runs without problems: python3.5 -m kas