Merge remote-tracking branch 'upstream/master' into configmerge

This commit is contained in:
Ryan Roden-Corrent 2017-08-20 21:18:47 -04:00
commit 111846a909
22 changed files with 67 additions and 74 deletions

View File

@ -206,17 +206,7 @@ It's recommended to install `qt5.qtwebengine` and start with
On openSUSE
-----------
There are prebuilt RPMs available for Tumbleweed and Leap 42.1:
http://software.opensuse.org/download.html?project=home%3Aarpraher&package=qutebrowser[One Click Install]
Or add the repo manually:
----
# zypper addrepo http://download.opensuse.org/repositories/home:arpraher/openSUSE_Tumbleweed/home:arpraher.repo
# zypper refresh
# zypper install qutebrowser
----
There are prebuilt RPMs available at https://software.opensuse.org/download.html?project=network&package=qutebrowser[OBS].
On OpenBSD
----------

View File

@ -4,6 +4,6 @@ certifi==2017.7.27.1
chardet==3.0.4
codecov==2.0.9
coverage==4.4.1
idna==2.5
requests==2.18.2
idna==2.6
requests==2.18.3
urllib3==1.22

View File

@ -18,6 +18,6 @@ packaging==16.8
pep8-naming==0.4.1
pycodestyle==2.3.1
pydocstyle==1.1.1 # rq.filter: < 2.0.0
pyflakes==1.5.0
pyflakes==1.6.0
pyparsing==2.2.0
six==1.10.0

View File

@ -3,6 +3,6 @@
appdirs==1.4.3
packaging==16.8
pyparsing==2.2.0
setuptools==36.2.5
setuptools==36.2.7
six==1.10.0
wheel==0.29.0

View File

@ -1,3 +1,3 @@
# This file is automatically generated by scripts/dev/recompile_requirements.py
-e git+https://github.com/xoviat/pyinstaller.git@qtweb#egg=PyInstaller
-e git+https://github.com/pyinstaller/pyinstaller.git@develop#egg=PyInstaller

View File

@ -1,4 +1,4 @@
-e git+https://github.com/xoviat/pyinstaller.git@qtweb#egg=PyInstaller
-e git+https://github.com/pyinstaller/pyinstaller.git@develop#egg=PyInstaller
# remove @commit-id for scm installs
#@ replace: @.*# @qtweb#
#@ replace: @.*# @develop#

View File

@ -4,15 +4,15 @@
certifi==2017.7.27.1
chardet==3.0.4
github3.py==0.9.6
idna==2.5
idna==2.6
isort==4.2.15
lazy-object-proxy==1.3.1
mccabe==0.6.1
-e git+https://github.com/PyCQA/pylint.git#egg=pylint
./scripts/dev/pylint_checkers
requests==2.18.2
requests==2.18.3
six==1.10.0
uritemplate==3.0.0
uritemplate.py==3.0.2
urllib3==1.22
wrapt==1.10.10
wrapt==1.10.11

View File

@ -4,15 +4,15 @@ astroid==1.5.3
certifi==2017.7.27.1
chardet==3.0.4
github3.py==0.9.6
idna==2.5
idna==2.6
isort==4.2.15
lazy-object-proxy==1.3.1
mccabe==0.6.1
pylint==1.7.2
./scripts/dev/pylint_checkers
requests==2.18.2
requests==2.18.3
six==1.10.0
uritemplate==3.0.0
uritemplate.py==3.0.2
urllib3==1.22
wrapt==1.10.10
wrapt==1.10.11

View File

@ -1,4 +1,4 @@
# This file is automatically generated by scripts/dev/recompile_requirements.py
docutils==0.13.1
docutils==0.14
pyroma==2.2

View File

@ -1,7 +1,7 @@
# This file is automatically generated by scripts/dev/recompile_requirements.py
beautifulsoup4==4.6.0
cheroot==5.7.0
cheroot==5.8.3
click==6.7
# colorama==0.3.9
coverage==4.4.1
@ -12,7 +12,7 @@ Flask==0.12.2
glob2==0.5
httpbin==0.5.0
hunter==1.4.1
hypothesis==3.14.0
hypothesis==3.18.0
itsdangerous==0.24
# Jinja2==2.9.6
Mako==1.0.7
@ -20,7 +20,7 @@ Mako==1.0.7
parse==1.8.2
parse-type==0.3.4
py==1.4.34
pytest==3.1.3
pytest==3.2.1
pytest-bdd==2.18.2
pytest-benchmark==3.1.1
pytest-catchlog==1.2.2
@ -35,5 +35,5 @@ pytest-travis-fold==1.2.0
pytest-xvfb==1.0.0
PyVirtualDisplay==0.2.1
six==1.10.0
vulture==0.21
vulture==0.24
Werkzeug==0.12.2

View File

@ -1,3 +1,3 @@
# This file is automatically generated by scripts/dev/recompile_requirements.py
vulture==0.21
vulture==0.24

