Fix version parsing with Flatpak

See https://github.com/flathub/org.qutebrowser.qutebrowser/issues/11

(cherry picked from commit 7ae7b6ea1a)
This commit is contained in:
Florian Bruhin 2021-03-17 17:25:52 +01:00
parent c82e2bbe0b
commit aa1801ecae
1 changed files with 6 additions and 2 deletions

View File

@ -69,7 +69,7 @@ from typing import IO, ClassVar, Dict, Optional, Tuple, cast
from PyQt5.QtCore import QLibraryInfo
from qutebrowser.utils import log
from qutebrowser.utils import log, version
class ParseError(Exception):
@ -310,7 +310,11 @@ def _parse_from_file(f: IO[bytes]) -> Versions:
def parse_webenginecore() -> Optional[Versions]:
"""Parse the QtWebEngineCore library file."""
library_path = pathlib.Path(QLibraryInfo.location(QLibraryInfo.LibrariesPath))
if version.is_sandboxed():
# Flatpak has Qt in /usr/lib/x86_64-linux-gnu, but QtWebEngine in /app/lib.
library_path = pathlib.Path("/app/lib")
else:
library_path = pathlib.Path(QLibraryInfo.location(QLibraryInfo.LibrariesPath))
# PyQt bundles those files with a .5 suffix
lib_file = library_path / 'libQt5WebEngineCore.so.5'