Commit Graph

246 Commits

Author SHA1 Message Date
Florian Bruhin 8ae5e3d83b version: Use correct profile for extension list
See #8785
2025-11-21 22:50:52 +01:00
Florian Bruhin 5ac0cb97a8 Fix Qt 5 2025-10-24 00:01:28 +02:00
Florian Bruhin 242cf2a22e version: Add basic info about loaded WebExtensions 2025-10-23 23:24:40 +02:00
Florian Bruhin e7af54898e Add X11/Wayland information to version info
Unfortunately there is no way to get this information from Qt, so I had to
resort to some funny low-level C-like Python programming to directly use
libwayland-client and Xlib. Fun was had! Hopefully this avoids having to ask
for this information every time someone shows a bug/crash report, as there
are various subtleties that can be specific to the Wayland compositor in use.
2025-06-25 09:34:35 +02:00
Florian Bruhin 55ca67f3e2 tests: Stop hardcoding indices for module versions 2025-06-06 08:49:28 +02:00
Florian Bruhin 6b86a9072f version: Rely on importlib.metadata.version too
Packages are slowly migrating to not having a __version__ attribute anymore,
instead relying on importlib.metadata to query the installed version.

jinja2 now shows a deprecation warning when accessing the __version__
attribute: https://github.com/pallets/jinja/pull/2098

For now we keep accessing __version__ for other packages (we still need the
logic for PyQt and its special version attributes anyways), but we fall back on
importlib.metadata.version if we can't get a version that way, and we stop
trying __version__ for jinja2.
2025-06-06 08:47:00 +02:00
Florian Bruhin fe868901ab Remove all importlib_resources backport usage 2024-10-13 18:24:44 +02:00
Florian Bruhin aae05613b5 style: Use dict.fromkeys()
Added in flake8-comprehensions 3.15.0:
https://github.com/adamchainz/flake8-comprehensions/blob/main/CHANGELOG.rst
2024-07-01 16:43:09 +02:00
Florian Bruhin 7bbef811f3 Add debugging output to security version test 2024-06-18 16:36:25 +02:00
Florian Bruhin 2edfd459a4 Infer Chromium security version when API is unavailable
We already had all this information in a comment anyways.
I made it machine-readable using:

    s/#\s+(\d*)\.(\d*)\.(\d*): Security fixes up to ([^ ]*)\s+\((.*)\)/utils.VersionNumber(\1, \2, \3): (_BASES[XX], '\4'),  # \5

plus some manual post-processing.

Thanks to that, we can now get the security version from that data even on
QtWebEngine < 6.3, if that information is known. When we fall back to a base
version (e.g. 6.7.99 -> 6.7), we make sure to not pretend that we have the .0
state of things, though.

Finally, we cross-check the information against the current Qt version if we
have the API, which mostly ensures the data is accurate for human readers.

See #7187 and #8139.
2024-04-30 23:31:25 +02:00
Florian Bruhin 40f6193cc7 Split QtWebEngine version across multiple lines
More readable now that we have more information in it.

Also always show the source, now that we have the space for it, and "UA" isn't
the obvious default anymore anyways.
2024-04-30 23:31:25 +02:00
toofar 52106c383b Show chromium security patch version in :version
Webengine added a getter for their chromium patch level back in Qt 6.3,
since they backport security fixes from chromium in the periods between
doing major chromium feature upgrades.

It's pulled from a hardcoded string in the webengine source
`src/core/web_engine_context.cpp` that's manually updated when they
backport something.

The "(plus any distribution patches)" bit in there is because it was
pointed out that some distributions backport their own security patches
or even use webengine from a branch when the hardcoded string only gets
updated at release time, despite patches being backported in the
meantime.

Closes: https://github.com/qutebrowser/qutebrowser/issues/7187
2024-03-23 11:51:35 +13:00
Florian Bruhin d77053b86c Remove unused fixture 2023-12-01 23:47:48 +01:00
Florian Bruhin b5f11558a6 pdfjs: Simplify logic
Makes things easier if we get build/ right with the return value
2023-12-01 23:38:11 +01:00
Florian Bruhin a2c74ec1bf Remove unused vars 2023-12-01 23:32:07 +01:00
Florian Bruhin eabbdb8ea3 pdfjs: Fix :version crash with no pdf.js
pdfjs.get_pdf_basename() returned None, causing in a TypeError. Instead of
throwing mocker.patch at it, fix the underlying issue.

Given we made the same mistake in three places:

