Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyqt5: make qtwebkit optional, disable by default #51846

Merged
merged 10 commits into from
Dec 30, 2018
2 changes: 1 addition & 1 deletion pkgs/applications/audio/cadence/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
DESTDIR=$(out)
'';

propagatedBuildInputs = with python3Packages; [ pyqt5 ];
propagatedBuildInputs = with python3Packages; [ pyqt5_with_qtwebkit ];

postInstall = ''
# replace with our own wrappers. They need to be changed manually since it wouldn't work otherwise
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/misc/calibre/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
] ++ stdenv.lib.optional (!unrarSupport) ./dont_build_unrar_plugin.patch;

prePatch = ''
sed -i "/pyqt_sip_dir/ s:=.*:= '${python2Packages.pyqt5}/share/sip/PyQt5':" \
sed -i "/pyqt_sip_dir/ s:=.*:= '${python2Packages.pyqt5_with_qtwebkit}/share/sip/PyQt5':" \
setup/build_environment.py

# Remove unneeded files and libs
Expand All @@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
fontconfig podofo qtbase chmlib icu sqlite libusb1 libmtp xdg_utils wrapGAppsHook
] ++ (with python2Packages; [
apsw cssselect cssutils dateutil dnspython html5-parser lxml mechanize netifaces pillow
python pyqt5 sip
python pyqt5_with_qtwebkit sip
regex msgpack
# the following are distributed with calibre, but we use upstream instead
odfpy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
, libxslt, gst_all_1 ? null
, withPdfReader ? true
, withMediaPlayback ? true
, withWebEngineDefault ? true
}:

assert withMediaPlayback -> gst_all_1 != null;
Expand Down Expand Up @@ -39,7 +38,7 @@ in python3Packages.buildPythonApplication rec {
] ++ lib.optionals withMediaPlayback (with gst_all_1; [
gst-plugins-base gst-plugins-good
gst-plugins-bad gst-plugins-ugly gst-libav
]) ++ lib.optional (!withWebEngineDefault) python3Packages.qtwebkit-plugins;
]);

