Skip to content

Commit 9641279

Browse files
committed
Changed check_pyqt() to work with qtpy
(closes Bitmessage#897, closes Bitmessage#1418)
1 parent bab9f44 commit 9641279

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

src/depends.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import logging # noqa:E402
2020
import subprocess
21-
21+
from distutils import version
2222
from importlib import import_module
2323

2424
# We can now use logging so set up a simple configuration
@@ -52,22 +52,22 @@
5252
}
5353

5454
PACKAGES = {
55-
"PyQt4": {
56-
"OpenBSD": "py-qt4",
57-
"FreeBSD": "py27-qt4",
58-
"Debian": "python-qt4",
59-
"Ubuntu": "python-qt4",
60-
"Ubuntu 12": "python-qt4",
61-
"openSUSE": "python-qt",
62-
"Fedora": "PyQt4",
63-
"Guix": "[email protected]",
64-
"Gentoo": "dev-python/PyQt4",
55+
"qtpy": {
56+
"OpenBSD": "py-qtpy",
57+
"FreeBSD": "py27-QtPy",
58+
"Debian": "python-qtpy",
59+
"Ubuntu": "python-qtpy",
60+
"Ubuntu 12": "python-qtpy",
61+
"openSUSE": "python-QtPy",
62+
"Fedora": "python2-QtPy",
63+
"Guix": "",
64+
"Gentoo": "dev-python/QtPy",
6565
"optional": True,
6666
"description":
67-
"You only need PyQt if you want to use the GUI."
67+
"You only need qtpy if you want to use the GUI."
6868
" When only running as a daemon, this can be skipped.\n"
69-
"However, you would have to install it manually"
70-
" because setuptools does not support PyQt."
69+
"Also maybe you need to install PyQt5 if your package manager"
70+
" not installs it as qtpy dependency"
7171
},
7272
"msgpack": {
7373
"OpenBSD": "py-msgpack",
@@ -363,21 +363,21 @@ def check_pyqt():
363363
Here we are checking for PyQt4 with its version, as for it require
364364
PyQt 4.8 or later.
365365
"""
366-
QtCore = try_import(
367-
'qtpy.QtCore', 'PyBitmessage requires PyQt 4.8 or later and Qt 4.7 or later.')
366+
qtpy = try_import(
367+
'qtpy', 'PyBitmessage requires qtpy, PyQt 4.8 or later and Qt 4.7 or later.')
368368

369-
if not QtCore:
369+
if not qtpy:
370370
return False
371371

372-
logger.info('PyQt Version: %s', QtCore.PYQT_VERSION_STR)
373-
logger.info('Qt Version: %s', QtCore.QT_VERSION_STR)
372+
logger.info('PyQt Version: %s', qtpy.PYQT_VERSION)
373+
logger.info('Qt Version: %s', qtpy.QT_VERSION)
374374
passed = True
375-
if QtCore.PYQT_VERSION < 0x40800:
375+
if version.LooseVersion(qtpy.PYQT_VERSION) < '4.8':
376376
logger.error(
377377
'This version of PyQt is too old. PyBitmessage requries'
378378
' PyQt 4.8 or later.')
379379
passed = False
380-
if QtCore.QT_VERSION < 0x40700:
380+
if version.LooseVersion(qtpy.QT_VERSION) < '4.7':
381381
logger.error(
382382
'This version of Qt is too old. PyBitmessage requries'
383383
' Qt 4.7 or later.')
@@ -386,7 +386,7 @@ def check_pyqt():
386386

387387

388388
def check_msgpack():
389-
"""Do sgpack module check.
389+
"""Do msgpack module check.
390390
391391
simply checking if msgpack package with all its dependency
392392
is available or not as recommended for messages coding.

0 commit comments

Comments
 (0)