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