mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Disable matplotlib support if display isn't available (PY-16100)
This commit is contained in:
@@ -103,6 +103,9 @@ USE_LIB_COPY = SUPPORT_GEVENT and \
|
||||
(IS_PY3K and sys.version_info[1] >= 3))
|
||||
|
||||
|
||||
INTERACTIVE_MODE_AVAILABLE = os.getenv('DISPLAY') is not None
|
||||
|
||||
|
||||
def protect_libraries_from_patching():
|
||||
"""
|
||||
In this function we delete some modules from `sys.modules` dictionary and import them again inside
|
||||
|
||||
@@ -16,7 +16,7 @@ import os
|
||||
import sys
|
||||
|
||||
from _pydev_imps._pydev_saved_modules import threading
|
||||
from _pydevd_bundle.pydevd_constants import dict_iter_items
|
||||
from _pydevd_bundle.pydevd_constants import INTERACTIVE_MODE_AVAILABLE
|
||||
|
||||
import traceback
|
||||
from _pydev_bundle import fix_getpass
|
||||
@@ -178,6 +178,9 @@ def init_mpl_in_console(interpreter):
|
||||
|
||||
set_return_control_callback(return_control)
|
||||
|
||||
if not INTERACTIVE_MODE_AVAILABLE:
|
||||
return
|
||||
|
||||
from _pydev_bundle.pydev_import_hook import import_hook_manager
|
||||
from pydev_ipython.matplotlibtools import activate_matplotlib, activate_pylab, activate_pyplot
|
||||
import_hook_manager.add_module_name("matplotlib", lambda: activate_matplotlib(interpreter.enableGui))
|
||||
|
||||
@@ -12,7 +12,7 @@ import traceback
|
||||
|
||||
from _pydevd_bundle.pydevd_constants import IS_JYTH_LESS25, IS_PY3K, IS_PY34_OLDER, get_thread_id, dict_keys, dict_pop, dict_contains, \
|
||||
dict_iter_items, DebugInfoHolder, PYTHON_SUSPEND, STATE_SUSPEND, STATE_RUN, get_frame, xrange, \
|
||||
clear_cached_thread_id
|
||||
clear_cached_thread_id, INTERACTIVE_MODE_AVAILABLE
|
||||
from _pydev_bundle import fix_getpass
|
||||
from _pydev_bundle import pydev_imports, pydev_log
|
||||
from _pydev_bundle._pydev_filesystem_encoding import getfilesystemencoding
|
||||
@@ -993,7 +993,8 @@ class PyDB:
|
||||
send_message("asyncio_event", 0, "Task", "Task", "thread", "stop", file, 1, frame=None, parent=None)
|
||||
|
||||
try:
|
||||
self.init_matplotlib_support()
|
||||
if INTERACTIVE_MODE_AVAILABLE:
|
||||
self.init_matplotlib_support()
|
||||
except:
|
||||
sys.stderr.write("Matplotlib support in debugger failed\n")
|
||||
traceback.print_exc()
|
||||
|
||||
Reference in New Issue
Block a user