def test_distribution(tmpdir, monkeypatch, os_release, expected): os_release_file = tmpdir / 'os-release' if os_release is not None: os_release_file.write(textwrap.dedent(os_release)) monkeypatch.setenv('QUTE_FAKE_OS_RELEASE', str(os_release_file)) assert version.distribution() == expected
def test_distribution(tmp_path, monkeypatch, os_release, expected): os_release_file = tmp_path / 'os-release' if os_release is not None: os_release_file.write_text(textwrap.dedent(os_release), encoding="utf-8") monkeypatch.setenv('QUTE_FAKE_OS_RELEASE', str(os_release_file)) assert version.distribution() == expected
def qute_backend_warning(_url): """Handler for qute://backend-warning.""" html = jinja.render('backend-warning.html', distribution=version.distribution(), Distribution=version.Distribution, version=pkg_resources.parse_version) return 'text/html', html
def qute_backend_warning(_url): """Handler for qute://backend-warning.""" html = jinja.render('backend-warning.html', distribution=version.distribution(), Distribution=version.Distribution, version=pkg_resources.parse_version, title="Legacy backend warning") return 'text/html', html
def _check_devtools_resources(self) -> None: """Make sure that the devtools resources are available on Fedora. Fedora packages devtools resources into its own package. If it's not installed, we show a nice error instead of a blank inspector. """ dist = version.distribution() if dist is None or dist.parsed != version.Distribution.fedora: return data_path = pathlib.Path(QLibraryInfo.location(QLibraryInfo.DataPath)) pak = data_path / 'resources' / 'qtwebengine_devtools_resources.pak' if not pak.exists(): raise inspector.Error("QtWebEngine devtools resources not found, " "please install the qt5-webengine-devtools " "Fedora package.")
def __init__(self, *, data_dir: pathlib.Path, has_basedir: bool = False) -> None: self.enabled = _should_be_used() self._has_basedir = has_basedir self._cache_path = data_dir / "adblock-cache.dat" try: self._engine = adblock.Engine(adblock.FilterSet()) except AttributeError: # this should never happen - let's get some infos if it does logger.debug(f"adblock module: {adblock}") dist = version.distribution() if (dist is not None and dist.parsed == version.Distribution.arch and hasattr(adblock, "__file__")): proc = subprocess.run( ['pacman', '-Qo', adblock.__file__], stdout=subprocess.PIPE, universal_newlines=True, check=False, ) logger.debug(proc.stdout) raise