View File

@ -49,6 +49,7 @@ qt_log_ignore =
^Geoclue error: Process org\.freedesktop\.Geoclue\.Master exited with status 127
^Failed to create Geoclue client interface. Geoclue error: org\.freedesktop\.DBus\.Error\.Disconnected
^QDBusConnection: name 'org.freedesktop.Geoclue.Master' had owner '' but we thought it was ':1.1'
^Failed to create Geoclue client interface. Geoclue error: org\.freedesktop\.DBus\.Error\.Disconnected
^QObject::connect: Cannot connect \(null\)::stateChanged\(QNetworkSession::State\) to QNetworkReplyHttpImpl::_q_networkSessionStateChanged\(QNetworkSession::State\)
^QXcbClipboard: Cannot transfer data, no data available
^load glyph failed

View File

@ -2036,8 +2036,9 @@ class CommandDispatcher:
message.info(out)
if file:
path = os.path.expanduser(js_code)
try:
with open(js_code, 'r', encoding='utf-8') as f:
with open(path, 'r', encoding='utf-8') as f:
js_code = f.read()
except OSError as e:
raise cmdexc.CommandError(str(e))

View File

@ -29,7 +29,7 @@ def option():
model = completionmodel.CompletionModel(column_widths=(20, 70, 10))
options = ((x.name, x.description, config.instance.get_str(x.name))
for x in configdata.DATA.values())
model.add_category(listcategory.ListCategory("Options", options))
model.add_category(listcategory.ListCategory("Options", sorted(options)))
return model
@ -55,7 +55,8 @@ def value(optname, *_values):
vals = opt.typ.complete()
if vals is not None:
model.add_category(listcategory.ListCategory("Completions", vals))
model.add_category(listcategory.ListCategory("Completions",
sorted(vals)))
return model

View File

@ -60,33 +60,19 @@ class ListCategory(QSortFilterProxyModel):
sortcol = 0
self.sort(sortcol)
def lessThan(self, lindex, rindex):
def lessThan(self, _lindex, rindex):
"""Custom sorting implementation.
Prefers all items which start with self._pattern. Other than that, uses
normal Python string sorting.
Prefers all items which start with self._pattern. Other than that, keep
items in their original order.
Args:
lindex: The QModelIndex of the left item (*left* < right)
_lindex: The QModelIndex of the left item (*left* < right)
rindex: The QModelIndex of the right item (left < *right*)
Return:
True if left < right, else False
"""
qtutils.ensure_valid(lindex)
qtutils.ensure_valid(rindex)
left = self.srcmodel.data(lindex)
right = self.srcmodel.data(rindex)
leftstart = left.startswith(self._pattern)
rightstart = right.startswith(self._pattern)
if leftstart and rightstart:
return left < right
elif leftstart:
return True
elif rightstart:
return False
else:
return left < right
return not right.startswith(self._pattern)

View File

@ -49,4 +49,4 @@ def get_cmd_completions(include_hidden, include_aliases, prefix=''):
bindings = ', '.join(cmd_to_keys.get(name, []))
cmdlist.append((name, "Alias for '{}'".format(cmd), bindings))
return cmdlist
return sorted(cmdlist)

View File

@ -421,7 +421,7 @@ class SessionManager(QObject):
base, ext = os.path.splitext(filename)
if ext == '.yml':
sessions.append(base)
return sessions
return sorted(sessions)
@cmdutils.register(instance='session-manager')
@cmdutils.argument('name', completion=miscmodels.session)

View File

@ -81,6 +81,8 @@ def distribution():
return None
pretty = info.get('PRETTY_NAME', 'Unknown')
if pretty == 'Linux': # Thanks, Funtoo
pretty = info.get('NAME', pretty)
if 'VERSION_ID' in info:
dist_version = pkg_resources.parse_version(info['VERSION_ID'])
@ -88,8 +90,11 @@ def distribution():
dist_version = None
dist_id = info.get('ID', None)
id_mappings = {
'funtoo': 'gentoo', # does not have ID_LIKE=gentoo
}
try:
parsed = Distribution[dist_id]
parsed = Distribution[id_mappings.get(dist_id, dist_id)]
except KeyError:
parsed = Distribution.unknown

View File

