From 883f125722c8ef2b29dce3e09b4200a29a728136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 16 Feb 2021 11:04:24 +0100 Subject: [PATCH] =?UTF-8?q?Compatibility=20with=20Blender=202.93=20/=20Pyt?= =?UTF-8?q?hon=203.9=20=E2=86=92=20require=20Blender=202.80+?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code now requires Python 3.7 or newer, as a side-effect of the changes required for compatibility with 3.9 (as used in Blender 2.93). As a result, Blender Cloud Add-on now requires Blender 2.80 or newer. --- CHANGELOG.md | 6 ++++++ blender_cloud/__init__.py | 2 +- blender_cloud/async_loop.py | 8 +++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5eb768..c503e58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,14 @@ # Blender Cloud changelog +## Version 1.18 (in development) + +- Add compatibility with Python 3.9 (as used in Blender 2.93). +- Drop compatibility with Blender 2.79 and older. The last version of the + Blender Cloud add-on with 2.79 and older is version 1.17. ## Version 1.17 (2021-02-04) +- This is the last version compatible with Blender 2.77a - 2.79. - Upgrade BAT to version 1.3.1, which brings compatibility with Geometry Nodes and fixes some issues on Windows. diff --git a/blender_cloud/__init__.py b/blender_cloud/__init__.py index 397854f..4a25e1f 100644 --- a/blender_cloud/__init__.py +++ b/blender_cloud/__init__.py @@ -25,7 +25,7 @@ bl_info = { 'blender': (2, 80, 0), 'location': 'Addon Preferences panel, and Ctrl+Shift+Alt+A anywhere for texture browser', 'description': 'Texture library browser and Blender Sync. Requires the Blender ID addon ' - 'and Blender 2.77a or newer.', + 'and Blender 2.80 or newer.', 'wiki_url': 'https://wiki.blender.org/index.php/Extensions:2.6/Py/' 'Scripts/System/BlenderCloud', 'category': 'System', diff --git a/blender_cloud/async_loop.py b/blender_cloud/async_loop.py index 2a69514..995c4f1 100644 --- a/blender_cloud/async_loop.py +++ b/blender_cloud/async_loop.py @@ -43,6 +43,8 @@ def setup_asyncio_executor(): # On Windows, the default event loop is SelectorEventLoop, which does # not support subprocesses. ProactorEventLoop should be used instead. # Source: https://docs.python.org/3/library/asyncio-subprocess.html + # + # NOTE: this is actually the default even loop in Python 3.9+. loop = asyncio.ProactorEventLoop() asyncio.set_event_loop(loop) else: @@ -73,7 +75,11 @@ def kick_async_loop(*args) -> bool: log.warning('loop closed, stopping immediately.') return True - all_tasks = asyncio.Task.all_tasks() + # Passing an explicit loop is required. Without it, the function uses + # asyncio.get_running_loop(), which raises a RuntimeError as the current + # loop isn't running. + all_tasks = asyncio.all_tasks(loop=loop) + if not len(all_tasks): log.debug('no more scheduled tasks, stopping after this kick.') stop_after_this_kick = True