Compare commits

...

6 Commits

Author SHA1 Message Date
Florian Bruhin
21adb2cc54 Make link_pyqt work with PyQt 5.11
(cherry picked from commit 14205ae14f)
2018-07-10 16:09:44 +02:00
Florian Bruhin
6b406899f1 Allow PyQt 5.10 to fail on Travis
See #4055

(cherry picked from commit 727b418d8b)
2018-07-10 16:09:44 +02:00
Florian Bruhin
2a3663a6e6 Add workaround for chrome-extension:// URLs
Fixes #4049

(cherry picked from commit b9e3d3cab9)
2018-07-10 16:09:44 +02:00
Florian Bruhin
3970464891 Strip trailing newlines from pastebin URL
(cherry picked from commit 274b66ec46)
2018-07-10 16:09:44 +02:00
Florian Bruhin
af2eabdbfa Add a mkvenv-pypi-old environment
Fixes #4038
See #3662

(cherry picked from commit e80e695a56)
2018-07-10 15:29:21 +02:00
Florian Bruhin
5c299278c2 Handle download errors when the reply is already gone
Fixes #1270

(cherry picked from commit 0a31e19eda)
2018-07-10 15:29:17 +02:00
9 changed files with 57 additions and 10 deletions

View File

@@ -65,6 +65,10 @@ matrix:
env: TESTENV=shellcheck
services: docker
fast_finish: true
allow_failures:
# https://github.com/qutebrowser/qutebrowser/issues/4055
- os: linux
env: TESTENV=py36-pyqt510
cache:
directories:

View File

@@ -15,6 +15,14 @@ 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.5.0 (unreleased)
-------------------
Fixed
~~~~~
- Rare crash when an error occurs in downloads.
v1.4.0
------

View File

@@ -392,6 +392,10 @@ https://docs.python.org/3/library/venv.html[virtual environment]:
$ tox -e mkvenv-pypi
----
If your system comes with Python 3.5.3 or older (such as Ubuntu 16.04 LTS), use
`tox -e mkvenv-pypi-old` instead. This installs an older Qt version (5.10) due
to bugs in newer versions.
This installs all needed Python dependencies in a `.venv` subfolder.
This comes with an up-to-date Qt/PyQt including QtWebEngine, but has a few

View File

@@ -29,7 +29,7 @@ from PyQt5.QtCore import pyqtSlot, pyqtSignal, QTimer
from PyQt5.QtNetwork import QNetworkRequest, QNetworkReply
from qutebrowser.config import config
from qutebrowser.utils import message, usertypes, log, urlutils, utils
from qutebrowser.utils import message, usertypes, log, urlutils, utils, debug
from qutebrowser.browser import downloads
from qutebrowser.browser.webkit import http
from qutebrowser.browser.webkit.network import networkmanager
@@ -307,7 +307,14 @@ class DownloadItem(downloads.AbstractDownloadItem):
"""Handle QNetworkReply errors."""
if code == QNetworkReply.OperationCanceledError:
return
self._die(self._reply.errorString())
if self._reply is None:
error = "Unknown error: {}".format(
debug.qenum_key(QNetworkReply, code))
else:
error = self._reply.errorString()
self._die(error)
@pyqtSlot()
def _on_read_timer_timeout(self):

View File

@@ -37,6 +37,7 @@ class QuteSchemeHandler(QWebEngineUrlSchemeHandler):
if qtutils.version_check('5.11', compiled=False):
# WORKAROUND for https://bugreports.qt.io/browse/QTBUG-63378
profile.installUrlSchemeHandler(b'chrome-error', self)
profile.installUrlSchemeHandler(b'chrome-extension', self)
def requestStarted(self, job):
"""Handle a request for a qute: scheme.
@@ -49,7 +50,7 @@ class QuteSchemeHandler(QWebEngineUrlSchemeHandler):
"""
url = job.requestUrl()
if url.scheme() == 'chrome-error':
if url.scheme() in ['chrome-error', 'chrome-extension']:
# WORKAROUND for https://bugreports.qt.io/browse/QTBUG-63378
job.fail(QWebEngineUrlRequestJob.UrlInvalid)
return

View File

@@ -484,6 +484,7 @@ def pastebin_version(pbclient=None):
def _on_paste_version_success(url):
global pastebin_url
url = url.strip()
_yank_url(url)
pbclient.deleteLater()
pastebin_url = url

View File

@@ -136,7 +136,15 @@ def link_pyqt(executable, venv_path):
executable: The python executable where the source files are present.
venv_path: The path to the virtualenv site-packages.
"""
sip_file = get_lib_path(executable, 'sip')
try:
get_lib_path(executable, 'PyQt5.sip')
except Error:
# There is no PyQt5.sip, so we need to copy the toplevel sip.
sip_file = get_lib_path(executable, 'sip')
else:
# There is a PyQt5.sip, it'll get copied with the PyQt5 dir.
sip_file = None
sipconfig_file = get_lib_path(executable, 'sipconfig', required=False)
pyqt_dir = os.path.dirname(get_lib_path(executable, 'PyQt5.QtCore'))

View File

@@ -987,11 +987,12 @@ def test_pastebin_version(pbclient, message_mock, monkeypatch, qtbot):
monkeypatch.setattr('qutebrowser.utils.utils.log_clipboard', True)
version.pastebin_version(pbclient)
pbclient.success.emit("test")
pbclient.success.emit("https://www.example.com/\n")
msg = message_mock.getmsg(usertypes.MessageLevel.info)
assert msg.text == "Version url test yanked to clipboard."
assert version.pastebin_url == "test"
expected_text = "Version url https://www.example.com/ yanked to clipboard."
assert msg.text == expected_text
assert version.pastebin_url == "https://www.example.com/"
def test_pastebin_version_twice(pbclient, monkeypatch):
@@ -1000,16 +1001,16 @@ def test_pastebin_version_twice(pbclient, monkeypatch):
lambda: "dummy")
version.pastebin_version(pbclient)
pbclient.success.emit("test")
pbclient.success.emit("https://www.example.com/\n")
pbclient.url = None
pbclient.data = None
version.pastebin_url = "test2"
version.pastebin_url = "https://www.example.org/"
version.pastebin_version(pbclient)
assert pbclient.url is None
assert pbclient.data is None
assert version.pastebin_url == "test2"
assert version.pastebin_url == "https://www.example.org/"
def test_pastebin_version_error(pbclient, caplog, message_mock, monkeypatch):

13
tox.ini
View File

@@ -62,6 +62,19 @@ deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/misc/requirements/requirements-pyqt.txt
# Older PyQt for Python 3.5
# 5.11.2: https://www.riverbankcomputing.com/pipermail/pyqt/2018-July/040511.html
# 5.10.1: https://github.com/qutebrowser/qutebrowser/issues/3662
[testenv:mkvenv-pypi-old]
basepython = {env:PYTHON:python3.5}
envdir = {toxinidir}/.venv
commands = {envpython} -c ""
usedevelop = true
deps =
-r{toxinidir}/requirements.txt
PyQt5==5.10
sip==4.19.8
[testenv:misc]
ignore_errors = true
basepython = {env:PYTHON:python3}