Compare commits

...

10 Commits

Author SHA1 Message Date
Florian Bruhin
2872ae5641 Release v1.0.1 2017-10-13 09:21:56 +02:00
Florian Bruhin
cbe0ff94a1 Ignore inotify_add_watch Qt warning
This happens on Travis from time to time.
2017-10-13 09:12:31 +02:00
Florian Bruhin
19a0a026dc Update Firefox extension list in README
[ci skip]
2017-10-13 08:07:32 +02:00
Florian Bruhin
2bf9a81451 Prevent empty segfault reports 2017-10-13 07:52:55 +02:00
Florian Bruhin
35d5038ab1 Add missing test 2017-10-12 22:42:58 +02:00
Florian Bruhin
bf1d6acb06 Properly fix up version checks... 2017-10-12 22:41:52 +02:00
Florian Bruhin
07b1b3fbd4 Update changelog
[ci skip]
2017-10-12 19:59:46 +02:00
Florian Bruhin
8539d092df Fix version checking in earlyinit
With the previous commit, we also checked that PyQt was >= 5.7.1, but we want to
support PyQt 5.7.0. Instead, we now check the individual components by hand.

Also, the previous check accidentally allowed PyQt >= 5.2.0 instead of 5.7.0.
2017-10-12 19:41:49 +02:00
Florian Bruhin
dfe2f9e38c Also check PyQt version for qtutils.version_check()
With an older PyQt built against a newer Qt, we still don't have its features
available.

This also drops support for exact=True with compiled=True as the semantics for
that are unclear, and it's not used.
2017-10-12 19:13:20 +02:00
Florian Bruhin
4f870f902c Fix loading of monospace fonts in configtypes.QtFont
See #3096
2017-10-12 18:26:54 +02:00
11 changed files with 109 additions and 34 deletions

View File

@@ -181,7 +181,10 @@ Active
https://key.saka.io/[Saka Key]
* Firefox addons (based on WebExtensions):
https://addons.mozilla.org/en-GB/firefox/addon/vimium-ff/[Vimium-FF] (experimental),
http://saka-key.lusakasa.com/[Saka Key]
https://key.saka.io[Saka Key],
https://github.com/cmcaine/tridactyl[Tridactyl] (in early development, working
on a https://bugzilla.mozilla.org/show_bug.cgi?id=1215061[better API] for
keyboard integration in Firefox).
Inactive
~~~~~~~~

View File

@@ -15,6 +15,16 @@ breaking changes (such as renamed commands) can happen in minor releases.
// `Fixed` for any bug fixes.
// `Security` to invite users to upgrade in case of vulnerabilities.
v1.0.1
------
Fixes
~~~~~
- Fixed starting after customizing `fonts.tabs` or `fonts.debug_console`.
- Fixed starting with old PyQt versions compiled against newer Qt versions.
- Fixed check for PyQt version to correctly enforce 5.7 (not 5.2).
v1.0.0
------

View File

@@ -54,4 +54,5 @@ qt_log_ignore =
^Incompatible version of OpenSSL
^QQuickWidget::invalidateRenderControl could not make context current
^libpng warning: iCCP: known incorrect sRGB profile
^inotify_add_watch(".*") failed: "No space left on device"
xfail_strict = true

View File

@@ -26,7 +26,7 @@ __copyright__ = "Copyright 2014-2017 Florian Bruhin (The Compiler)"
__license__ = "GPL"
__maintainer__ = __author__
__email__ = "mail@qutebrowser.org"
__version_info__ = (1, 0, 0)
__version_info__ = (1, 0, 1)
__version__ = '.'.join(str(e) for e in __version_info__)
__description__ = "A keyboard-driven, vim-like browser based on PyQt5."

View File

@@ -1068,7 +1068,7 @@ class QtFont(Font):
raise ValueError("Unexpected size unit in {!r}!".format(
size)) # pragma: no cover
if family == 'monospace':
if family == 'monospace' and self.monospace_fonts is not None:
family = self.monospace_fonts
# The Qt CSS parser handles " and ' before passing the string to
# QFont.setFamily. We could do proper CSS-like parsing here, but since

View File

@@ -32,7 +32,7 @@ import pkg_resources
from PyQt5.QtCore import pyqtSlot, Qt, QSize
from PyQt5.QtWidgets import (QDialog, QLabel, QTextEdit, QPushButton,
QVBoxLayout, QHBoxLayout, QCheckBox,
QDialogButtonBox, QApplication)
QDialogButtonBox, QApplication, QMessageBox)
import qutebrowser
from qutebrowser.utils import version, log, utils, objreg, usertypes
@@ -515,6 +515,23 @@ class FatalCrashDialog(_CrashDialog):
except Exception:
self._crash_info.append(("History", traceback.format_exc()))
@pyqtSlot()
def on_report_clicked(self):
"""Prevent empty reports."""
if (not self._info.toPlainText().strip() and
not self._contact.toPlainText().strip() and
self._type == 'Segmentation fault' and
self._func == 'qt_mainloop'):
msgbox.msgbox(parent=self, title='Empty crash info',
text="Empty reports for fatal crashes are useless "
"and mean I'll spend time deleting reports I could "
"spend on developing qutebrowser instead.\n\nPlease "
"help making qutebrowser better by providing more "
"information, or don't report this.",
icon=QMessageBox.Critical)
else:
super().on_report_clicked()
class ReportDialog(_CrashDialog):

