about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/qscintilla-qt5/default.nix
blob: 70ee4308913420a24abf25bb90b9cda89527207f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{ lib
, pythonPackages
, qscintilla
, qtbase
}:

let
  inherit (pythonPackages) buildPythonPackage isPy3k python sip_4 pyqt5;
in buildPythonPackage rec {
  pname = "qscintilla";
  version = qscintilla.version;
  src = qscintilla.src;
  format = "other";

  disabled = !isPy3k;

  nativeBuildInputs = [ sip_4 qtbase ];
  buildInputs = [ qscintilla ];
  propagatedBuildInputs = [ pyqt5 ];

  dontWrapQtApps = true;

  postPatch = ''
    substituteInPlace Python/configure.py \
      --replace \
      "target_config.py_module_dir" \
      "'$out/${python.sitePackages}'"
  '';

  preConfigure = ''
    # configure.py will look for this folder
    mkdir -p $out/share/sip/PyQt5

    cd Python
    substituteInPlace configure.py \
      --replace "qmake = {'CONFIG': 'qscintilla2'}" "qmake = {'CONFIG': 'qscintilla2', 'QT': 'widgets printsupport'}"
    ${python.executable} ./configure.py \
      --pyqt=PyQt5 \
      --destdir=$out/${python.sitePackages}/PyQt5 \
      --stubsdir=$out/${python.sitePackages}/PyQt5 \
      --apidir=$out/api/${python.libPrefix} \
      --qsci-incdir=${qscintilla}/include \
      --qsci-featuresdir=${qscintilla}/mkspecs/features \
      --qsci-libdir=${qscintilla}/lib \
      --pyqt-sipdir=${pyqt5}/${python.sitePackages}/PyQt5/bindings \
      --qsci-sipdir=$out/share/sip/PyQt5 \
      --sip-incdir=${sip_4}/include
  '';

  postInstall = ''
    # Needed by pythonImportsCheck to find the module
    export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH"
  '';

  # Checked using pythonImportsCheck
  doCheck = false;

  pythonImportsCheck = [ "PyQt5.Qsci" ];

  meta = with lib; {
    description = "A Python binding to QScintilla, Qt based text editing control";
    license = licenses.lgpl21Plus;
    maintainers = with maintainers; [ lsix ];
    homepage = "https://www.riverbankcomputing.com/software/qscintilla/";
  };
}