- :version
- test_real_file for PDF.js
- is_available() in pdfjs.py (calls the function but doesn't use the result, so
  is a nop now, even if PDF.js wasn't found)

...evidently we need to change the API so it still raises an exception if no
PDF.js is available.

Amends 0144ae3576.
2023-12-01 23:31:34 +01:00
toofar 0144ae3576 fix pdf.js detection in :version
Now that pdf.js could be shipped with either js or mjs file extensions we
shouldn't hardcode the filename. Call the function for detecting the filename
instead. And make it public.
2023-11-27 08:07:40 +13:00
Florian Bruhin 690813e1b1 Fix lint 2023-09-26 10:35:22 +02:00
Florian Bruhin a6171337f9 Skip test_real_chromium_version on newer Qt versions
Is wrong on unstable Archlinux env when Qt is newer than PyQt. But no need for this when we have the API anyways.
2023-09-25 18:05:35 +02:00
toofar ea6c84e04b Use full sip module for PyQt5 too.
It's a change from before but it's strictly more accurate anyway, in the
application we are always using sip from under the PyQt module, even if
PyQt5 registers it as the plain `sip` too. And now it's consistent with
what we have to do for PyQt6.
2023-07-30 11:18:05 +12:00
Coiby Xu 34dcedf512 qt6: let importlib import PyQt6.sip
Currently, ":version" fails to show the sip version for Qt6. This is
because the sip module can't imported in the same way as Qt5. In Qt5,
the sip module can be imported after "from PyQt5.QtCore import *". In Qt
6, this is no longer the case,

    >>> from PyQt6.QtCore import *
    >>> import sip
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ModuleNotFoundError: No module named 'sip'

So let importlib import PyQt6.sip explicitly.
2023-07-29 18:32:16 +08: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
Florian Bruhin 93c7fdd60c Initial Python 3.7 drop 2023-06-26 14:39:54 +02:00
Florian Bruhin d9543de98c qt: Fix test_version 2023-06-13 17:02:54 +02:00
Florian Bruhin 1cf9d68aba qt: Fix lint 2023-06-13 15:21:28 +02:00
Florian Bruhin a25e8a0987 qt: Less stringly-typed API for SelectionInfo 2023-06-13 12:18:39 +02:00
Florian Bruhin 83bef2ad4b qt: Add machinery.SelectionInfo 2023-06-13 12:09:48 +02:00
Florian Bruhin 836221ecaf Update Qt version test 2022-08-23 18:31:42 +02:00
Florian Bruhin 46933168fe qt 6: Fix getting importlib PyQtWebEngine versions
Needed for e.g. Windows and PyQt < 6.3.1
2022-08-23 18:31:41 +02:00
Florian Bruhin 6ed0e1a370 version: Make sure QUTE_QTWEBENGINE_VERSION_OVERRIDE always wins
TODO: Pick to master?

TODO: changelog
2022-08-23 18:31:41 +02:00
Florian Bruhin b5aa728c30 qt6: Use new API to get Chromium/QtWebEngine versions 2022-08-23 18:31:41 +02:00
Florian Bruhin c5a51eb0bc Drop Qt < 5.15
Fixes #7091

TODO: Add changelog
2022-08-23 18:31:41 +02:00
Florian Bruhin deb21acdeb qt6 tests: Fix remaining PyQt5 references 2022-08-23 18:31:40 +02:00
Florian Bruhin d387b1a108 tests: Adjust most imports 2022-08-23 18:31:40 +02:00
Florian Bruhin 236371cb1d Fix up various webkit/webengine imports 2022-08-23 18:31:40 +02:00
Florian Bruhin 894acbd6f7 Add QLibraryInfo wrapper 2022-08-23 18:31:40 +02:00
Florian Bruhin d47cfd99d7 Run scripts/dev/rewrite_qt_imports.sh 2022-08-23 18:09:11 +02:00
kt programs 389eac1bb3 macOS: fix hide_decoration making window nonresizable
Use PyObjC to call `setWindowMask:` with resizable flag on the
underlying NSWindow.

Fixes #4067
2022-07-05 17:14:05 +08:00
Florian Bruhin 6c4e281028 pylint: Fix new unnecessary-lambda-assignment 2022-06-08 12:25:12 +02:00
Florian Bruhin 26d308d95d pylint: Enable docparams checker 2021-12-03 13:36:20 +01:00
Florian Bruhin 8ee510a082 tests: Fix test_real_git with different core.abbrev
Fixes #6825
2021-11-17 09:14:20 +01:00
Florian Bruhin eac6be1367 Clarify backend version string 2021-05-05 16:59:56 +02:00
Florian Bruhin febb921040 Add QUTE_QTWEBENGINE_VERSION_OVERRIDE
See https://github.com/NixOS/nixpkgs/pull/119376#issuecomment-820073044
2021-04-15 11:00:18 +02:00
Florian Bruhin 32604a6651 tests: Fix test_version with git's init.defaultBranch 2021-04-15 10:54:17 +02:00
Florian Bruhin 1a383bb670 Don't parse distribution versions
We don't actually need those values anywhere, and parsing can be tricky
as there isn't a fixed format for those version numbers. Let's just not
do it at all. See #6354.
2021-04-07 13:28:24 +02:00
Florian Bruhin c3d1b71c6f Handle version numbers with >3 digits
Closes #6354
2021-04-07 13:23:12 +02:00
Florian Bruhin c7657e65cc tests: Skip test_real_chromium_version if guessing too much 2021-03-31 13:10:09 +02:00
Florian Bruhin c9e6aea1b4 tests: Make test_real_chromium_version clearer 2021-03-31 13:10:09 +02:00