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