Rename version.is_sandboxed() to is_flatpak()
This commit is contained in:
parent
fb0154ae26
commit
5ce8a9c9c1
|
|
@ -310,7 +310,7 @@ def _parse_from_file(f: IO[bytes]) -> Versions:
|
|||
|
||||
def parse_webenginecore() -> Optional[Versions]:
|
||||
"""Parse the QtWebEngineCore library file."""
|
||||
if version.is_sandboxed():
|
||||
if version.is_flatpak():
|
||||
# Flatpak has Qt in /usr/lib/x86_64-linux-gnu, but QtWebEngine in /app/lib.
|
||||
library_path = pathlib.Path("/app/lib")
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -232,7 +232,10 @@ def _init_runtime(args: Optional[argparse.Namespace]) -> None:
|
|||
# Unfortunately this path could get too long for sockets (which have a
|
||||
# maximum length of 104 chars), so we don't add the username here...
|
||||
|
||||
if version.is_sandboxed():
|
||||
if version.is_flatpak():
|
||||
# We need a path like /run/user/1000/app/org.qutebrowser.qutebrowser rather than
|
||||
# /run/user/1000/qutebrowser on Flatpak, since that's bind-mounted in a way that
|
||||
# it is accessible by any other qutebrowser instances.
|
||||
*parts, app_name = os.path.split(path)
|
||||
assert app_name == APPNAME, app_name
|
||||
path = os.path.join(*parts, 'app', os.environ['FLATPAK_ID'])
|
||||
|
|
|
|||
|
|
@ -605,7 +605,7 @@ def open_file(filename: str, cmdline: str = None) -> None:
|
|||
# if we want to use the default
|
||||
override = config.val.downloads.open_dispatcher
|
||||
|
||||
if version.is_sandboxed():
|
||||
if version.is_flatpak():
|
||||
if cmdline:
|
||||
message.error("Cannot spawn download dispatcher from sandbox")
|
||||
return
|
||||
|
|
|
|||
|
|
@ -183,8 +183,12 @@ def distribution() -> Optional[DistributionInfo]:
|
|||
parsed=parsed, version=dist_version, pretty=pretty, id=dist_id)
|
||||
|
||||
|
||||
def is_sandboxed() -> bool:
|
||||
"""Whether the environment has restricted access to the host system."""
|
||||
def is_flatpak() -> bool:
|
||||
"""Whether qutebrowser is running via Flatpak.
|
||||
|
||||
If packaged via Flatpak, the environment is has restricted access to the host
|
||||
system.
|
||||
"""
|
||||
current_distro = distribution()
|
||||
if current_distro is None:
|
||||
return False
|
||||
|
|
|
|||
|
|
@ -319,9 +319,9 @@ def test_distribution(tmpdir, monkeypatch, os_release, expected):
|
|||
id='arch', parsed=version.Distribution.arch, version=None,
|
||||
pretty='Arch Linux'), False)
|
||||
])
|
||||
def test_is_sandboxed(monkeypatch, distribution, expected):
|
||||
def test_is_flatpak(monkeypatch, distribution, expected):
|
||||
monkeypatch.setattr(version, "distribution", lambda: distribution)
|
||||
assert version.is_sandboxed() == expected
|
||||
assert version.is_flatpak() == expected
|
||||
|
||||
|
||||
class GitStrSubprocessFake:
|
||||
|
|
|
|||
Loading…
Reference in New Issue