nixpkgs/pkgs/development/python-modules/wxPython/3.0.nix

92 lines
2.5 KiB
Nix
Raw Normal View History

{ fetchurl
, lib
2017-02-15 01:26:17 +00:00
, stdenv
, darwin
, openglSupport ? true
, libX11
, wxGTK
2017-02-15 01:26:17 +00:00
, wxmac
, pkgconfig
, buildPythonPackage
, pyopengl
, isPy3k
, isPyPy
, python
, cairo
, pango
}:
2014-03-25 21:32:39 +00:00
assert wxGTK.unicode;
2014-03-25 21:32:39 +00:00
buildPythonPackage rec {
pname = "wxPython";
2015-09-02 18:40:38 +01:00
version = "3.0.2.0";
2014-03-25 21:32:39 +00:00
disabled = isPy3k || isPyPy;
doCheck = false;
src = fetchurl {
url = "mirror://sourceforge/wxpython/wxPython-src-${version}.tar.bz2";
sha256 = "0qfzx3sqx4mwxv99sfybhsij4b5pc03ricl73h4vhkzazgjjjhfm";
};
2019-09-08 21:09:42 +01:00
dontUseSetuptoolsBuild = true;
dontUsePipInstall = true;
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 ]);
2019-03-03 07:37:03 +00:00
buildInputs = [ ]
++ (lib.optionals (!stdenv.isDarwin) [ (wxGTK.gtk) ])
++ (lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
ApplicationServices
AudioToolbox
CFNetwork
Carbon
Cocoa
CoreGraphics
CoreServices
CoreText
DiskArbitration
IOKit
ImageIO
OpenGL
Security
]))
2019-03-03 07:37:03 +00:00
++ (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" ""
# 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;"
'' + 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
'';
buildPhase = "";
installPhase = ''
${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
wrapPythonPrograms
'';
2014-03-25 21:32:39 +00:00
passthru = { inherit wxGTK openglSupport; };
}