View File

@@ -168,9 +168,11 @@ def qt_version(qversion=None, qt_version_str=None):
def check_qt_version():
"""Check if the Qt version is recent enough."""
from PyQt5.QtCore import PYQT_VERSION, PYQT_VERSION_STR
from qutebrowser.utils import qtutils
if not qtutils.version_check('5.7.1') or PYQT_VERSION < 0x050200:
from PyQt5.QtCore import (qVersion, QT_VERSION, PYQT_VERSION,
PYQT_VERSION_STR)
from pkg_resources import parse_version
if (QT_VERSION < 0x050701 or PYQT_VERSION < 0x050700 or
parse_version(qVersion()) < parse_version('5.7.1')):
text = ("Fatal error: Qt >= 5.7.1 and PyQt >= 5.7 are required, "
"but Qt {} / PyQt {} is installed.".format(qt_version(),
PYQT_VERSION_STR))

View File

@@ -33,7 +33,8 @@ import contextlib
import pkg_resources
from PyQt5.QtCore import (qVersion, QEventLoop, QDataStream, QByteArray,
QIODevice, QSaveFile, QT_VERSION_STR)
QIODevice, QSaveFile, QT_VERSION_STR,
PYQT_VERSION_STR)
try:
from PyQt5.QtWebKit import qWebKitVersion
except ImportError: # pragma: no cover
@@ -82,12 +83,18 @@ def version_check(version, exact=False, compiled=True):
# Catch code using the old API for this
assert exact not in [operator.gt, operator.lt, operator.ge, operator.le,
operator.eq], exact
if compiled and exact:
raise ValueError("Can't use compiled=True with exact=True!")
parsed = pkg_resources.parse_version(version)
op = operator.eq if exact else operator.ge
result = op(pkg_resources.parse_version(qVersion()), parsed)
if compiled and result:
# v1 ==/>= parsed, now check if v2 ==/>= parsed too.
# qVersion() ==/>= parsed, now check if QT_VERSION_STR ==/>= parsed.
result = op(pkg_resources.parse_version(QT_VERSION_STR), parsed)
if compiled and result:
# FInally, check PYQT_VERSION_STR as well.
result = op(pkg_resources.parse_version(PYQT_VERSION_STR), parsed)
return result

View File

@@ -84,10 +84,11 @@ def _get_version_tag(tag):
if package == 'qt':
op = match.group('operator')
do_skip = {
'==': not qtutils.version_check(version, exact=True),
'==': not qtutils.version_check(version, exact=True,
compiled=False),
'>=': not qtutils.version_check(version),
'<': qtutils.version_check(version),
'!=': qtutils.version_check(version, exact=True),
'!=': qtutils.version_check(version, exact=True, compiled=False),
}
return pytest.mark.skipif(do_skip[op], reason='Needs ' + tag)
elif package == 'pyqt':

View File

