Commit Graph

47 Commits

Author SHA1 Message Date
Florian Bruhin 9e70ffeaad Switch to legacy PDF.js build
The normal PDF.js build only officially supports the latest Chromium, so things
might break every once in a while with QtWebEngine (e.g. #8199, #7335).

Let's instead bundle and recommend the legacy build.

Closes #8332
Closes #7721 (reworded)
Also see #7135
2024-12-10 11:47:39 +01:00
toofar cc3c1e2050 Enable pylint Too many positional arguments warning
This re-enables the pylint too-many-positional-arguments for the main
application code. It's still disabled for tests because that's how you pull in
pytlint fixtures, and I don't think we want to push people into being creative
with fixtures just to get around that.

When functions are called with many positional arguments the reader has to do
a bit of heavy lifting to figure out in what position a value is being passed,
and it's easier to make mistakes. So I would like to encourage using keyword
arguments for long argument lists.

I've set the `max-positional-arguments` to a completely arbitrary 7, from a
completely arbitrary 5, because there were many more violations under 7. If
like 99% of our functions fit under 7 it's probably fine.

Regarding the exceptions:
* objreg.register: I grepped it and it looks like everything is only passing
  the first two args as positional already, lucky!
*  `_get_color_percentage`: only one usage of it, but I was in "add directive
  comment" mode
* update_3rdparty.py: only one usage, already using kwargs
* pyqtProperty: idk
* commands.py: "its complicated". Many methods in this file map to commands
  used in qutebrowser's command mode. In that case it's usual for them to be
  called as flags, rather than positional. But it could be complicated to wade
  into that, and having one file excluded isn't so bad.
2024-10-15 11:55:04 +02:00
Florian Bruhin 4d069b8fc3 Use str.removeprefix() and str.removesuffix()
https://docs.python.org/3/whatsnew/3.9.html#new-string-methods-to-remove-prefixes-and-suffixes
2024-10-13 18:24:44 +02:00
toofar 7eb32a7550 update_3rdparty: move dict related imports into method
I'm trying to update pdf.js in the bleeding edge CI jobs. It complains
that either it can't find PyQt or it can't find yaml depending on how I
invoke tox. Joy. Since dict stuff isn't run by default in this script
hopefully that is the only broken import path and moving it into the
function lets the pdfjs (and ace) bit of the script work fine.

Actually, looking at the stack traces below, both of them are from dict
related code!

    tox exec -re bleeding -- python scripts/dev/update_3rdparty.py --gh-token ***
      Traceback (most recent call last):
        File "/__w/qutebrowser/qutebrowser/scripts/dev/update_3rdparty.py", line 20, in <module>
          from scripts import dictcli
        File "/__w/qutebrowser/qutebrowser/scripts/dev/../../scripts/dictcli.py", line 25, in <module>
          from qutebrowser.browser.webengine import spell
        File "/__w/qutebrowser/qutebrowser/scripts/dev/../../scripts/../qutebrowser/browser/webengine/spell.py", line 14, in <module>
          from qutebrowser.utils import log, message, standarddir
        File "/__w/qutebrowser/qutebrowser/scripts/dev/../../scripts/../qutebrowser/utils/message.py", line 15, in <module>
          from qutebrowser.qt.core import pyqtSignal, pyqtBoundSignal, QObject
        File "/__w/qutebrowser/qutebrowser/scripts/dev/../../scripts/../qutebrowser/qt/core.py", line 17, in <module>
          machinery.init_implicit()
        File "/__w/qutebrowser/qutebrowser/scripts/dev/../../scripts/../qutebrowser/qt/machinery.py", line 278, in init_implicit
          raise NoWrapperAvailableError(info)
      qutebrowser.qt.machinery.NoWrapperAvailableError: No Qt wrapper was importable.

    python scripts/dev/update_3rdparty.py --gh-token ***
      Traceback (most recent call last):
        File "/__w/qutebrowser/qutebrowser/scripts/dev/update_3rdparty.py", line 20, in <module>
          from scripts import dictcli
        File "/__w/qutebrowser/qutebrowser/scripts/dev/../../scripts/dictcli.py", line 25, in <module>
          from qutebrowser.browser.webengine import spell
        File "/__w/qutebrowser/qutebrowser/scripts/dev/../../scripts/../qutebrowser/browser/webengine/spell.py", line 14, in <module>
          from qutebrowser.utils import log, message, standarddir
        File "/__w/qutebrowser/qutebrowser/scripts/dev/../../scripts/../qutebrowser/utils/message.py", line 17, in <module>
          from qutebrowser.utils import usertypes, log
        File "/__w/qutebrowser/qutebrowser/scripts/dev/../../scripts/../qutebrowser/utils/usertypes.py", line 16, in <module>
          from qutebrowser.utils import log, qtutils, utils
        File "/__w/qutebrowser/qutebrowser/scripts/dev/../../scripts/../qutebrowser/utils/qtutils.py", line 39, in <module>
          from qutebrowser.utils import usertypes, utils
        File "/__w/qutebrowser/qutebrowser/scripts/dev/../../scripts/../qutebrowser/utils/utils.py", line 29, in <module>
          import yaml
      ModuleNotFoundError: No module named 'yaml'
2024-05-25 09:41:44 +12:00
Florian Bruhin a537ac3e49 reuse: Replace last copyright texts 2023-07-23 12:59:11 +02:00
Florian Bruhin 0718b25796 reuse: Initial copyright text update for myself
git ls-files | \
    xargs sed -Ei 's/Copyright [0-9]{4}(-[0-9]{4}) Florian Bruhin \(The Compiler\) <mail@qutebrowser\.org>/SPDX-FileCopyrightText: Florian Bruhin (The Compiler) <mail@qutebrowser.org>/'
2023-07-23 12:49:05 +02:00
Florian Bruhin b2aaba6043 reuse: Adjust most license headers
git ls-files | xargs grep -l "is free software"  | xargs reuse annotate --license="GPL-3.0-or-later" --skip-unrecognised
2023-07-23 12:11:07 +02:00
Philipp Albrecht d9e8b638bf Remove vim modelines
We're deprecating vim modelines in favor of `.editorconfig`.

Removing vim modelines could be done using two one-liners. Most of the vim modelines
were followed by an empty line, so this one-liner took care of these ones:

```sh
rg '^# vim: .+\n\n' -l | xargs sed -i '/^# vim: /,+1d'
```

Then some of the vim modelines were followed by a pylint configuration line, so running
this one-liner afterwards took care of that:

```sh
rg '^# vim:' -l | xargs sed -i '/^# vim: /d'
```
2023-06-30 11:03:06 +02:00
toofar ff8dbc4580 lint: broad-exception-raised
Mostly pretty lazy fixes. Most of the places in the tests we were
already matching on error message, a couple of places we weren't. The
tick-tock one was the only one that wasn't being used right where it was
raised.

Some of them I just changed to RuntimeError because it was shorter than
adding the pylint directive.
2023-02-06 18:53:56 +13:00
Florian Bruhin f6a365172a Use legacy PDF.js build for macOS/Windows releases
Fixes #7108
2022-04-05 11:33:19 +02:00
Florian Bruhin ed2342a430 pylint: Handle consider-using-with 2021-12-02 17:30:47 +01:00
Florian Bruhin 8a0d7a5be8 scripts: Pass GitHub token via commandline args 2021-03-29 23:42:14 +02:00
Florian Bruhin 6cd4eefd92 scripts: Use GITHUB_TOKEN for 3rdparty updates 2021-03-29 23:42:14 +02:00
Florian Bruhin 1a4fff1a42 doc: Switch URLs to https 2021-01-26 15:19:01 +01:00
Florian Bruhin 222f1f19a1 Bump copyright years
Closes #6015
2021-01-20 20:06:19 +01:00
Florian Bruhin 9e4276db9b Adjust copyrights for 2020 2020-01-04 18:21:17 +01:00
Florian Bruhin a5fb23458b Clean up filename handling in dictcli/spell.py
Before this change, we sometimes assumed that a dictionary filename had a .bdic
suffix, sometimes not, and sometimes we added it by hand.

For some reason (probably some minor API change?) this currently breaks running
dictcli.py.

While the minimal fix in #4986 works, it only does so because we use re.match
(not re.fullmatch) inside spell.py, so the .bdic suffix (which is present
there) is ignored.

This change instead refactors all dict handling so that the suffix is always
included in the filename, and only stripped off in the last moment when passing
it to QtWebEngine.

Closes #4986
2019-08-27 11:25:00 +02:00
Florian Bruhin 29c6afe476 Fix lint 2019-07-16 10:52:24 +02:00
Florian Bruhin ed52cd0de1 update_3rdparty: Fix lint 2019-07-16 10:46:34 +02:00
Florian Bruhin b51d0cba51 Merge remote-tracking branch 'origin/pr/4086' 2019-07-11 11:01:30 +02:00
Jay Kamat 3e816f5f8b
Update copyright for 2019 2019-02-22 21:45:08 -08:00
bitraid 2478a7441f
download_nsis_plugins: refactor and add StdUtils 2018-10-22 20:09:25 +03:00
Florian Bruhin b63af145d9 Fix shutil call in update_3rdparty.py
shutil.unpack_archive takes a filename.
2018-09-22 09:58:09 +02:00
bitraid 9b048fdd83
Update update_3rdparty.py to download the NSIS plugins 2018-07-20 18:17:53 +03:00
Florian Bruhin 6f028e9ad0 Update copyright years 2018-02-05 12:19:50 +01:00
Michal Siedlaczek 3ac2cfdf73 Support updating dictionaries and removing old versions. 2017-11-04 18:16:05 -04:00
Michal Siedlaczek 6a486058c5 Review fixes 2017-10-04 09:22:35 -04:00
Michal Siedlaczek 932e7a9ab9 Review fixes 2017-10-03 20:07:06 -04:00
Florian Bruhin b811b9e380 Run update_3rdparty correctly from build_release 2017-05-24 08:37:06 +02:00
Florian Bruhin c5957bc9d0 Exclude pdfjs from build packages for now
It only makes things bigger, and currently pdfjs doesn't work on QtWebEngine
anyways.
2017-05-17 11:42:58 +02:00
Florian Bruhin 822623f2ed Finally update copyrights... 2017-05-09 21:37:03 +02:00
Florian Bruhin 6831177f2e Add docstring for update_3rdparty.update_ace 2016-09-07 13:02:48 +02:00
Florian Bruhin 522049132b Add a test for hinting with ACE editor 2016-09-07 12:28:12 +02:00
Florian Bruhin b6abada50a Fix lint 2016-05-13 06:42:09 +02:00
Florian Bruhin a7ece80d34 Merge branch 'pyinstaller' 2016-05-13 06:21:28 +02:00
Florian Bruhin d33fae455d Remove unused import 2016-04-15 19:31:54 +02:00
Florian Bruhin 1f66d74f01 Use __file__ instead of sys.argv[0] 2016-04-15 19:12:10 +02:00
Jan Verbeek 7f9a7a282f Make update_3rdparty.py install correctly when run from any directory 2016-04-15 11:23:52 +02:00
Florian Bruhin 642dc46ba9 flake8: Add hacking 2016-04-08 07:35:53 +02:00
Florian Bruhin 362837e98c update_3rdparty: Add fancy-dmg Makefile 2016-04-07 08:53:25 +02:00
Florian Bruhin 4103e7eba2 Revert "update_3rdparty: add docstring to main()"
This reverts commit 90e88ce0d0.
2016-02-01 20:09:17 +01:00
Daniel Schadt 90e88ce0d0 update_3rdparty: add docstring to main() 2016-02-01 18:14:24 +01:00
Daniel Schadt 63f0171d30 update_3rdparty: add option for pdfjs version
This way we can instruct update_3rdparty to download a specific version
of pdfjs, e.g. to make debugging easier or to match the version of a
system package.

Syntax:
update_3rdparty.py -p 1.2.109
or
update_3rdparty.py --pdfjs=1.2.109

If the command line argument is not given, the script will automatically
download the latest release.
2016-02-01 17:46:16 +01:00
Daniel Schadt 49ed04715e Remove unused tempfile import 2015-12-20 19:24:41 +01:00
Daniel Schadt a072cf0175 Fix update_3rdparty on windows
You cannot open a file twice on windows, so the call to
urllib.request.urlretrieve was invalid, since we already opened the
temporary file. urlretrieve without a filename will automatically create
and return a temp-file, so we're fine.
2015-12-20 19:24:41 +01:00
Daniel Schadt d7d577b1fa Fix pep8/pylint 2015-12-20 19:24:41 +01:00
Daniel Schadt ef85d1af4c Move pdfjs and use original files
* No modified pdfjs installation needed
-> Groundwork for using a system-wide installation

* Script update_3rdparty.py to download and upack the latest pdfjs
  release
2015-12-20 19:24:41 +01:00