1{
2 wrapPython,
3 python,
4 lib,
5 stdenv,
6 cmake,
7 qt5,
8 shiboken2,
9 pyside2,
10}:
11
12stdenv.mkDerivation {
13 pname = "pyside2-tools";
14
15 inherit (pyside2) version src;
16
17 patches = [
18 # Upstream has a crazy build system only geared towards producing binary
19 # wheels distributed via pypi. For this, they copy the `uic` and `rcc`
20 # binaries to the wheel.
21 ./remove_hacky_binary_copying.patch
22 ];
23
24 postPatch = ''
25 cd sources/pyside2-tools
26 '';
27
28 nativeBuildInputs = [
29 cmake
30 wrapPython
31 ];
32 propagatedBuildInputs = [
33 shiboken2
34 pyside2
35 ];
36 buildInputs = [
37 python
38 qt5.qtbase
39 ];
40
41 cmakeFlags = [ "-DBUILD_TESTS=OFF" ];
42
43 dontWrapQtApps = true;
44
45 # The upstream build system consists of a `setup.py` whichs builds three
46 # different python libraries and calls cmake as a subprocess. We call cmake
47 # directly because that's easier to get working. However, the `setup.py`
48 # build also creates a few wrapper scripts, which we replicate here:
49 postInstall = ''
50 rm $out/bin/pyside_tool.py
51
52 for tool in uic rcc; do
53 makeWrapper "$(command -v $tool)" $out/bin/pyside2-$tool --add-flags "-g python"
54 done
55 '';
56
57 postFixup = ''
58 wrapPythonPrograms
59 '';
60
61 meta = with lib; {
62 description = "PySide2 development tools";
63 license = licenses.gpl2;
64 homepage = "https://wiki.qt.io/Qt_for_Python";
65 maintainers = with maintainers; [ gebner ];
66 };
67}