mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
Fix pyqt6 loader on windows (#1797)
This commit is contained in:
parent
cc85ca8e01
commit
7597262c80
1 changed files with 19 additions and 16 deletions
|
|
@ -145,25 +145,28 @@ def has_binding(api):
|
|||
return True
|
||||
|
||||
except ModuleNotFoundError:
|
||||
from importlib import machinery
|
||||
try:
|
||||
from importlib import machinery
|
||||
|
||||
# importing top level PyQt4/PySide module is ok...
|
||||
mod = __import__(module_name)
|
||||
# importing top level PyQt4/PySide module is ok...
|
||||
mod = __import__(module_name)
|
||||
|
||||
# ...importing submodules is not
|
||||
loader_details = (machinery.ExtensionFileLoader, machinery.EXTENSION_SUFFIXES)
|
||||
submod_finder = machinery.FileFinder(mod.__path__[0], loader_details)
|
||||
submod_check = (
|
||||
submod_finder.find_spec("QtCore") is not None
|
||||
and submod_finder.find_spec("QtGui") is not None
|
||||
and submod_finder.find_spec("QtSvg") is not None
|
||||
)
|
||||
# ...importing submodules is not
|
||||
loader_details = (machinery.ExtensionFileLoader, machinery.EXTENSION_SUFFIXES)
|
||||
submod_finder = machinery.FileFinder(mod.__path__[0], loader_details)
|
||||
submod_check = (
|
||||
submod_finder.find_spec("QtCore") is not None
|
||||
and submod_finder.find_spec("QtGui") is not None
|
||||
and submod_finder.find_spec("QtSvg") is not None
|
||||
)
|
||||
|
||||
# we can also safely check PySide version
|
||||
if api == QT_API_PYSIDE:
|
||||
return check_version(mod.__version__, '1.0.3') and submod_check
|
||||
else:
|
||||
return submod_check
|
||||
# we can also safely check PySide version
|
||||
if api == QT_API_PYSIDE:
|
||||
return check_version(mod.__version__, '1.0.3') and submod_check
|
||||
else:
|
||||
return submod_check
|
||||
except:
|
||||
return False
|
||||
|
||||
except ImportError:
|
||||
return False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue