Fix earlyinit.qt_version issues

This commit is contained in:
Florian Bruhin 2017-06-19 09:42:49 +02:00
parent 9b5227b987
commit df6c4c6e73
4 changed files with 9 additions and 10 deletions

View File

@ -253,17 +253,17 @@ def get_backend(args):
return 'webengine'
def qt_version(qversion=None, qt_version=None):
def qt_version(qversion=None, qt_version_str=None):
"""Get a Qt version string based on the runtime/compiled versions."""
if qversion is None:
from PyQt5.QtCore import qVersion
qversion = qVersion()
if qt_version is None:
if qt_version_str is None:
from PyQt5.QtCore import QT_VERSION_STR
qt_version = QT_VERSION_STR
qt_version_str = QT_VERSION_STR
if qversion != qt_version:
return '{} (compiled {})'.format(qversion, qt_version)
if qversion != qt_version_str:
return '{} (compiled {})'.format(qversion, qt_version_str)
else:
return qversion

View File

@ -29,8 +29,7 @@ import importlib
import collections
import pkg_resources
from PyQt5.QtCore import (QT_VERSION_STR, PYQT_VERSION_STR, qVersion,
QLibraryInfo)
from PyQt5.QtCore import PYQT_VERSION_STR, QLibraryInfo
from PyQt5.QtNetwork import QSslSocket
from PyQt5.QtWidgets import QApplication

View File

@ -118,7 +118,8 @@ def test_qt_version(same):
else:
qt_version_str = '5.3.0'
expected = '5.4.0 (compiled 5.3.0)'
actual = earlyinit.qt_version(qversion='5.4.0', qt_version=qt_version_str)
actual = earlyinit.qt_version(qversion='5.4.0',
qt_version_str=qt_version_str)
assert actual == expected

View File

@ -823,8 +823,7 @@ def test_version_output(git_commit, frozen, style, with_webkit,
'platform.python_implementation': lambda: 'PYTHON IMPLEMENTATION',
'platform.python_version': lambda: 'PYTHON VERSION',
'PYQT_VERSION_STR': 'PYQT VERSION',
'QT_VERSION_STR': 'QT VERSION',
'qVersion': lambda: 'QT VERSION',
'earlyinit.qt_version': lambda: 'QT VERSION',
'_module_versions': lambda: ['MODULE VERSION 1', 'MODULE VERSION 2'],
'_pdfjs_version': lambda: 'PDFJS VERSION',
'QSslSocket': FakeQSslSocket('SSL VERSION'),