@@ -27,7 +27,7 @@ import pytest
from qutebrowser import qutebrowser
from qutebrowser.config import (config, configexc, configfiles, configinit,
configdata)
configdata, configtypes)
from qutebrowser.utils import objreg, usertypes
@@ -39,6 +39,7 @@ def init_patch(qapp, fake_save_manager, monkeypatch, config_tmpdir,
monkeypatch.setattr(config, 'key_instance', None)
monkeypatch.setattr(config, 'change_filters', [])
monkeypatch.setattr(configinit, '_init_errors', None)
monkeypatch.setattr(configtypes.Font, 'monospace_fonts', None)
yield
try:
objreg.delete('config-commands')
@@ -200,18 +201,43 @@ class TestEarlyInit:
assert msg.text == "set: NoOptionError - No option 'foo'"
assert 'colors.completion.fg' not in config.instance._values
def test_monospace_fonts_init(self, init_patch, args):
@pytest.mark.parametrize('settings, size, family', [
# Only fonts.monospace customized
([('fonts.monospace', '"Comic Sans MS"')], 8, 'Comic Sans MS'),
# fonts.monospace and font settings customized
# https://github.com/qutebrowser/qutebrowser/issues/3096
([('fonts.monospace', '"Comic Sans MS"'),
('fonts.tabs', '10pt monospace'),
('fonts.keyhint', '10pt monospace')], 10, 'Comic Sans MS'),
])
@pytest.mark.parametrize('method', ['temp', 'auto', 'py'])
def test_monospace_fonts_init(self, init_patch, args, config_tmpdir,
method, settings, size, family):
"""Ensure setting fonts.monospace at init works properly.
See https://github.com/qutebrowser/qutebrowser/issues/2973
"""
args.temp_settings = [('fonts.monospace', '"Comic Sans MS"')]
if method == 'temp':
args.temp_settings = settings
elif method == 'auto':
autoconfig_file = config_tmpdir / 'autoconfig.yml'
lines = ["global:"] + [" {}: '{}'".format(k, v)
for k, v in settings]
autoconfig_file.write_text('\n'.join(lines), 'utf-8', ensure=True)
elif method == 'py':
config_py_file = config_tmpdir / 'config.py'
lines = ["c.{} = '{}'".format(k, v) for k, v in settings]
config_py_file.write_text('\n'.join(lines), 'utf-8', ensure=True)
configinit.early_init(args)
# Font
assert config.instance.get('fonts.keyhint') == '8pt "Comic Sans MS"'
expected = '{}pt "{}"'.format(size, family)
assert config.instance.get('fonts.keyhint') == expected
# QtFont
assert config.instance.get('fonts.tabs').family() == 'Comic Sans MS'
font = config.instance.get('fonts.tabs')
assert font.pointSize() == size
assert font.family() == family
def test_monospace_fonts_later(self, init_patch, args):
"""Ensure setting fonts.monospace after init works properly.

View File

@@ -39,34 +39,36 @@ from qutebrowser.utils import qtutils, utils
import overflow_test_cases
@pytest.mark.parametrize('qversion, compiled, version, exact, expected', [
@pytest.mark.parametrize(['qversion', 'compiled', 'pyqt', 'version', 'exact',
'expected'], [
# equal versions
('5.4.0', None, '5.4.0', False, True),
('5.4.0', None, '5.4.0', True, True), # exact=True
('5.4.0', None, '5.4', True, True), # without trailing 0
('5.4.0', None, None, '5.4.0', False, True),
('5.4.0', None, None, '5.4.0', True, True), # exact=True
('5.4.0', None, None, '5.4', True, True), # without trailing 0
# newer version installed
('5.4.1', None, '5.4', False, True),
('5.4.1', None, '5.4', True, False), # exact=True
('5.4.1', None, None, '5.4', False, True),
('5.4.1', None, None, '5.4', True, False), # exact=True
# older version installed
('5.3.2', None, '5.4', False, False),
('5.3.0', None, '5.3.2', False, False),
('5.3.0', None, '5.3.2', True, False), # exact=True
# strict
('5.4.0', '5.3.0', '5.4.0', False, False),
('5.4.0', '5.4.0', '5.4.0', False, True),
# strict and exact=True
('5.4.0', '5.5.0', '5.4.0', True, False),
('5.5.0', '5.4.0', '5.4.0', True, False),
('5.4.0', '5.4.0', '5.4.0', True, True),
('5.3.2', None, None, '5.4', False, False),
('5.3.0', None, None, '5.3.2', False, False),
('5.3.0', None, None, '5.3.2', True, False), # exact=True
# compiled=True
# new Qt runtime, but compiled against older version
('5.4.0', '5.3.0', '5.4.0', '5.4.0', False, False),
# new Qt runtime, compiled against new version, but old PyQt
('5.4.0', '5.4.0', '5.3.0', '5.4.0', False, False),
# all up-to-date
('5.4.0', '5.4.0', '5.4.0', '5.4.0', False, True),
])
def test_version_check(monkeypatch, qversion, compiled, version, exact,
def test_version_check(monkeypatch, qversion, compiled, pyqt, version, exact,
expected):
"""Test for version_check().
Args:
monkeypatch: The pytest monkeypatch fixture.
qversion: The version to set as fake qVersion().
compiled: The value for QT_VERSION_STR (set strict=True)
compiled: The value for QT_VERSION_STR (set compiled=False)
pyqt: The value for PYQT_VERSION_STR (set compiled=False)
version: The version to compare with.
exact: Use exact comparing (==)
expected: The expected result.
@@ -74,6 +76,7 @@ def test_version_check(monkeypatch, qversion, compiled, version, exact,
monkeypatch.setattr(qtutils, 'qVersion', lambda: qversion)
if compiled is not None:
monkeypatch.setattr(qtutils, 'QT_VERSION_STR', compiled)
monkeypatch.setattr(qtutils, 'PYQT_VERSION_STR', pyqt)
compiled_arg = True
else:
compiled_arg = False
@@ -82,6 +85,11 @@ def test_version_check(monkeypatch, qversion, compiled, version, exact,
assert actual == expected
def test_version_check_compiled_and_exact():
with pytest.raises(ValueError):
qtutils.version_check('1.2.3', exact=True, compiled=True)
@pytest.mark.parametrize('version, is_new', [
('537.21', False), # QtWebKit 5.1
('538.1', False), # Qt 5.8