Merge pull request #194833 from nrdxp/pyqt6-webengine-new
pyqt6-webengine: init
This commit is contained in:
commit
4a0123e49e
9 changed files with 174 additions and 62 deletions
|
@ -1,5 +1,5 @@
|
|||
{ stdenv, lib, fetchurl, fetchzip, python3
|
||||
, mkDerivationWith, wrapQtAppsHook, wrapGAppsHook, qtbase, qtwebengine, glib-networking
|
||||
{ stdenv, lib, fetchurl, fetchzip, fetchFromGitHub, python3
|
||||
, wrapQtAppsHook, glib-networking
|
||||
, asciidoc, docbook_xml_dtd_45, docbook_xsl, libxml2
|
||||
, libxslt, gst_all_1 ? null
|
||||
, withPdfReader ? true
|
||||
|
@ -7,35 +7,56 @@
|
|||
, backend ? "webengine"
|
||||
, pipewireSupport ? stdenv.isLinux
|
||||
, pipewire_0_2
|
||||
}:
|
||||
, qtwayland
|
||||
, mkDerivationWith ? null
|
||||
, qtbase ? null
|
||||
, qtwebengine ? null
|
||||
, wrapGAppsHook ? null
|
||||
}: let
|
||||
isQt6 = mkDerivationWith == null;
|
||||
|
||||
assert withMediaPlayback -> gst_all_1 != null;
|
||||
|
||||
let
|
||||
python3Packages = python3.pkgs;
|
||||
pdfjs = let
|
||||
version = "2.14.305";
|
||||
in
|
||||
fetchzip rec {
|
||||
fetchzip {
|
||||
url = "https://github.com/mozilla/pdf.js/releases/download/v${version}/pdfjs-${version}-dist.zip";
|
||||
hash = "sha256-E7t+0AUndrgi4zfJth0w28RmWLqLyXMUCnueNf/gNi4=";
|
||||
stripRoot = false;
|
||||
};
|
||||
|
||||
backendPackage =
|
||||
if backend == "webengine" then python3Packages.pyqtwebengine else
|
||||
if backend == "webengine" then if isQt6 then python3Packages.pyqt6-webengine else python3Packages.pyqtwebengine else
|
||||
if backend == "webkit" then python3Packages.pyqt5_with_qtwebkit else
|
||||
throw ''
|
||||
Unknown qutebrowser backend "${backend}".
|
||||
Valid choices are qtwebengine (recommended) or qtwebkit.
|
||||
'';
|
||||
|
||||
in mkDerivationWith python3Packages.buildPythonApplication rec {
|
||||
pname = "qutebrowser";
|
||||
version = "2.5.2";
|
||||
buildPythonApplication = if isQt6 then python3Packages.buildPythonApplication else mkDerivationWith python3Packages.buildPythonApplication;
|
||||
|
||||
pname = "qutebrowser";
|
||||
version = if isQt6 then "unstable-2022-09-16" else "2.5.2";
|
||||
|
||||
in
|
||||
|
||||
assert withMediaPlayback -> gst_all_1 != null;
|
||||
assert isQt6 -> backend != "webkit";
|
||||
|
||||
buildPythonApplication {
|
||||
inherit pname version;
|
||||
|
||||
src = if isQt6 then
|
||||
# comes from qt6-v2 branch of upstream
|
||||
# https://github.com/qutebrowser/qutebrowser/issues/7202
|
||||
fetchFromGitHub {
|
||||
owner = "qutebrowser";
|
||||
repo = "qutebrowser";
|
||||
rev = "5e11e6c7d413cf5c77056ba871a545aae1cfd66a";
|
||||
sha256 = "sha256-5HNzPO07lUQe/Q3Nb4JiS9kb9GMQ5/FqM5029vLNNWo=";
|
||||
}
|
||||
# the release tarballs are different from the git checkout!
|
||||
src = fetchurl {
|
||||
else fetchurl {
|
||||
url = "https://github.com/qutebrowser/qutebrowser/releases/download/v${version}/${pname}-${version}.tar.gz";
|
||||
hash = "sha256-qb/OFN3EA94N6y7t+YPCMc4APgdZmV7H706jTkl06Qg=";
|
||||
};
|
||||
|
@ -66,6 +87,7 @@ in mkDerivationWith python3Packages.buildPythonApplication rec {
|
|||
adblock
|
||||
]
|
||||
++ lib.optional (pythonOlder "3.9") importlib-resources
|
||||
++ lib.optional stdenv.isLinux qtwayland
|
||||
);
|
||||
|
||||
patches = [
|
||||
|
@ -94,14 +116,15 @@ in mkDerivationWith python3Packages.buildPythonApplication rec {
|
|||
|
||||
# Install icons
|
||||
for i in 16 24 32 48 64 128 256 512; do
|
||||
install -Dm644 "icons/qutebrowser-''${i}x''${i}.png" \
|
||||
install -Dm644 "qutebrowser/icons/qutebrowser-''${i}x''${i}.png" \
|
||||
"$out/share/icons/hicolor/''${i}x''${i}/apps/qutebrowser.png"
|
||||
done
|
||||
install -Dm644 icons/qutebrowser.svg \
|
||||
install -Dm644 ${if isQt6 then "qutebrowser/" else ""}icons/qutebrowser.svg \
|
||||
"$out/share/icons/hicolor/scalable/apps/qutebrowser.svg"
|
||||
|
||||
# Install scripts
|
||||
sed -i "s,/usr/bin/,$out/bin/,g" scripts/open_url_in_instance.sh
|
||||
${if isQt6 then "rm -rf scripts/{testbrowser,dev}" else ""}
|
||||
install -Dm755 -t "$out/share/qutebrowser/scripts/" $(find scripts -type f)
|
||||
install -Dm755 -t "$out/share/qutebrowser/userscripts/" misc/userscripts/*
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
, enableProprietaryCodecs ? true
|
||||
}:
|
||||
|
||||
qtModule rec {
|
||||
qtModule {
|
||||
pname = "qtwebengine";
|
||||
qtInputs = [ qtdeclarative qtwebchannel qtwebsockets qtpositioning ];
|
||||
nativeBuildInputs = [
|
||||
|
@ -94,6 +94,12 @@ qtModule rec {
|
|||
# which cannot be set at the same time as -Wformat-security
|
||||
hardeningDisable = [ "format" ];
|
||||
|
||||
patches = [
|
||||
# fixes consistent crashing in github on 6.4.0, can probably remove when there is a patch release
|
||||
# https://codereview.qt-project.org/c/qt/qtwebengine/+/436316
|
||||
../patches/qtwebengine-fix.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# Patch Chromium build tools
|
||||
(
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
From 81bf140583f7b7bf13cc8dd522e1ca2aba873fc4 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Negyokru <negyokru@inf.u-szeged.hu>
|
||||
Date: Mon, 03 Oct 2022 12:20:00 +0200
|
||||
Subject: [PATCH] Do not intercept websocket connection when there is no associated frame
|
||||
|
||||
This fix is based on chrome's implementation.
|
||||
|
||||
Fixes: QTBUG-107144
|
||||
Change-Id: If042e4156b8a4bdb27a210c4db94e3a6198aed7d
|
||||
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
|
||||
(cherry picked from commit 64b7da9dab82713fdcb2e03d8a2715421eae5685)
|
||||
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
||||
---
|
||||
|
||||
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
|
||||
index 020ae91..99a3aa3 100644
|
||||
--- a/src/core/content_browser_client_qt.cpp
|
||||
+++ b/src/core/content_browser_client_qt.cpp
|
||||
@@ -1237,8 +1237,7 @@
|
||||
|
||||
bool ContentBrowserClientQt::WillInterceptWebSocket(content::RenderFrameHost *frame)
|
||||
{
|
||||
- Q_UNUSED(frame);
|
||||
- return true; // It is probably not worth it to only intercept when interceptors are installed
|
||||
+ return frame != nullptr;
|
||||
}
|
||||
|
||||
QWebEngineUrlRequestInterceptor *getProfileInterceptorFromFrame(content::RenderFrameHost *frame)
|
|
@ -2,20 +2,14 @@
|
|||
|
||||
buildPythonPackage rec {
|
||||
pname = "pyqt-builder";
|
||||
version = "1.13.0";
|
||||
version = "1.14.0";
|
||||
|
||||
src = fetchPypi {
|
||||
pname = "PyQt-builder";
|
||||
inherit version;
|
||||
sha256 = "sha256-SHdYDDjOtTIOEps4HQg7CoYBxoFm2LmXB/CPoKFonu8=";
|
||||
sha256 = "sha256-Z1WTHG0viUBVPgM00QyTPOXMGLZEJelP2hrM9P93T1k=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# use the sip-distinfo executable from PATH instead of trying to guess,
|
||||
# we know it's the right one because it's the _only_ one
|
||||
./use-sip-distinfo-from-path.patch
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [ packaging sip ];
|
||||
|
||||
pythonImportsCheck = [ "pyqtbuild" ];
|
||||
|
@ -27,6 +21,6 @@ buildPythonPackage rec {
|
|||
description = "PEP 517 compliant build system for PyQt";
|
||||
homepage = "https://pypi.org/project/PyQt-builder/";
|
||||
license = licenses.gpl3Only;
|
||||
maintainers = with maintainers; [ ];
|
||||
maintainers = with maintainers; [ nrdxp ];
|
||||
};
|
||||
}
|
||||
|
|
89
pkgs/development/python-modules/pyqt6-webengine.nix
Normal file
89
pkgs/development/python-modules/pyqt6-webengine.nix
Normal file
|
@ -0,0 +1,89 @@
|
|||
{ lib
|
||||
, buildPythonPackage
|
||||
, fetchPypi
|
||||
, pkg-config
|
||||
, lndir
|
||||
, sip
|
||||
, pyqt-builder
|
||||
, qt6Packages
|
||||
, pythonOlder
|
||||
, pyqt6
|
||||
, python
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "PyQt6_WebEngine";
|
||||
version = "6.4.0";
|
||||
format = "pyproject";
|
||||
|
||||
disabled = pythonOlder "3.6";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "sha256-THHBMIYKvNEeBMr7IuM5g/qaOu6DI8UZCbFaFwGCjiE=";
|
||||
};
|
||||
|
||||
# fix include path and increase verbosity
|
||||
postPatch = ''
|
||||
sed -i \
|
||||
'/\[tool.sip.project\]/a\
|
||||
verbose = true\
|
||||
sip-include-dirs = [\"${pyqt6}/${python.sitePackages}/PyQt6/bindings\"]' \
|
||||
pyproject.toml
|
||||
'';
|
||||
|
||||
enableParallelBuilding = true;
|
||||
# HACK: paralellize compilation of make calls within pyqt's setup.py
|
||||
# pkgs/stdenv/generic/setup.sh doesn't set this for us because
|
||||
# make gets called by python code and not its build phase
|
||||
# format=pyproject means the pip-build-hook hook gets used to build this project
|
||||
# pkgs/development/interpreters/python/hooks/pip-build-hook.sh
|
||||
# does not use the enableParallelBuilding flag
|
||||
postUnpack = ''
|
||||
export MAKEFLAGS+=" -j$NIX_BUILD_CORES -l$NIX_BUILD_CORES"
|
||||
'';
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
dontWrapQtApps = true;
|
||||
|
||||
nativeBuildInputs = with qt6Packages; [
|
||||
pkg-config
|
||||
lndir
|
||||
sip
|
||||
qtwebengine
|
||||
qmake
|
||||
pyqt-builder
|
||||
];
|
||||
|
||||
buildInputs = with qt6Packages; [
|
||||
qtwebengine
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
pyqt6
|
||||
];
|
||||
|
||||
passthru = {
|
||||
inherit sip;
|
||||
};
|
||||
|
||||
dontConfigure = true;
|
||||
|
||||
# Checked using pythonImportsCheck, has no tests
|
||||
doCheck = true;
|
||||
|
||||
pythonImportsCheck = [
|
||||
"PyQt6.QtWebEngineCore"
|
||||
"PyQt6.QtWebEngineQuick"
|
||||
"PyQt6.QtWebEngineWidgets"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Python bindings for Qt6 WebEngine";
|
||||
homepage = "https://riverbankcomputing.com/";
|
||||
license = licenses.gpl3Only;
|
||||
platforms = platforms.mesaPlatforms;
|
||||
maintainers = with maintainers; [ LunNova nrdxp ];
|
||||
};
|
||||
}
|
|
@ -2,35 +2,19 @@
|
|||
|
||||
buildPythonPackage rec {
|
||||
pname = "sip";
|
||||
version = "6.6.2";
|
||||
version = "6.7.1";
|
||||
|
||||
src = fetchPypi {
|
||||
pname = "sip";
|
||||
inherit version;
|
||||
sha256 = "sha256-Dj76wcXf2OUlrlcUCSffJpk+E/WLidFXfDFPQQW/2Q0=";
|
||||
sha256 = "sha256-KBcP34gPk3Am/If6qcF3sGLDU8XRaeoyQrB4AmFN3Qw=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# on non-x86 Linux platforms, sip incorrectly detects the manylinux version
|
||||
# and PIP will refuse to install the resulting wheel.
|
||||
# remove once upstream fixes this, hopefully in 6.5.2
|
||||
./fix-manylinux-version.patch
|
||||
|
||||
# fix issue triggered by QGIS 3.26.x, already fixed upstream
|
||||
# in SIP, waiting for release past 6.6.2
|
||||
(fetchpatch {
|
||||
url = "https://riverbankcomputing.com/hg/sip/raw-diff/323d39a2d602/sipbuild/generator/parser/instantiations.py";
|
||||
hash = "sha256-QEQuRzXA+wK9Dt22U/LgIwtherY9pJURGJYpKpJkiok=";
|
||||
})
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [ packaging ply toml ];
|
||||
|
||||
# There aren't tests
|
||||
doCheck = false;
|
||||
|
||||
pythonImportsCheck = [ "sipbuild" ];
|
||||
|
||||
# FIXME: Why isn't this detected automatically?
|
||||
# Needs to be specified in pyproject.toml, e.g.:
|
||||
# [tool.sip.bindings.MODULE]
|
||||
|
@ -45,10 +29,12 @@ buildPythonPackage rec {
|
|||
else
|
||||
throw "unsupported platform";
|
||||
|
||||
pythonImportsCheck = [ "sipbuild" ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Creates C++ bindings for Python modules";
|
||||
homepage = "https://riverbankcomputing.com/";
|
||||
license = licenses.gpl3Only;
|
||||
maintainers = with maintainers; [ ];
|
||||
maintainers = with maintainers; [ nrdxp ];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
diff --git a/sipbuild/project.py b/sipbuild/project.py
|
||||
--- a/sipbuild/project.py
|
||||
+++ b/sipbuild/project.py
|
||||
@@ -336,13 +336,13 @@ class Project(AbstractProject, Configurable):
|
||||
# We expect a two part tag so leave anything else unchanged.
|
||||
parts = platform_tag.split('-')
|
||||
if len(parts) == 2:
|
||||
- if self.minimum_glibc_version > (2, 17):
|
||||
+ if self.minimum_glibc_version > (2, 17) or parts[1] not in {"x86_64", "i686", "aarch64", "armv7l", "ppc64", "ppc64le", "s390x"}:
|
||||
# PEP 600.
|
||||
parts[0] = 'manylinux'
|
||||
parts.insert(1,
|
||||
'{}.{}'.format(self.minimum_glibc_version[0],
|
||||
self.minimum_glibc_version[1]))
|
||||
- elif self.minimum_glibc_version > (2, 12):
|
||||
+ elif self.minimum_glibc_version > (2, 12) or parts[1] not in {"x86_64", "i686"}:
|
||||
# PEP 599.
|
||||
parts[0] = 'manylinux2014'
|
||||
elif self.minimum_glibc_version > (2, 5):
|
|
@ -31104,6 +31104,9 @@ with pkgs;
|
|||
};
|
||||
|
||||
qutebrowser = libsForQt5.callPackage ../applications/networking/browsers/qutebrowser { };
|
||||
qutebrowser-qt6 = callPackage ../applications/networking/browsers/qutebrowser {
|
||||
inherit (qt6Packages) qtbase qtwebengine wrapQtAppsHook qtwayland;
|
||||
};
|
||||
|
||||
qxw = callPackage ../applications/editors/qxw {};
|
||||
|
||||
|
|
|
@ -8421,6 +8421,8 @@ in {
|
|||
|
||||
pyqt6-sip = callPackage ../development/python-modules/pyqt/pyqt6-sip.nix { };
|
||||
|
||||
pyqt6-webengine = callPackage ../development/python-modules/pyqt6-webengine.nix { };
|
||||
|
||||
pyqtgraph = callPackage ../development/python-modules/pyqtgraph { };
|
||||
|
||||
pyqtwebengine = pkgs.libsForQt5.callPackage ../development/python-modules/pyqtwebengine {
|
||||
|
|
Loading…
Reference in a new issue