This reverts commit 6bb2b082c9.
I guess storing package data in qutebrowser/ would be the proper way,
but this doesn't actually work on macOS - there, the executable name is
already "qutebrowser"...
With https://github.com/python/mypy/pull/9614, mypy now tries to collect
all files in tests/, but it fails due to:
tests/end2end/conftest.py: error: Duplicate module named 'conftest' (also at 'tests/end2end/features/conftest.py')
tests/end2end/conftest.py: error: Are you missing an __init__.py? [misc]
We should probably add __init__.py files to tests/ at some point...
See #6059 and #5249
On GitHub Actions, it looks like there's a situation where
os.path.expanduser and pathlib.Path.expanduser disagree.
When in test_filesystem_completion_hypothesis the completion gets '~' as
input, it fails with:
tests/unit/completion/test_models.py:469: in test_filesystem_completion_hypothesis
model.set_pattern(text)
qutebrowser/completion/models/filepathcategory.py:88: in set_pattern
self._paths = sorted(self._contract_user(val, path) for path in paths)
qutebrowser/completion/models/filepathcategory.py:88: in <genexpr>
self._paths = sorted(self._contract_user(val, path) for path in paths)
qutebrowser/completion/models/filepathcategory.py:52: in _contract_user
return str(head / pathlib.Path(path).relative_to(head.expanduser()))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = PosixPath('/home/runneradmin'), other = (PosixPath('/home/runner'),)
parts = ['/', 'home', 'runneradmin'], drv = '', root = '/'
def relative_to(self, *other):
[...]
E ValueError: '/home/runneradmin' does not start with '/home/runner'
Let's use os.path everywhere, so we can be sure the two code paths agree
with each other.
When the user does something like this with the new adblocking config:
c.content.host_blocking.lists = ...
Then we didn't notify her about the setting being renamed. Instead, she
got:
While getting 'content.host_blocking': No option 'content.host_blocking'
Unhandled exception: 'NoneType' object has no attribute 'lists'
Traceback (most recent call last):
File ".../qutebrowser/config/configfiles.py", line 805, in read_config_py
exec(code, module.__dict__)
File "/tmp/config.py", line 1, in <module>
c.content.host_blocking.lists = []
AttributeError: 'NoneType' object has no attribute 'lists'
This happens because we did something like (simplified):
with self._handle_error(...):
return self._config.get(...)
# End of method
Thus, if there was an error, nothing is returned and the method ends,
therefore returning an implicit None. When then trying to access .lists
on that None, we get the AttributeError.
Instead, we now permit this kind of wrong usage in config.py files.
If this is a qutebrowser-internal ConfigContainer, we would've already
raised in _handle_error() anyways.
What we now do instead is returning a new ConfigContainer, i.e.
allowing further access (while still capturing the error message).
Thus, this now leads to:
While getting 'content.host_blocking':
No option 'content.host_blocking'
While setting 'content.host_blocking.lists':
No option 'content.host_blocking.lists'
(this option was renamed to 'content.blocking.hosts.lists')
This still isn't optimal, but the best we can do without more magic:
At the point the first failure happens, we can't tell whether the user
wants to get an option or is just getting a prefix.
Fixes#5991
For some reason, despite using "find:" for the package and this working
fine for the sdist, the qutebrowser-git Archlinux package doesn't
actually include any qutebrowser/ files anymore.
This currently really doesn't seem to be worth the trouble...
See #3526
This reverts commit 90323d1d98.
This reverts commit 21ee2fe882.