mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
Handle new matplotlib versions (#1791)
Fixes: https://github.com/microsoft/debugpy/issues/1623
This commit is contained in:
parent
24aa6a5f8e
commit
cc85ca8e01
1 changed files with 21 additions and 1 deletions
|
|
@ -53,9 +53,29 @@ def find_gui_and_backend():
|
|||
return gui, backend
|
||||
|
||||
|
||||
def _get_major_version(module):
|
||||
return int(module.__version__.split('.')[0])
|
||||
|
||||
|
||||
def _get_minor_version(module):
|
||||
return int(module.__version__.split('.')[1])
|
||||
|
||||
|
||||
def is_interactive_backend(backend):
|
||||
"""Check if backend is interactive"""
|
||||
matplotlib = sys.modules["matplotlib"]
|
||||
new_api_version = (3, 9)
|
||||
installed_version = (
|
||||
_get_major_version(matplotlib),
|
||||
_get_minor_version(matplotlib)
|
||||
)
|
||||
|
||||
if installed_version >= new_api_version:
|
||||
interactive_bk = matplotlib.backends.backend_registry.list_builtin(
|
||||
matplotlib.backends.BackendFilter.INTERACTIVE)
|
||||
non_interactive_bk = matplotlib.backends.backend_registry.list_builtin(
|
||||
matplotlib.backends.BackendFilter.NON_INTERACTIVE)
|
||||
else:
|
||||
from matplotlib.rcsetup import interactive_bk, non_interactive_bk # @UnresolvedImport
|
||||
|
||||
if backend in interactive_bk:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue