about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/wxPython/4.0.nix
blob: d72d4aa35d4d90ff2c211929eefd0f40ca292ad4 (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
67
68
69
70
71
72
73
74
75
76
77
78
{ lib
, stdenv
, buildPythonPackage
, fetchPypi
, pkg-config
, which
, cairo
, pango
, python
, doxygen
, ncurses
, libintl
, numpy
, pillow
, six
, wxGTK
, wxmac
, IOKit
, Carbon
, Cocoa
, AudioToolbox
, OpenGL
, CoreFoundation
}:

buildPythonPackage rec {
  pname = "wxPython";
  version = "4.0.7.post2";

  src = fetchPypi {
    inherit pname version;
    sha256 = "5a229e695b64f9864d30a5315e0c1e4ff5e02effede0a07f16e8d856737a0c4e";
  };

  doCheck = false;

  nativeBuildInputs = [ pkg-config which doxygen ]
  ++ (if stdenv.isDarwin then [ wxmac ] else [ wxGTK ]);

  buildInputs = [ ncurses libintl ]
  ++ (if stdenv.isDarwin
  then
    [ AudioToolbox Carbon Cocoa CoreFoundation IOKit OpenGL ]
  else
    [ wxGTK.gtk ]
  );

  DOXYGEN = "${doxygen}/bin/doxygen";

  preConfigure = lib.optionalString (!stdenv.isDarwin) ''
    substituteInPlace wx/lib/wxcairo/wx_pycairo.py \
      --replace 'cairoLib = None' 'cairoLib = ctypes.CDLL("${cairo}/lib/libcairo.so")'
    substituteInPlace wx/lib/wxcairo/wx_pycairo.py \
      --replace '_dlls = dict()' '_dlls = {k: ctypes.CDLL(v) for k, v in [
        ("gdk",        "${wxGTK.gtk}/lib/libgtk-x11-2.0.so"),
        ("pangocairo", "${pango.out}/lib/libpangocairo-1.0.so"),
        ("appsvc",     None)
      ]}'
  '';

  buildPhase = ''
    ${python.interpreter} build.py -v --use_syswx dox etg --nodoc sip build_py
  '';

  installPhase = ''
    ${python.interpreter} setup.py install --skip-build --prefix=$out
  '';

  passthru = { wxWidgets = if stdenv.isDarwin then wxmac else wxGTK; };


  meta = {
    description = "Cross platform GUI toolkit for Python, Phoenix version";
    homepage = "http://wxpython.org/";
    license = lib.licenses.wxWindows;
  };

}