Skip to content

Commit 16ef2e7

Browse files
committed
Changed check_pyqt() to work with qtpy (closes #897)
1 parent 61aa31d commit 16ef2e7

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/depends.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import logging
1818
import os
19+
from distutils import version
1920
from importlib import import_module
2021

2122
# We can now use logging so set up a simple configuration
@@ -385,21 +386,21 @@ def check_pyqt():
385386
Here we are checking for PyQt4 with its version, as for it require
386387
PyQt 4.8 or later.
387388
"""
388-
QtCore = try_import(
389-
'qtpy.QtCore', 'PyBitmessage requires PyQt 4.8 or later and Qt 4.7 or later.')
389+
qtpy = try_import(
390+
'qtpy', 'PyBitmessage requires qtpy, PyQt 4.8 or later and Qt 4.7 or later.')
390391

391-
if not QtCore:
392+
if not qtpy:
392393
return False
393394

394-
logger.info('PyQt Version: %s', QtCore.PYQT_VERSION_STR)
395-
logger.info('Qt Version: %s', QtCore.QT_VERSION_STR)
395+
logger.info('PyQt Version: %s', qtpy.PYQT_VERSION)
396+
logger.info('Qt Version: %s', qtpy.QT_VERSION)
396397
passed = True
397-
if QtCore.PYQT_VERSION < 0x40800:
398+
if version.LooseVersion(qtpy.PYQT_VERSION) < '4.8':
398399
logger.error(
399400
'This version of PyQt is too old. PyBitmessage requries'
400401
' PyQt 4.8 or later.')
401402
passed = False
402-
if QtCore.QT_VERSION < 0x40700:
403+
if version.LooseVersion(qtpy.QT_VERSION) < '4.7':
403404
logger.error(
404405
'This version of Qt is too old. PyBitmessage requries'
405406
' Qt 4.7 or later.')
@@ -408,7 +409,7 @@ def check_pyqt():
408409

409410

410411
def check_msgpack():
411-
"""Do sgpack module check.
412+
"""Do msgpack module check.
412413
413414
simply checking if msgpack package with all its dependency
414415
is available or not as recommended for messages coding.

0 commit comments

Comments
 (0)