1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
{
lib,
stdenv,
buildPythonPackage,
setuptools,
fetchPypi,
fetchpatch,
replaceVars,
# build
autoPatchelfHook,
attrdict,
cython,
doxygen,
pkg-config,
python,
requests,
sip,
which,
buildPackages,
# runtime
cairo,
gst_all_1,
gtk3,
libGL,
libGLU,
libSM,
libXinerama,
libXtst,
libXxf86vm,
libglvnd,
libgbm,
pango,
webkitgtk_4_1,
wxGTK,
xorgproto,
# propagates
numpy,
pillow,
six,
# checks
py,
pytest,
pytest-forked,
xvfb-run,
}:
buildPythonPackage rec {
pname = "wxpython";
version = "4.2.4";
pyproject = false;
src = fetchPypi {
inherit pname version;
hash = "sha256-LrEjl5yHvLMp6KJFImnWD/j59lHpvyXGdXnlPE67rjw=";
};
patches = [
(replaceVars ./4.2-ctypes.patch {
libgdk = "${lib.getLib gtk3}/lib/libgdk-3${stdenv.hostPlatform.extensions.sharedLibrary}";
libpangocairo = "${lib.getLib pango}/lib/libpangocairo-1.0${stdenv.hostPlatform.extensions.sharedLibrary}";
libcairo = "${lib.getLib cairo}/lib/libcairo${stdenv.hostPlatform.extensions.sharedLibrary}";
})
./0001-add-missing-bool-c.patch # Add missing bool.c from old source
# TODO: drop when updating beyond version 4.2.4
# https://github.com/wxWidgets/Phoenix/pull/2822
(fetchpatch {
name = "Fix-wx.svg-to-work-with-cython-3.1-generated-code.patch";
url = "https://github.com/wxWidgets/Phoenix/commit/31303649ab0a0fed0789e0951a7487d172b65bfa.patch";
hash = "sha256-OAnAsyqHGPNEAiOxLLpdEGcd92K7TCxqEBYceuIb8so=";
})
];
# https://github.com/wxWidgets/Phoenix/issues/2575
postPatch = ''
ln -s ${lib.getExe buildPackages.waf} bin/waf
substituteInPlace build.py \
--replace-fail "distutils.dep_util" "setuptools.modified" \
--replace-fail "runcmd(cmd, fatal=False)" "runcmd(cmd, fatal=True)" # fail when pytest reports errors
'';
nativeBuildInputs = [
attrdict
cython
pkg-config
requests
setuptools
sip
which
wxGTK
]
++ lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
buildInputs = [
wxGTK
]
++ lib.optionals stdenv.hostPlatform.isLinux [
gst_all_1.gst-plugins-base
gst_all_1.gstreamer
libGL
libGLU
libSM
libXinerama
libXtst
libXxf86vm
libglvnd
libgbm
webkitgtk_4_1
xorgproto
];
propagatedBuildInputs = [
numpy
pillow
six
];
nativeCheckInputs = [
py # py must be ordered before pytest (see https://github.com/pytest-dev/pytest-forked/issues/88)
pytest
pytest-forked
xvfb-run
];
wafPath = "bin/waf";
buildPhase = ''
runHook preBuild
export DOXYGEN=${doxygen}/bin/doxygen
export PATH="${wxGTK}/bin:$PATH"
${python.pythonOnBuildForHost.interpreter} build.py -v --use_syswx dox etg sip --nodoc build_py
runHook postBuild
'';
installPhase = ''
runHook preInstall
${python.pythonOnBuildForHost.interpreter} setup.py install --skip-build --prefix=$out
wrapPythonPrograms
runHook postInstall
'';
# The majority of the tests require a graphical environment, but xvfb-run is available only on Linux.
# Tests fail randomly on OfBorg and Hydra.
doCheck = false;
checkPhase =
let
# Some tests appear to be incompatible with xvfb-run.
skippedTests = [
"dirdlg"
"display"
"filectrl"
"filedlg"
"filedlgcustomize"
"frame"
"glcanvas"
"pickers"
"windowid"
];
testArguments = lib.concatMapStringsSep " " (
test: "--ignore unittests/test_${test}.py"
) skippedTests;
in
''
runHook preCheck
HOME=$(mktemp -d) xvfb-run ${python.interpreter} build.py -v --extra_pytest='${testArguments}' test
runHook postCheck
'';
meta = {
changelog = "https://github.com/wxWidgets/Phoenix/blob/wxPython-${version}/CHANGES.rst";
description = "Cross platform GUI toolkit for Python, Phoenix version";
homepage = "http://wxpython.org/";
license = with lib.licenses; [
lgpl2Plus
wxWindowsException31
];
};
}
|