python3Packages.wxpython: 4.2.3 -> 4.2.4 (#465935)

This commit is contained in:
Martin Weinelt
2025-12-01 14:10:23 +00:00
committed by GitHub
2 changed files with 69 additions and 16 deletions
@@ -1,8 +1,17 @@
diff --git a/wx/lib/wxcairo/wx_pycairo.py b/wx/lib/wxcairo/wx_pycairo.py
index 7cfe3071..24d1120f 100644
index 19a28dd131f659cd596de280bc52f3f7fb1acb5f..dc6bea6afb36e4197fac990877b7112ade84d6f4 100644
--- a/wx/lib/wxcairo/wx_pycairo.py
+++ b/wx/lib/wxcairo/wx_pycairo.py
@@ -197,7 +197,12 @@ def _findCairoLib():
@@ -25,7 +25,7 @@ import ctypes.util
#----------------------------------------------------------------------------
# A reference to the cairo shared lib via ctypes.CDLL
-cairoLib = None
+cairoLib = ctypes.CDLL("@libcairo@")
# A reference to the pycairo C API structure
pycairoAPI = None
@@ -196,7 +196,11 @@ def _findCairoLib():
# For other DLLs we'll just use a dictionary to track them, as there
# probably isn't any need to use them outside of this module.
@@ -10,7 +19,6 @@ index 7cfe3071..24d1120f 100644
+_dlls = {
+ "gdk": ctypes.CDLL("@libgdk@"),
+ "pangocairo": ctypes.CDLL("@libpangocairo@"),
+ "cairoLib": ctypes.CDLL("@libcairo@"),
+ "appsvc": ctypes.CDLL(None),
+}
@@ -4,11 +4,13 @@
buildPythonPackage,
setuptools,
fetchPypi,
fetchpatch,
replaceVars,
# build
autoPatchelfHook,
attrdict,
cython,
doxygen,
pkg-config,
python,
@@ -38,37 +40,51 @@
numpy,
pillow,
six,
# checks
py,
pytest,
pytest-forked,
xvfb-run,
}:
buildPythonPackage rec {
pname = "wxpython";
version = "4.2.3";
version = "4.2.4";
format = "other";
src = fetchPypi {
pname = "wxPython";
inherit version;
hash = "sha256-INbgySfifO2FZDcZvWPp9/1QHfbpqKqxSJsDmJf9fAE=";
inherit pname version;
hash = "sha256-LrEjl5yHvLMp6KJFImnWD/j59lHpvyXGdXnlPE67rjw=";
};
patches = [
(replaceVars ./4.2-ctypes.patch {
libgdk = "${gtk3.out}/lib/libgdk-3.so";
libpangocairo = "${pango}/lib/libpangocairo-1.0.so";
libcairo = "${cairo}/lib/libcairo.so";
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 "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
@@ -102,6 +118,13 @@ buildPythonPackage rec {
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 = ''
@@ -124,13 +147,35 @@ buildPythonPackage rec {
runHook postInstall
'';
checkPhase = ''
runHook preCheck
# The majority of the tests require a graphical environment, but xvfb-run is available only on Linux.
# Tests on aarch64-linux fail randomly on OfBorg.
doCheck = stdenv.hostPlatform.isx86_64 && stdenv.hostPlatform.isLinux;
${python.interpreter} build.py -v test
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
runHook postCheck
'';
HOME=$(mktemp -d) xvfb-run ${python.interpreter} build.py -v --extra_pytest='${testArguments}' test
runHook postCheck
'';
meta = with lib; {
changelog = "https://github.com/wxWidgets/Phoenix/blob/wxPython-${version}/CHANGES.rst";