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 {
|
2017-11-09 11:26:09 +00:00
|
|
|
pname = "wxPython";
|
2015-09-02 18:40:38 +01:00
|
|
|
version = "3.0.2.0";
|
2017-11-09 11:26:09 +00:00
|
|
|
name = pname + "-" + version;
|
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" ];
|
|
|
|
|
2019-03-03 07:37:03 +00:00
|
|
|
nativeBuildInputs = [ pkgconfig ]
|
|
|
|
++ (lib.optionals (!stdenv.isDarwin) [ wxGTK libX11 ])
|
|
|
|
++ (lib.optionals stdenv.isDarwin [ wxmac darwin.apple_sdk.frameworks.Cocoa ]);
|
|
|
|
|
|
|
|
buildInputs = [ ]
|
|
|
|
++ (lib.optionals (!stdenv.isDarwin) [ (wxGTK.gtk) ])
|
|
|
|
++ (lib.optional openglSupport pyopengl);
|
|
|
|
|
2017-02-15 01:26:17 +00:00
|
|
|
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" ""
|
2017-12-13 20:01:06 +00:00
|
|
|
# set the WXPREFIX to $out instead of the storepath of wxwidgets
|
|
|
|
substituteInPlace config.py \
|
|
|
|
--replace "WXPREFIX = getWxConfigValue('--prefix')" "WXPREFIX = '$out'"
|
2017-02-15 01:26:17 +00:00
|
|
|
# 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
|
|
|
|
|
|
|
buildPhase = "";
|
|
|
|
|
|
|
|
installPhase = ''
|
2017-12-13 20:01:06 +00:00
|
|
|
${python.interpreter} setup.py install WXPORT=${if stdenv.isDarwin then "osx_cocoa" else "gtk2"} NO_HEADERS=0 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; };
|
|
|
|
}
|