1{ lib 2, stdenv 3, fetchPypi 4, fetchpatch 5, buildPythonPackage 6, setuptools 7, which 8, pkg-config 9, python 10, isPy27 11, doxygen 12, cairo 13, ncurses 14, pango 15, wxGTK 16, gtk3 17, AGL 18, AudioToolbox 19, AVFoundation 20, AVKit 21, Carbon 22, Cocoa 23, CoreFoundation 24, CoreMedia 25, IOKit 26, Kernel 27, OpenGL 28, Security 29, WebKit 30, pillow 31, numpy 32, six 33, libXinerama 34, libSM 35, libXxf86vm 36, libXtst 37, libGLU 38, libGL 39, xorgproto 40, gst_all_1 41, libglvnd 42, mesa 43, webkitgtk 44, autoPatchelfHook 45}: 46let 47 dynamic-linker = stdenv.cc.bintools.dynamicLinker; 48in 49buildPythonPackage rec { 50 pname = "wxPython"; 51 version = "4.1.1"; 52 disabled = isPy27; 53 format = "other"; 54 55 src = fetchPypi { 56 inherit pname version; 57 sha256 = "0a1mdhdkda64lnwm1dg0dlrf9rs4gkal3lra6hpqbwn718cf7r80"; 58 }; 59 60 # ld: framework not found System 61 postPatch = '' 62 for file in ext/wxWidgets/configure*; do 63 substituteInPlace $file --replace "-framework System" "" 64 done 65 ''; 66 67 # https://github.com/NixOS/nixpkgs/issues/75759 68 # https://github.com/wxWidgets/Phoenix/issues/1316 69 doCheck = false; 70 71 nativeBuildInputs = [ 72 which 73 doxygen 74 gtk3 75 pkg-config 76 setuptools 77 ] ++ lib.optionals stdenv.isLinux [ 78 autoPatchelfHook 79 ]; 80 81 buildInputs = [ 82 gtk3 83 ncurses 84 ] ++ lib.optionals stdenv.isLinux [ 85 libXinerama 86 libSM 87 libXxf86vm 88 libXtst 89 xorgproto 90 gst_all_1.gstreamer 91 gst_all_1.gst-plugins-base 92 libGLU 93 libGL 94 libglvnd 95 mesa 96 webkitgtk 97 ] ++ lib.optionals stdenv.isDarwin [ 98 AGL 99 AudioToolbox 100 AVFoundation 101 AVKit 102 Carbon 103 Cocoa 104 CoreFoundation 105 CoreMedia 106 IOKit 107 Kernel 108 OpenGL 109 Security 110 WebKit 111 ]; 112 113 propagatedBuildInputs = [ 114 pillow 115 numpy 116 six 117 ]; 118 119 DOXYGEN = "${doxygen}/bin/doxygen"; 120 121 preConfigure = lib.optionalString (!stdenv.isDarwin) '' 122 substituteInPlace wx/lib/wxcairo/wx_pycairo.py \ 123 --replace '_dlls = dict()' '_dlls = {k: ctypes.CDLL(v) for k, v in [ 124 ("gdk", "${gtk3}/lib/libgtk-x11-3.0.so"), 125 ("pangocairo", "${pango.out}/lib/libpangocairo-1.0.so"), 126 ("cairoLib = None", "cairoLib = ctypes.CDLL('${cairo}/lib/libcairo.so')"), 127 ("appsvc", None) 128 ]}' 129 ''; 130 131 buildPhase = '' 132 ${python.interpreter} build.py -v build_wx dox etg --nodoc sip build_py 133 ''; 134 135 installPhase = '' 136 ${python.interpreter} setup.py install --skip-build --prefix=$out 137 wrapPythonPrograms 138 ''; 139 140 meta = with lib; { 141 description = "Cross platform GUI toolkit for Python, Phoenix version"; 142 homepage = "http://wxpython.org/"; 143 license = licenses.wxWindows; 144 maintainers = with maintainers; [ tfmoraes ]; 145 }; 146}