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