nativeBuildInputs = [
makeWrapper wrapGAppsHook asciidoc
Expand Down Expand Up @@ -90,10 +89,6 @@ in python3Packages.buildPythonApplication rec {
done
'';

postFixup = lib.optionalString (! withWebEngineDefault) ''
wrapProgram $out/bin/qutebrowser --add-flags "--backend webkit"
'';

meta = with stdenv.lib; {
homepage = https://github.com/The-Compiler/qutebrowser;
description = "Keyboard-focused browser with a minimal GUI";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pythonPackages.buildPythonApplication rec {
sed -i 's|@out@|'"''${out}"'|g' blink/resources.py
'';

propagatedBuildInputs = with pythonPackages; [ pyqt5 cjson sipsimple twisted google_api_python_client ];
propagatedBuildInputs = with pythonPackages; [ pyqt5_with_qtwebkit cjson sipsimple twisted google_api_python_client ];

buildInputs = [ pythonPackages.cython zlib libvncserver libvpx ];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ in python3Packages.buildPythonPackage {
sha256 = "e0d1cb72115d0fda17db92d28be51558ad8fe250972683fac3086dbe8d350d22";
};

propagatedBuildInputs = with python3Packages; [ pyqt5 dbus-python jsmin ];
propagatedBuildInputs = with python3Packages; [ pyqt5_with_qtwebkit dbus-python jsmin ];

meta = with stdenv.lib; {
description = "Non-official desktop client for Slack";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

let
inherit (pythonPackages) buildPythonApplication pyqt5 sip pyinotify;

in buildPythonApplication rec {
name = "git-cola-${version}";
version = "3.2";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/video/openshot-qt/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ python3Packages.buildPythonApplication rec {

buildInputs = [ gtk3 ];

propagatedBuildInputs = with python3Packages; [ libopenshot pyqt5 requests sip httplib2 pyzmq ];
propagatedBuildInputs = with python3Packages; [ libopenshot pyqt5_with_qtwebkit requests sip httplib2 pyzmq ];


preConfigure = ''
Expand Down
41 changes: 19 additions & 22 deletions pkgs/development/python-modules/pyqt/5.x.nix
Original file line number Diff line number Diff line change
@@ -1,30 +1,21 @@
{ lib, fetchurl, fetchpatch, pythonPackages, pkgconfig
, qmake, lndir, qtbase, qtsvg, qtwebkit, qtwebengine, dbus
, withWebSockets ? false, qtwebsockets
, qmake, lndir, qtbase, qtsvg, qtwebengine, dbus
, withConnectivity ? false, qtconnectivity
, withWebKit ? false, qtwebkit
, withWebSockets ? false, qtwebsockets
}:

let
pname = "PyQt";
version = "5.11.3";

inherit (pythonPackages) buildPythonPackage python isPy3k dbus-python enum34;

sip = pythonPackages.sip.override { sip-module = "PyQt5.sip"; };

in buildPythonPackage {
pname = pname;
version = version;
in buildPythonPackage rec {
pname = "PyQt";
version = "5.11.3";
format = "other";

meta = with lib; {
description = "Python bindings for Qt5";
homepage = http://www.riverbankcomputing.co.uk;
license = licenses.gpl3;
platforms = platforms.mesaPlatforms;
maintainers = with maintainers; [ sander ];
};

src = fetchurl {
url = "mirror://sourceforge/pyqt/PyQt5/PyQt-${version}/PyQt5_gpl-${version}.tar.gz";
sha256 = "0wqh4srqkcc03rvkwrcshaa028psrq58xkys6npnyhqxc0apvdf9";
Expand All @@ -36,9 +27,11 @@ in buildPythonPackage {

buildInputs = [ dbus sip ];

propagatedBuildInputs = [
qtbase qtsvg qtwebkit qtwebengine
] ++ lib.optional (!isPy3k) enum34 ++ lib.optional withWebSockets qtwebsockets ++ lib.optional withConnectivity qtconnectivity;
propagatedBuildInputs = [ qtbase qtsvg qtwebengine ]
++ lib.optional (!isPy3k) enum34
++ lib.optional withConnectivity qtconnectivity
++ lib.optional withWebKit qtwebkit
++ lib.optional withWebSockets qtwebsockets;

configurePhase = ''
runHook preConfigure
Expand All @@ -49,10 +42,6 @@ in buildPythonPackage {

export PYTHONPATH=$PYTHONPATH:$out/${python.sitePackages}

substituteInPlace configure.py \
--replace 'install_dir=pydbusmoddir' "install_dir='$out/${python.sitePackages}/dbus/mainloop'" \
--replace "ModuleMetadata(qmake_QT=['webkitwidgets'])" "ModuleMetadata(qmake_QT=['webkitwidgets', 'printsupport'])"

${python.executable} configure.py -w \
--confirm-license \
--dbus=${dbus.dev}/include/dbus-1.0 \
Expand All @@ -74,4 +63,12 @@ in buildPythonPackage {
'';

enableParallelBuilding = true;

meta = with lib; {
description = "Python bindings for Qt5";
homepage = http://www.riverbankcomputing.co.uk;
license = licenses.gpl3;
platforms = platforms.mesaPlatforms;
maintainers = with maintainers; [ sander ];
};
}
2 changes: 1 addition & 1 deletion pkgs/development/python-modules/qtconsole/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ buildPythonPackage rec {
description = "Jupyter Qt console";
homepage = http://jupyter.org/;
license = lib.licenses.bsd3;
platforms = lib.platforms.linux; # fails on Darwin
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ fridh ];
};
}
5 changes: 4 additions & 1 deletion pkgs/misc/frescobaldi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ python3Packages.buildPythonApplication rec {
sha256 = "1yn18pwsjxpxz5j3yfysmaif8k0vqahj5c7ays9cxsylpg9hl7jd";
};

propagatedBuildInputs = with python3Packages; [ lilypond pygame python-ly poppler-qt5 ];
propagatedBuildInputs = with python3Packages; [
lilypond pygame python-ly sip
pyqt5_with_qtwebkit (poppler-qt5.override { pyqt5 = pyqt5_with_qtwebkit; })
];

# no tests in shipped with upstream
doCheck = false;
Expand Down
7 changes: 7 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,13 @@ in {
pythonPackages = self;
};

/*
`pyqt5_with_qtwebkit` should not be used by python libraries in
pkgs/development/python-modules/*. Putting this attribute in
`propagatedBuildInputs` may cause collisions.
*/
pyqt5_with_qtwebkit = self.pyqt5.override { withWebKit = true; };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment here explaining that this one should not be used by any Python libraries (so pkgs/development/python-modules/*) to avoid potential collisions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There can still be a collision on application level. Should I we move pyqt5_with_qtwebkit uses from propagatedBuildInputs to wrappers modifying PYTHONPATH? Or maybe use python.withPackages?


pysc2 = callPackage ../development/python-modules/pysc2 { };

pyscard = callPackage ../development/python-modules/pyscard { inherit (pkgs.darwin.apple_sdk.frameworks) PCSC; };
Expand Down