Exemple #1
0
def check_qt_version():
    """Check if the Qt version is recent enough."""
    from PyQt5.QtCore import QT_VERSION, PYQT_VERSION, PYQT_VERSION_STR
    try:
        from PyQt5.QtCore import QVersionNumber, QLibraryInfo
        qt_ver = QLibraryInfo.version().normalized()
        recent_qt_runtime = qt_ver >= QVersionNumber(5, 12)  # type: ignore[operator]
    except (ImportError, AttributeError):
        # QVersionNumber was added in Qt 5.6, QLibraryInfo.version() in 5.8
        recent_qt_runtime = False

    if QT_VERSION < 0x050C00 or PYQT_VERSION < 0x050C00 or not recent_qt_runtime:
        text = ("Fatal error: Qt >= 5.12.0 and PyQt >= 5.12.0 are required, "
                "but Qt {} / PyQt {} is installed.".format(qt_version(),
                                                           PYQT_VERSION_STR))
        _die(text)
Exemple #2
0
def check_qt_version():
    """Check if the Qt version is recent enough."""
    from PyQt5.QtCore import QT_VERSION, PYQT_VERSION, PYQT_VERSION_STR
    try:
        from PyQt5.QtCore import QVersionNumber, QLibraryInfo
        qt_ver = QLibraryInfo.version().normalized()
        recent_qt_runtime = qt_ver >= QVersionNumber(5, 12)  # type: ignore[operator]
    except (ImportError, AttributeError):
        # QVersionNumber was added in Qt 5.6, QLibraryInfo.version() in 5.8
        recent_qt_runtime = False

    if QT_VERSION < 0x050C00 or PYQT_VERSION < 0x050C00 or not recent_qt_runtime:
        text = ("Fatal error: Qt >= 5.12.0 and PyQt >= 5.12.0 are required, "
                "but Qt {} / PyQt {} is installed.".format(qt_version(),
                                                           PYQT_VERSION_STR))
        _die(text)

    if qt_ver == QVersionNumber(5, 12, 0):
        from qutebrowser.utils import log
        log.init.warning("Running on Qt 5.12.0. Doing so is unsupported "
                         "(newer 5.12.x versions are fine).")
Exemple #3
0
from PyQt5.QtCore import QLibraryInfo, QCoreApplication
from pprint import pprint

# QLibraryInfo isn't always valid until a QCoreApplication is
# instantiated.
app = QCoreApplication([])
paths = [x for x in dir(QLibraryInfo) if x.endswith('Path')]
location = {x: QLibraryInfo.location(getattr(QLibraryInfo, x)) for x in paths}
try:
    version = QLibraryInfo.version().segments()
except AttributeError:
    version = None
pprint({
    'isDebugBuild': QLibraryInfo.isDebugBuild(),
    'version': version,
    'location': location,
})