writers: add writeGuile[Bin] (#364531)
[NixPkgs.git] / pkgs / development / python-modules / pyqt / 6.x.nix
blobb1bf34abd4897cfbaf3688a7153a643058997cdf
2   lib,
3   stdenv,
4   buildPythonPackage,
5   fetchurl,
6   pkg-config,
7   dbus,
8   lndir,
9   setuptools,
10   dbus-python,
11   sip,
12   pyqt6-sip,
13   pyqt-builder,
14   qt6Packages,
15   pythonOlder,
16   mesa,
17   withMultimedia ? true,
18   withWebSockets ? true,
19   withLocation ? true,
20   # Not currently part of PyQt6
21   #, withConnectivity ? true
22   withPrintSupport ? true,
23   cups,
26 buildPythonPackage rec {
27   pname = "pyqt6";
28   version = "6.8.0.dev2410141303";
29   format = "pyproject";
31   disabled = pythonOlder "3.6";
33   # This is dangerous, how can we get web archive to archive the URL?
34   src = fetchurl {
35     url = "https://riverbankcomputing.com/pypi/packages/PyQt6/PyQt6-${version}.tar.gz";
36     hash = "sha256-eHYqj22us07uFkErJD2d0y0wueZxtQTwTFW9cI7yoK4=";
37   };
39   patches = [
40     # Fix some wrong assumptions by ./project.py
41     # TODO: figure out how to send this upstream
42     # FIXME: make a version for PyQt6?
43     # ./pyqt5-fix-dbus-mainloop-support.patch
44     # confirm license when installing via pyqt6_sip
45     ./pyqt5-confirm-license.patch
46   ];
48   # be more verbose
49   # and normalize version
50   postPatch = ''
51     cat >> pyproject.toml <<EOF
52     [tool.sip.project]
53     verbose = true
54     EOF
56     # pythonRelaxDeps doesn't work and the wanted versions are not released AFAIK
57     substituteInPlace pyproject.toml \
58       --replace-fail 'version = "${version}"' 'version = "${lib.versions.pad 3 version}"' \
59       --replace-fail "sip >=6.9, <7" "sip >=6.8.6, <7" \
60       --replace-fail 'PyQt-builder >=1.17, <2' "PyQt-builder >=1.16, <2"
61   '';
63   enableParallelBuilding = true;
64   # HACK: paralellize compilation of make calls within pyqt's setup.py
65   # pkgs/stdenv/generic/setup.sh doesn't set this for us because
66   # make gets called by python code and not its build phase
67   # format=pyproject means the pip-build-hook hook gets used to build this project
68   # pkgs/development/interpreters/python/hooks/pip-build-hook.sh
69   # does not use the enableParallelBuilding flag
70   postUnpack = ''
71     export MAKEFLAGS+="''${enableParallelBuilding:+-j$NIX_BUILD_CORES}"
72   '';
74   outputs = [
75     "out"
76     "dev"
77   ];
79   dontWrapQtApps = true;
81   nativeBuildInputs =
82     with qt6Packages;
83     [
84       pkg-config
85       lndir
86       sip
87       qtbase
88       qtsvg
89       qtdeclarative
90       qtwebchannel
91       qmake
92       qtquick3d
93       qtquicktimeline
94     ]
95     # ++ lib.optional withConnectivity qtconnectivity
96     ++ lib.optional withMultimedia qtmultimedia
97     ++ lib.optional withWebSockets qtwebsockets
98     ++ lib.optional withLocation qtlocation;
100   buildInputs =
101     with qt6Packages;
102     [
103       dbus
104       qtbase
105       qtsvg
106       qtdeclarative
107       pyqt-builder
108       qtquick3d
109       qtquicktimeline
110     ]
111     # ++ lib.optional withConnectivity qtconnectivity
112     ++ lib.optional withWebSockets qtwebsockets
113     ++ lib.optional withLocation qtlocation;
115   propagatedBuildInputs =
116     [
117       dbus-python
118       pyqt6-sip
119       setuptools
120     ]
121     # ld: library not found for -lcups
122     ++ lib.optionals (withPrintSupport && stdenv.hostPlatform.isDarwin) [ cups ];
124   passthru = {
125     inherit sip pyqt6-sip;
126     multimediaEnabled = withMultimedia;
127     WebSocketsEnabled = withWebSockets;
128   };
130   dontConfigure = true;
132   # Checked using pythonImportsCheck, has no tests
134   pythonImportsCheck =
135     [
136       "PyQt6"
137       "PyQt6.QtCore"
138       "PyQt6.QtQml"
139       "PyQt6.QtWidgets"
140       "PyQt6.QtGui"
141       "PyQt6.QtQuick"
142     ]
143     ++ lib.optional withWebSockets "PyQt6.QtWebSockets"
144     ++ lib.optional withMultimedia "PyQt6.QtMultimedia"
145     # ++ lib.optional withConnectivity "PyQt6.QtConnectivity"
146     ++ lib.optional withLocation "PyQt6.QtPositioning";
148   env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin "-Wno-address-of-temporary";
150   meta = with lib; {
151     description = "Python bindings for Qt6";
152     homepage = "https://riverbankcomputing.com/";
153     license = licenses.gpl3Only;
154     inherit (mesa.meta) platforms;
155     maintainers = with maintainers; [ LunNova ];
156   };