@ -31,7 +31,7 @@ from qutebrowser.completion.models import listcategory
('foo',
[('foob', ''), ('fooc', ''), ('fooa', '')],
[('fooa', ''), ('foob', ''), ('fooc', '')]),
[('foob', ''), ('fooc', ''), ('fooa', '')]),
# prefer foobar as it starts with the pattern
('foo',

View File

@ -132,8 +132,8 @@ def quickmarks(quickmark_manager_stub):
"""Pre-populate the quickmark-manager stub with some quickmarks."""
quickmark_manager_stub.marks = collections.OrderedDict([
('aw', 'https://wiki.archlinux.org'),
('ddg', 'https://duckduckgo.com'),
('wiki', 'https://wikipedia.org'),
('ddg', 'https://duckduckgo.com'),
])
return quickmark_manager_stub
@ -245,16 +245,16 @@ def test_quickmark_completion(qtmodeltester, quickmarks):
_check_completions(model, {
"Quickmarks": [
('aw', 'https://wiki.archlinux.org', None),
('ddg', 'https://duckduckgo.com', None),
('wiki', 'https://wikipedia.org', None),
('ddg', 'https://duckduckgo.com', None),
]
})
@pytest.mark.parametrize('row, removed', [
(0, 'aw'),
(1, 'ddg'),
(2, 'wiki'),
(1, 'wiki'),
(2, 'ddg'),
])
def test_quickmark_completion_delete(qtmodeltester, quickmarks, row, removed):
"""Test deleting a quickmark from the quickmark completion model."""
@ -281,17 +281,17 @@ def test_bookmark_completion(qtmodeltester, bookmarks):
_check_completions(model, {
"Bookmarks": [
('http://qutebrowser.org', 'qutebrowser | qutebrowser', None),
('https://github.com', 'GitHub', None),
('https://python.org', 'Welcome to Python.org', None),
('http://qutebrowser.org', 'qutebrowser | qutebrowser', None),
]
})
@pytest.mark.parametrize('row, removed', [
(0, 'http://qutebrowser.org'),
(1, 'https://github.com'),
(2, 'https://python.org'),
(0, 'https://github.com'),
(1, 'https://python.org'),
(2, 'http://qutebrowser.org'),
])
def test_bookmark_completion_delete(qtmodeltester, bookmarks, row, removed):
"""Test deleting a quickmark from the quickmark completion model."""
@ -325,14 +325,14 @@ def test_url_completion(qtmodeltester, web_history_populated,
_check_completions(model, {
"Quickmarks": [
('https://duckduckgo.com', 'ddg', None),
('https://wiki.archlinux.org', 'aw', None),
('https://wikipedia.org', 'wiki', None),
('https://duckduckgo.com', 'ddg', None),
],
"Bookmarks": [
('http://qutebrowser.org', 'qutebrowser | qutebrowser', None),
('https://github.com', 'GitHub', None),
('https://python.org', 'Welcome to Python.org', None),
('http://qutebrowser.org', 'qutebrowser | qutebrowser', None),
],
"History": [
('https://github.com', 'https://github.com', '2016-05-01'),
@ -384,12 +384,12 @@ def test_url_completion_delete_bookmark(qtmodeltester, bookmarks,
# sanity checks
assert model.data(parent) == "Bookmarks"
assert model.data(idx) == 'https://github.com'
assert model.data(idx) == 'https://python.org'
assert 'https://github.com' in bookmarks.marks
len_before = len(bookmarks.marks)
model.delete_cur_item(idx)
assert 'https://github.com' not in bookmarks.marks
assert 'https://python.org' not in bookmarks.marks
assert len_before == len(bookmarks.marks) + 1
@ -407,12 +407,12 @@ def test_url_completion_delete_quickmark(qtmodeltester,
# sanity checks
assert model.data(parent) == "Quickmarks"
assert model.data(idx) == 'https://duckduckgo.com'
assert model.data(idx) == 'https://wiki.archlinux.org'
assert 'ddg' in quickmarks.marks
len_before = len(quickmarks.marks)
model.delete_cur_item(idx)
assert 'ddg' not in quickmarks.marks
assert 'aw' not in quickmarks.marks
assert len_before == len(quickmarks.marks) + 1
@ -455,9 +455,9 @@ def test_session_completion(qtmodeltester, session_manager_stub):
qtmodeltester.check(model)
_check_completions(model, {
"Sessions": [('1', None, None),
('2', None, None),
('default', None, None)]
"Sessions": [('default', None, None),
('1', None, None),
('2', None, None)]
})

View File

@ -372,7 +372,7 @@ class TestListSessions:
(tmpdir / 'foo.yml').ensure()
(tmpdir / 'bar.yml').ensure()
sess_man = sessions.SessionManager(str(tmpdir))
assert sorted(sess_man.list_sessions()) == ['bar', 'foo']
assert sess_man.list_sessions() == ['bar', 'foo']
def test_with_other_files(self, tmpdir):
(tmpdir / 'foo.yml').ensure()

View File

@ -164,6 +164,15 @@ from qutebrowser.browser import pdfjs
version.DistributionInfo(
id='manjaro', parsed=version.Distribution.manjaro,
version=None, pretty='Manjaro Linux')),
# Funtoo
("""
ID="funtoo"
NAME="Funtoo GNU/Linux"
PRETTY_NAME="Linux"
""",
version.DistributionInfo(
id='funtoo', parsed=version.Distribution.gentoo,
version=None, pretty='Funtoo GNU/Linux')),
])
def test_distribution(tmpdir, monkeypatch, os_release, expected):
os_release_file = tmpdir / 'os-release'