1{ python
2, pythonAtLeast
3, disabledIf
4, fetchurl
5, lib
6, stdenv
7, cmake
8, libxcrypt
9, ninja
10, qt5
11, shiboken2
12}:
13
14# Only build when Python<=3.10
15# See https://bugreports.qt.io/browse/PYSIDE-1864
16# "There are no plans to support Python versions > 3.10 in the 5.15 branch."
17disabledIf (pythonAtLeast "3.11") (
18stdenv.mkDerivation rec {
19 pname = "pyside2";
20 version = "5.15.5";
21
22 src = fetchurl {
23 url = "https://download.qt.io/official_releases/QtForPython/pyside2/PySide2-${version}-src/pyside-setup-opensource-src-${version}.tar.xz";
24 sha256 = "0cwvw6695215498rsbm2xzkwaxdr3w7zfvy4kc62c01k6pxs881r";
25 };
26
27 patches = [
28 ./dont_ignore_optional_modules.patch
29 ];
30
31 postPatch = ''
32 cd sources/pyside2
33 '';
34
35 cmakeFlags = [
36 "-DBUILD_TESTS=OFF"
37 "-DPYTHON_EXECUTABLE=${python.interpreter}"
38 ];
39
40 env.NIX_CFLAGS_COMPILE = "-I${qt5.qtdeclarative.dev}/include/QtQuick/${qt5.qtdeclarative.version}/QtQuick";
41
42 nativeBuildInputs = [ cmake ninja qt5.qmake python ];
43
44 buildInputs = (with qt5; [
45 qtbase
46 qtxmlpatterns
47 qtmultimedia
48 qttools
49 qtx11extras
50 qtlocation
51 qtscript
52 qtwebsockets
53 qtwebengine
54 qtwebchannel
55 qtcharts
56 qtsensors
57 qtsvg
58 qt3d
59 ]) ++ (with python.pkgs; [
60 setuptools
61 ]) ++ (lib.optionals (python.pythonOlder "3.9") [
62 # see similar issue: 202262
63 # libxcrypt is required for crypt.h for building older python modules
64 libxcrypt
65 ]);
66
67 propagatedBuildInputs = [ shiboken2 ];
68
69 dontWrapQtApps = true;
70
71 postInstall = ''
72 cd ../../..
73 ${python.pythonForBuild.interpreter} setup.py egg_info --build-type=pyside2
74 cp -r PySide2.egg-info $out/${python.sitePackages}/
75 '';
76
77 meta = with lib; {
78 description = "LGPL-licensed Python bindings for Qt";
79 license = licenses.lgpl21;
80 homepage = "https://wiki.qt.io/Qt_for_Python";
81 maintainers = with maintainers; [ gebner ];
82 };
83})