1{
2 python,
3 fetchurl,
4 lib,
5 stdenv,
6 cmake,
7 libxcrypt,
8 ninja,
9 qt5,
10 shiboken2,
11}:
12stdenv.mkDerivation rec {
13 pname = "pyside2";
14 version = "5.15.16";
15
16 src = fetchurl {
17 url = "https://download.qt.io/official_releases/QtForPython/pyside2/PySide2-${version}-src/pyside-setup-opensource-src-${version}.tar.xz";
18 hash = "sha256-bT7W/RcnXqdIKatW35wudkG/ymtbIBzyRJmPqBzwc2A=";
19 };
20
21 patches = [
22 ./nix_compile_cflags.patch
23 ./Final-details-to-enable-3.12-wheel-compatibility.patch
24 ./Python-3.12-Fix-the-structure-of-class-property.patch
25 ./Support-running-PySide-on-Python-3.12.patch
26 ./shiboken2-clang-Fix-and-simplify-resolveType-helper.patch
27 ./shiboken2-clang-Fix-build-with-clang-16.patch
28 ./shiboken2-clang-Fix-clashes-between-type-name-and-enumera.patch
29 ./shiboken2-clang-Record-scope-resolution-of-arguments-func.patch
30 ./shiboken2-clang-Remove-typedef-expansion.patch
31 ./shiboken2-clang-Suppress-class-scope-look-up-for-paramete.patch
32 ./shiboken2-clang-Write-scope-resolution-for-all-parameters.patch
33 ./dont_ignore_optional_modules.patch
34 ./Modify-sendCommand-signatures.patch
35 ];
36
37 postPatch = ''
38 cd sources/pyside2
39 '';
40
41 cmakeFlags = [
42 "-DBUILD_TESTS=OFF"
43 "-DPYTHON_EXECUTABLE=${python.interpreter}"
44 ];
45
46 env.NIX_CFLAGS_COMPILE = "-I${qt5.qtdeclarative.dev}/include/QtQuick/${qt5.qtdeclarative.version}/QtQuick";
47
48 nativeBuildInputs = [
49 cmake
50 ninja
51 qt5.qmake
52 (python.withPackages (
53 ps: with ps; [
54 distutils
55 setuptools
56 ]
57 ))
58 ];
59
60 buildInputs =
61 (with qt5; [
62 qtbase
63 qtxmlpatterns
64 qtmultimedia
65 qttools
66 qtx11extras
67 qtlocation
68 qtscript
69 qtwebsockets
70 qtwebengine
71 qtwebchannel
72 qtcharts
73 qtsensors
74 qtsvg
75 qt3d
76 ])
77 ++ (with python.pkgs; [ setuptools ])
78 ++ (lib.optionals (python.pythonOlder "3.9") [
79 # see similar issue: 202262
80 # libxcrypt is required for crypt.h for building older python modules
81 libxcrypt
82 ]);
83
84 propagatedBuildInputs = [ shiboken2 ];
85
86 dontWrapQtApps = true;
87
88 postInstall = ''
89 cd ../../..
90 ${python.pythonOnBuildForHost.interpreter} setup.py egg_info --build-type=pyside2
91 cp -r PySide2.egg-info $out/${python.sitePackages}/
92 '';
93
94 meta = with lib; {
95 description = "LGPL-licensed Python bindings for Qt";
96 license = licenses.lgpl21;
97 homepage = "https://wiki.qt.io/Qt_for_Python";
98 maintainers = with maintainers; [ ];
99 platforms = platforms.all;
100 broken = stdenv.hostPlatform.isDarwin;
101 };
102}