2016-05-27 20:25:48 +01:00
|
|
|
{ fetchurl
|
|
|
|
, lib
|
2017-02-15 01:26:17 +00:00
|
|
|
, stdenv
|
|
|
|
, darwin
|
2016-05-27 20:25:48 +01:00
|
|
|
, openglSupport ? true
|
|
|
|
, libX11
|
|
|
|
, wxGTK
|
2017-02-15 01:26:17 +00:00
|
|
|
, wxmac
|
2016-05-27 20:25:48 +01:00
|
|
|
, pkgconfig
|
2016-10-18 16:57:03 +01:00
|
|
|
, buildPythonPackage
|
|
|
|
, pyopengl
|
|
|
|
, isPy3k
|
|
|
|
, isPyPy
|
|
|
|
, python
|
2017-04-21 23:35:34 +01:00
|
|
|
, cairo
|
|
|
|
, pango
|
2016-05-27 20:25:48 +01:00
|
|
|
}:
|
2014-03-25 21:32:39 +00:00
|
|
|
|
2016-05-27 20:25:48 +01:00
|
|
|
assert wxGTK.unicode;
|
2014-03-25 21:32:39 +00:00
|
|
|
|
2016-05-27 20:25:48 +01:00
|
|
|
buildPythonPackage rec {
|
|
|
|
name = "wxPython-${version}";
|
2015-09-02 18:40:38 +01:00
|
|
|
version = "3.0.2.0";
|
2014-03-25 21:32:39 +00:00
|
|
|
|
2016-05-27 20:25:48 +01:00
|
|
|
disabled = isPy3k || isPyPy;
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://sourceforge/wxpython/wxPython-src-${version}.tar.bz2";
|
|
|
|
sha256 = "0qfzx3sqx4mwxv99sfybhsij4b5pc03ricl73h4vhkzazgjjjhfm";
|
|
|
|
};
|
|
|
|
|
2016-05-31 15:24:38 +01:00
|
|
|
hardeningDisable = [ "format" ];
|
|
|
|
|
2017-02-15 01:26:17 +00:00
|
|
|
propagatedBuildInputs = [ pkgconfig ]
|
|
|
|
++ (lib.optional openglSupport pyopengl)
|
|
|
|
++ (lib.optionals (!stdenv.isDarwin) [ wxGTK (wxGTK.gtk) libX11 ])
|
|
|
|
++ (lib.optionals stdenv.isDarwin [ wxmac darwin.apple_sdk.frameworks.Cocoa ])
|
|
|
|
;
|
|
|
|
preConfigure = ''
|
|
|
|
cd wxPython
|
|
|
|
# remove wxPython's darwin hack that interference with python-2.7-distutils-C++.patch
|
|
|
|
substituteInPlace config.py \
|
|
|
|
--replace "distutils.unixccompiler.UnixCCompiler = MyUnixCCompiler" ""
|
|
|
|
# this check is supposed to only return false on older systems running non-framework python
|
|
|
|
substituteInPlace src/osx_cocoa/_core_wrap.cpp \
|
|
|
|
--replace "return wxPyTestDisplayAvailable();" "return true;"
|
2017-04-21 23:35:34 +01:00
|
|
|
'' + lib.optionalString (!stdenv.isDarwin) ''
|
|
|
|
substituteInPlace wx/lib/wxcairo.py \
|
|
|
|
--replace 'cairoLib = None' 'cairoLib = ctypes.CDLL("${cairo}/lib/libcairo.so")'
|
|
|
|
substituteInPlace wx/lib/wxcairo.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)
|
|
|
|
]}'
|
2017-02-15 01:26:17 +00:00
|
|
|
'';
|
2016-05-27 20:25:48 +01:00
|
|
|
|
2017-02-15 01:26:17 +00:00
|
|
|
NIX_LDFLAGS = lib.optionalString (!stdenv.isDarwin) "-lX11 -lgdk-x11-2.0";
|
2016-05-27 20:25:48 +01:00
|
|
|
|
|
|
|
buildPhase = "";
|
|
|
|
|
|
|
|
installPhase = ''
|
2017-02-15 01:26:17 +00:00
|
|
|
${python.interpreter} setup.py install WXPORT=${if stdenv.isDarwin then "osx_cocoa" else "gtk2"} NO_HEADERS=1 BUILD_GLCANVAS=${if openglSupport then "1" else "0"} UNICODE=1 --prefix=$out
|
2016-05-27 20:25:48 +01:00
|
|
|
wrapPythonPrograms
|
|
|
|
'';
|
2014-03-25 21:32:39 +00:00
|
|
|
|
2016-05-27 20:25:48 +01:00
|
|
|
passthru = { inherit wxGTK openglSupport; };
|
|
|
|
}
|