1{
2 lib,
3 pythonPackages,
4 qscintilla,
5 qtbase,
6 qmake,
7 qtmacextras,
8 stdenv,
9}:
10
11let
12 inherit (pythonPackages)
13 buildPythonPackage
14 isPy3k
15 python
16 sip
17 sipbuild
18 pyqt5
19 pyqt-builder
20 ;
21in
22buildPythonPackage {
23 pname = "qscintilla-qt5";
24 version = qscintilla.version;
25 src = qscintilla.src;
26 format = "pyproject";
27
28 disabled = !isPy3k;
29
30 nativeBuildInputs = [
31 sip
32 qmake
33 pyqt-builder
34 qscintilla
35 pythonPackages.setuptools
36 ];
37 buildInputs = [ qtbase ];
38 propagatedBuildInputs = [ pyqt5 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ qtmacextras ];
39
40 dontWrapQtApps = true;
41
42 postPatch =
43 ''
44 cd Python
45 cp pyproject-qt5.toml pyproject.toml
46 echo '[tool.sip.project]' >> pyproject.toml
47 echo 'sip-include-dirs = [ "${pyqt5}/${python.sitePackages}/PyQt5/bindings"]' \
48 >> pyproject.toml
49 ''
50 + lib.optionalString stdenv.hostPlatform.isDarwin ''
51 substituteInPlace project.py \
52 --replace \
53 "if self.project.qsci_external_lib:
54 if self.qsci_features_dir is not None:" \
55 "if self.project.qsci_external_lib:
56 self.builder_settings.append('QT += widgets')
57
58 self.builder_settings.append('QT += printsupport')
59
60 if self.qsci_features_dir is not None:"
61 '';
62
63 dontConfigure = true;
64
65 build = ''
66 sip-install --qsci-features-dir ${qscintilla}/mkspecs/features \
67 --qsci-include-dir ${qscintilla}/include \
68 --qsci-library-dir ${qscintilla}/lib --api-dir ${qscintilla}/share";
69 '';
70 postInstall = ''
71 # Needed by pythonImportsCheck to find the module
72 export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH"
73 '';
74
75 # Checked using pythonImportsCheck
76 doCheck = false;
77
78 pythonImportsCheck = [ "PyQt5.Qsci" ];
79
80 meta = with lib; {
81 description = "Python binding to QScintilla, Qt based text editing control";
82 license = licenses.lgpl21Plus;
83 maintainers = with maintainers; [ lsix ];
84 homepage = "https://www.riverbankcomputing.com/software/qscintilla/";
85 };
86}