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