Skip to content

Commit 14b18c3

Browse files
committed
Changed check_pyqt() to work with qtpy
(closes Bitmessage#897, closes Bitmessage#1418)
1 parent 5cbc861 commit 14b18c3

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

src/depends.py

Lines changed: 22 additions & 21 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
@@ -49,22 +50,22 @@
4950
}
5051

5152
PACKAGES = {
52-
"PyQt4": {
53-
"OpenBSD": "py-qt4",
54-
"FreeBSD": "py27-qt4",
55-
"Debian": "python-qt4",
56-
"Ubuntu": "python-qt4",
57-
"Ubuntu 12": "python-qt4",
58-
"openSUSE": "python-qt",
59-
"Fedora": "PyQt4",
60-
"Guix": "[email protected]",
61-
"Gentoo": "dev-python/PyQt4",
53+
"qtpy": {
54+
"OpenBSD": "py-qtpy",
55+
"FreeBSD": "py27-QtPy",
56+
"Debian": "python-qtpy",
57+
"Ubuntu": "python-qtpy",
58+
"Ubuntu 12": "python-qtpy",
59+
"openSUSE": "python-QtPy",
60+
"Fedora": "python2-QtPy",
61+
"Guix": "",
62+
"Gentoo": "dev-python/QtPy",
6263
"optional": True,
6364
"description":
64-
"You only need PyQt if you want to use the GUI."
65+
"You only need qtpy if you want to use the GUI."
6566
" When only running as a daemon, this can be skipped.\n"
66-
"However, you would have to install it manually"
67-
" because setuptools does not support PyQt."
67+
"Also maybe you need to install PyQt5 if your package manager"
68+
" not installs it as qtpy dependency"
6869
},
6970
"msgpack": {
7071
"OpenBSD": "py-msgpack",
@@ -363,21 +364,21 @@ def check_pyqt():
363364
Here we are checking for PyQt4 with its version, as for it require
364365
PyQt 4.8 or later.
365366
"""
366-
QtCore = try_import(
367-
'qtpy.QtCore', 'PyBitmessage requires PyQt 4.8 or later and Qt 4.7 or later.')
367+
qtpy = try_import(
368+
'qtpy', 'PyBitmessage requires qtpy, PyQt 4.8 or later and Qt 4.7 or later.')
368369

369-
if not QtCore:
370+
if not qtpy:
370371
return False
371372

372-
logger.info('PyQt Version: %s', QtCore.PYQT_VERSION_STR)
373-
logger.info('Qt Version: %s', QtCore.QT_VERSION_STR)
373+
logger.info('PyQt Version: %s', qtpy.PYQT_VERSION)
374+
logger.info('Qt Version: %s', qtpy.QT_VERSION)
374375
passed = True
375-
if QtCore.PYQT_VERSION < 0x40800:
376+
if version.LooseVersion(qtpy.PYQT_VERSION) < '4.8':
376377
logger.error(
377378
'This version of PyQt is too old. PyBitmessage requries'
378379
' PyQt 4.8 or later.')
379380
passed = False
380-
if QtCore.QT_VERSION < 0x40700:
381+
if version.LooseVersion(qtpy.QT_VERSION) < '4.7':
381382
logger.error(
382383
'This version of Qt is too old. PyBitmessage requries'
383384
' Qt 4.7 or later.')
@@ -386,7 +387,7 @@ def check_pyqt():
386387

387388

388389
def check_msgpack():
389-
"""Do sgpack module check.
390+
"""Do msgpack module check.
390391
391392
simply checking if msgpack package with all its dependency
392393
is available or not as recommended for messages coding.

0 commit comments

Comments
 (0)