1{ lib
2, stdenv
3, fetchPypi
4, buildPythonPackage
5, which
6, pkg-config
7, python
8, isPy27
9, doxygen
10, cairo
11, ncurses
12, pango
13, wxGTK
14, pillow
15, numpy
16}:
17let
18 dynamic-linker = stdenv.cc.bintools.dynamicLinker;
19in
20buildPythonPackage rec {
21 pname = "wxPython";
22 version = "4.1.0";
23 disabled = isPy27;
24
25 src = fetchPypi {
26 inherit pname version;
27 sha256 = "12x4ci5q7qni4rkfiq6lnpn1fk8b0sfc6dck5wyxkj2sfp5pa91f";
28 };
29
30 # https://github.com/NixOS/nixpkgs/issues/75759
31 # https://github.com/wxWidgets/Phoenix/issues/1316
32 doCheck = false;
33
34 nativeBuildInputs = [ which doxygen wxGTK pkg-config ];
35
36 buildInputs = [
37 wxGTK.gtk
38 ncurses
39 ];
40
41 propagatedBuildInputs = [ pillow numpy ];
42
43 DOXYGEN = "${doxygen}/bin/doxygen";
44
45 preConfigure = lib.optionalString (!stdenv.isDarwin) ''
46 substituteInPlace wx/lib/wxcairo/wx_pycairo.py \
47 --replace 'cairoLib = None' 'cairoLib = ctypes.CDLL("${cairo}/lib/libcairo.so")'
48 substituteInPlace wx/lib/wxcairo/wx_pycairo.py \
49 --replace '_dlls = dict()' '_dlls = {k: ctypes.CDLL(v) for k, v in [
50 ("gdk", "${wxGTK.gtk}/lib/libgtk-x11-3.0.so"),
51 ("pangocairo", "${pango.out}/lib/libpangocairo-1.0.so"),
52 ("appsvc", None)
53 ]}'
54
55 # https://github.com/wxWidgets/Phoenix/pull/1584
56 # It'll be not needed in next version because https://github.com/wxWidgets/Phoenix/pull/1699
57 substituteInPlace build.py --replace "os.environ['PYTHONPATH'] = phoenixDir()" \
58 "os.environ['PYTHONPATH'] = os.environ['PYTHONPATH'] + os.pathsep + phoenixDir()"
59 '';
60
61 buildPhase = ''
62 ${python.interpreter} build.py -v --use_syswx dox etg --nodoc build_py
63 '';
64
65 installPhase = ''
66 ${python.interpreter} setup.py install --skip-build --prefix=$out
67 wrapPythonPrograms
68 '';
69
70 passthru = { inherit wxGTK; };
71
72 meta = with lib; {
73 description = "Cross platform GUI toolkit for Python, Phoenix version";
74 homepage = "http://wxpython.org/";
75 license = licenses.wxWindows;
76 maintainers = with maintainers; [ tfmoraes ];
77 };
78}